Derive the C++ CI build matrix from its config generator - #659
Merged
Conversation
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.
Contributor
There was a problem hiding this comment.
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
matrixsubcommand 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 newconfigsubcommand. - Refactored the generator script to own the scenario table (
_MATRIX), emit GitHub-matrix JSON, and support--output-dirfor 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The set of build scenarios (os x compiler x cxxLib x buildType) was written out twice: as a
strategy.matrixin cpp-build-test-run.yaml, and again as thevalidset 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
matrixsubcommand. 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: ubuntuinclude 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.