Skip to content

Derive the C++ CI build matrix from its config generator - #659

Merged
nikobockerman merged 1 commit into
mainfrom
ci-cpp-matrix-from-generator
Aug 12, 2026
Merged

Derive the C++ CI build matrix from its config generator#659
nikobockerman merged 1 commit into
mainfrom
ci-cpp-matrix-from-generator

Conversation

@nikobockerman

Copy link
Copy Markdown
Owner

The set of build scenarios (os x compiler x cxxLib x buildType) was written out twice: as a strategy.matrix in cpp-build-test-run.yaml, and again as the valid set in generate-cpp-ci-config.py, with the argparse choices restating the axes a third time. Nothing enforced agreement. The script is only ever invoked from a matrix job, it has no tests, and neither ruff nor pyright can see across the YAML/Python boundary, so adding a row without editing the Python failed with "Unsupported C++ CI matrix entry" at job runtime, after checkout, Homebrew restore, mise setup and Conan cache restore had already spent minutes.

The generator now owns the table and emits it as JSON through a new matrix subcommand. A small resolver job feeds that to the build job through GitHub's dynamic-matrix mechanism, so the workflow no longer declares combinations at all. Every job becomes an explicit row, which also retires the augment-vs-add subtlety of the bare - os: ubuntu include that expanded the six base combinations rather than adding a tenth job.

Generation itself is unchanged: CMakeUserPresets.json, ci.env and conan-profile-ci come out byte-identical for all nine entries. The new --output-dir exists so the generator can be exercised without overwriting a developer's own solvers/cpp/CMakeUserPresets.json, which is the include entry point for their per-host presets.

The set of build scenarios (os x compiler x cxxLib x buildType) was
written out twice: as a `strategy.matrix` in cpp-build-test-run.yaml,
and again as the `valid` set in generate-cpp-ci-config.py, with the
argparse choices restating the axes a third time. Nothing enforced
agreement. The script is only ever invoked from a matrix job, it has no
tests, and neither ruff nor pyright can see across the YAML/Python
boundary, so adding a row without editing the Python failed with
"Unsupported C++ CI matrix entry" at job runtime, after checkout,
Homebrew restore, mise setup and Conan cache restore had already spent
minutes.

The generator now owns the table and emits it as JSON through a new
`matrix` subcommand. A small resolver job feeds that to the build job
through GitHub's dynamic-matrix mechanism, so the workflow no longer
declares combinations at all. Every job becomes an explicit row, which
also retires the augment-vs-add subtlety of the bare `- os: ubuntu`
include that expanded the six base combinations rather than adding a
tenth job.

Generation itself is unchanged: CMakeUserPresets.json, ci.env and
conan-profile-ci come out byte-identical for all nine entries. The new
--output-dir exists so the generator can be exercised without
overwriting a developer's own solvers/cpp/CMakeUserPresets.json, which
is the include entry point for their per-host presets.
Copilot AI lite review requested due to automatic review settings August 12, 2026 17:47

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR removes the duplicated C++ CI build-matrix definition by making .github/scripts/generate-cpp-ci-config.py the single source of truth for the supported build scenarios, and wiring the workflow to consume that matrix dynamically at runtime.

Changes:

  • Added a resolver job that runs the generator’s new matrix subcommand and publishes a JSON dynamic matrix via job outputs.
  • Updated the build job to use strategy.matrix: ${{ fromJSON(needs.matrix.outputs.matrix) }} and to invoke the generator via the new config subcommand.
  • Refactored the generator script to own the scenario table (_MATRIX), emit GitHub-matrix JSON, and support --output-dir for non-destructive local runs.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
.github/workflows/cpp-build-test-run.yaml Replaces the static workflow matrix with a resolver-job-produced dynamic matrix and updates generator invocation to use subcommands.
.github/scripts/generate-cpp-ci-config.py Centralizes matrix entries, adds matrix/config subcommands, and supports emitting JSON for GitHub’s dynamic matrix.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@nikobockerman
nikobockerman merged commit 31f761b into main Aug 12, 2026
54 checks passed
@nikobockerman
nikobockerman deleted the ci-cpp-matrix-from-generator branch August 12, 2026 18:11
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.

2 participants