Closed lunacd closed 2 months ago
I'm not as familiar with github actions (particularly complex ones) as I am with gitlab pipelines, so this may not be possible (or easily possible), but one of the hopes I had for using docker was that we could decouple of the building of the base images from our push and pull request workflow. The Images could be built on a timer, or when a user manually updates them, and then we just re-use those images. I'm concerned that as we add more OSes and tests that the CI time is going to get really long.
The Images could be built on a timer, or when a user manually updates them, and then we just re-use those images.
Not sure if I followed you correctly, are you saying that we publish to cps/cps-config
or something on DockerHub and then in our CI just use the image to build CPS?
Please correct me if I'm wrong, but I don't think that would have any performance benefit over the workflow in this PR. Docker builds are cached by GH Actions by layer. If we don't change build dependencies, for example, docker/build-push-action@v5
or the cache-from: type=gha
configuration specifically, will just pull the layers from GH Actions cache. This wouldn't be different from pulling the published image from a registry.
Further, the benefit of this is that it automatically detects when a layer is changed, e.g. adding/removing dependencies, and correctly invalidates the cache. If we publish the image, a PR that requires a new dependency, or one that updates the image from Ubuntu 22.04 to 24.04, is guaranteed to fail.
I'm concerned that as we add more OSes and tests that the CI time is going to get really long.
They are parallel so they probably wouldn't be too long. My concern is using too much cache to a point of GHA stopping us from doing so. But you are right, and I would propose:
Or we can have one primary distro we are testing multiple flavors on. All the others can just be baseline gcc. I'm flexible and this can be whichever people feel best about.
Since the project is quite small now, I'm OK with taking a step back on ccache support to improve test coverage. If this PR merges, @lunacd, can you make an issue to revisit compile caching support?
I googled a bit and found this issue: https://github.com/moby/buildkit/issues/1512. The issue isn't directly related to this, but from the comments, it seems that cache-to
only saves layer cache, not mounted cache. I'll make an issue to revisit this. Wouldn't be hard to get. We just have to manually manage volume/bind.
Ah, I'm demonstrating what I don't understand! It look like it's doing exactly what I hoped for then, this requires a bit more manual intervention on GitLab, so I was expecting more intervention on GitHub as well. Please disregard my comments, this all looks good from my point of view.
Changes:
Changes
tests/docker
, added two dockerfiles that builds docker images for testing cps-config. The two dockerfiles are for ubuntu and rockylinux currently. More platforms can be added later.Benefits
Limitation and future work
docs/dev.md
which is currently WIP in #42. I will follow up with a docs PR oncedocs/dev.md
is merged.Testing
I have tested in my own repository, but it's after all just an approximation. Thus, I have created #47 to test that this CI pipeline correctly fails when there is a test failure.