Skip to content

Dockerize CI to pin compiler dependencies and fix coverage pipeline#61

Open
MitchellThompkins wants to merge 1 commit into
kthohr:masterfrom
MitchellThompkins:dockerize-test-env
Open

Dockerize CI to pin compiler dependencies and fix coverage pipeline#61
MitchellThompkins wants to merge 1 commit into
kthohr:masterfrom
MitchellThompkins:dockerize-test-env

Conversation

@MitchellThompkins
Copy link
Copy Markdown

@MitchellThompkins MitchellThompkins commented Apr 13, 2026

Summary

This PR Dockerizes all test dependencies in an effort to make the pipeline more robust and run at regular intervals (if only because I have a pathological need to see green pipelines). It maintains support for older compiler versions and fixes the code coverage pipelines. It also adds more macos clang support for fun. As part of this dockerization it publishes its own test container to pin down dependencies; though this does require a manual step in order to maintain said container.

The original cov_check script called gcov directly on each .cpp file to locate and process its associated .gcda data, which is the low-level way to generate coverage data. lcov with --gcov-tool gcov-12 and --capture does the equivalent by automatically scanning for .gcda and acts as a wrapper around gcov. It does the same thing but produces a standardized output format (coverage.info) that Codecov.io expects. I switched because the current pipeline was failing and the Codecov uploader needed a standard format file anyway. lcov solved both problems at once.

With #58 @marcizhu implemented some similar non-Docker based solutions and does a good job (I stole their lcov idea but still invoke gcov under the hood just to maintain consistency), but I'm partial to my solution here because it preserves testing support for older compilers and c++ versions and makes the CI environment more controlled and less dependent on upstream changes.

As supporting work I added some silly script to use the same CI environment locally and some supporting documentation for all of the above in CONTRIBUTING.md.

Notably I didn't update the minimum CMake version b/c that seems like an orthogonal change to me. I prefer the solution by @BartolomeyKant in #54 to #58 because I think the floor for a Cmake minimum for a header-only library is actually very low and I like keeping compatibility boundaries wide (mostly b/c I work on outdated embedded system platforms); but that's just my opinion.

Project Owner TODOs

@kthor If you choose to consume this PR you'll need to do the following to make this work:

  1. Create a GitHub Classic personal access token with write:packages scope to authenticate the push to ghcr.io.
  2. Set the ghcr.io package to public. GitHub -> Profile -> Packages -> gcem/ci -> Package settings -> Change visibility -> Public, so CI runners can pull without authentication.
  3. Set up (or re-setup) Codecov. Connect the repo at codecov.io, get a CODECOV_TOKEN, and add it as a GitHub Actions secret (Settings -> Secrets -> Actions).
  4. Update publish-ci-image.sh. The docker login line hardcodes MitchellThompkins as the username. You would need to change it to your own GitHub username.
  5. Rebuild and publish the CI image under your own account by running publish-ci-image.sh. The image is currently at ghcr.io/mitchellthompkins/gcem/ci and should move to ghcr.io/kthohr/gcem/ci The script also updates the reference in main.yml automatically.

Changes

  • Dockerizes the Linux CI pipeline to permanently pin compiler dependencies. The previous workflow installed compilers at runtime via apt-get on ubuntu-latest, which was actively broken: clang-11 and clang-12 were no longer available on Ubuntu 24.04.
  • Adds a weekly scheduled CI run.
  • Fixes coverage collection, which was failing due to a manual codecov uploader script.
  • Adds supporting scripts for pushing the docker container and for using that container to test locally.
  • Massages tests/Makefile slightly to support this updated workflow.
  • Adds a CONTRIBUTING.md to capture some of how to test and update the container.

Note: These pipelines actually pass on test failures today, and will until #59 is resolved. 2ff0096 has the required changed for that.

being that they are always locked-down so they don't rot. Also adds
weekly pipelines to run and adds a workflow for running tests in the
container locally.

Modify workflow for maintaining docker image

modify coverage workflow and dockerfile to support that

publish new docker image

attempt to derive coverage from specified gcov version

manually assign CC?

missing curl

update container with curl

I think codecov v5 requires repo secrects

support c++23 while I am at it

update container to support c++23 tests

do what logs say

test more macos versions

this file does not buy us anything

this should fail CI correctly now

Revert "this should fail CI correctly now"

This reverts commit 00cbd4c.
@MitchellThompkins
Copy link
Copy Markdown
Author

Sample passing pipeline can be seen over in https://github.com/MitchellThompkins/gcem/actions/runs/24372173757.

@MitchellThompkins MitchellThompkins changed the title This dockerizes all of the test deps into a single Dockerfile, the idea Dockerize CI to pin compiler dependencies and fix coverage pipeline Apr 14, 2026
name: ${{ matrix.config.name }}
runs-on: ${{ matrix.config.os }}
runs-on: ubuntu-latest
container: ghcr.io/mitchellthompkins/gcem/ci:eb24b0547d0f
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kthohr mitchellthompkins -> kthohr

Comment thread publish-ci-image.sh
: "${GHRCIO_TOKEN:?GHRCIO_TOKEN is not set}"

REGISTRY="ghcr.io"
REPO="mitchellthompkins/gcem"
Copy link
Copy Markdown
Author

@MitchellThompkins MitchellThompkins Apr 14, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kthohr mitchellthompkins -> kthohr

Comment thread publish-ci-image.sh
docker build -t "${IMAGE}:${TAG}" .

echo "Logging in to ${REGISTRY} ..."
echo "${GHRCIO_TOKEN}" | docker login "${REGISTRY}" -u MitchellThompkins --password-stdin
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kthohr mitchellthompkins -> kthohr (or whatever your username is)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant