ci: generate the test matrix with @vlsi/github-actions-random-matrix#2177
ci: generate the test matrix with @vlsi/github-actions-random-matrix#2177vlsi wants to merge 1 commit into
Conversation
Replace the vendored matrix_builder.js and the tegonal-commons
matrix_commons.js helper with the published npm package
@vlsi/github-actions-random-matrix, and build the whole matrix in a
single generateRows(maxRows, {require}) call instead of a sequence of
generateRow() calls.
The npm package owns the random-matrix logic, so the local copy no
longer has to be kept in sync by hand. generateRows with a require list
guarantees a row for each requirement (oldest and newest Java, one
Linux and one Windows job), packs them into as few jobs as it can, and
spends the rest of the MATRIX_JOBS budget on pairwise coverage. The job
count is now exactly MATRIX_JOBS and no longer depends on the order of
the requirement list.
matrix_commons.js was vendored via the tegonal-commons gt remote and
was its only tracked file, so drop its entry from pulled.tsv to stop a
future gt update from restoring a file that references the removed
matrix_builder.js.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2177 +/- ##
=========================================
Coverage 91.28% 91.28%
Complexity 125 125
=========================================
Files 469 469
Lines 4784 4784
Branches 242 242
=========================================
Hits 4367 4367
Misses 366 366
Partials 51 51
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
| id: set-matrix | ||
| run: node .github/workflows/matrix.js | ||
| run: | | ||
| npm ci --prefix .github/workflows |
There was a problem hiding this comment.
@vlsi I am a bit confused, vlsi/github-actions-random-matrix isn't a proper gh action or did the llm just make things up?
There was a problem hiding this comment.
I haven't considered creating an action for it.
The current state is that I published matrix-builder to npmjs so I could reuse the same matrix-builder code across multiple projects.
It is a typical npm library, so the usage is that you fetch the library with npm ci as per project.json.
Frankly, I'm not sure what would be the benefits of creating an action to factor this step.
Having package.json in git enables humans and agents to test the matrix locally.
Does that clarify?
There was a problem hiding this comment.
Thanks for this bump, I'll update tegonal/github-commons first and then it will update here more or less automatically. Hence closing this PR once this is done (keep it open right now as a reminder for me)
Why
The CI test matrix was built from a vendored copy of
matrix_builder.jsplus the tegonal-commonsmatrix_commons.jshelper. The random-matrix logic had to be kept in sync by hand, and the matrix was assembled with severalgenerateRow()calls whose order determined the final job count. The upstream project now ships the same logic as the npm package@vlsi/github-actions-random-matrix, which also added agenerateRows(maxRows, {require})API that builds the whole matrix in one call.What
.github/workflows/package.jsonandpackage-lock.jsonpinning@vlsi/github-actions-random-matrix@2.1.0..github/workflows/matrix.mjs: a self-contained ESM script that defines thejava_distribution,java_version, andosaxes, the existing exclusions (graalvm+ Java 11/17,dragonwell+ macOS), and builds the matrix in a singlegenerateRows(Number(process.env.MATRIX_JOBS || 4), {require: [...]})call. Therequirelist keeps the previous guarantees: a row each for the oldest and newest Java version and for one Linux and one Windows job. The remainingMATRIX_JOBSbudget goes to pairwise coverage, so the job count is now exactlyMATRIX_JOBSregardless of the requirement order. It uses a seeded RNG (createGitHubMatrixBuilder), so a build can be reproduced from the seed printed in the step summary.quality-assurance.ymlto runnpm ci --prefix .github/workflowsandnode .github/workflows/matrix.mjs(the runner's preinstalled Node is enough; nosetup-nodestep needed).matrix.js,matrix_builder.js(replaced by the package), andmatrix_commons.js(no longer used).matrix_commons.jsentry from.gt/remotes/tegonal-gh-commons/pulled.tsv. It was the only file vendored from that remote; without this, a futuregt updatewould restore a file that references the removedmatrix_builder.js. The remote registration itself is left in place.Java 25 is still held back (it needs Gradle 9.x, which drops Java 11); the explanatory comment moved into
matrix.mjs.How to verify
Each generated row carries
java_version,java_distribution, andos, matching what thebuild-and-testjob consumes. Across 200 seeds the output had no exclusion violations and no missing requirement (oldest/newest Java, ubuntu, windows).I confirm that I have read the Contributor Agreements v1.0, agree to be bound on them and confirm that my contribution is compliant.