Skip to content

ci: generate the test matrix with @vlsi/github-actions-random-matrix#2177

Closed
vlsi wants to merge 1 commit into
robstoll:mainfrom
vlsi:claude/distracted-shockley-715f13
Closed

ci: generate the test matrix with @vlsi/github-actions-random-matrix#2177
vlsi wants to merge 1 commit into
robstoll:mainfrom
vlsi:claude/distracted-shockley-715f13

Conversation

@vlsi

@vlsi vlsi commented Jun 25, 2026

Copy link
Copy Markdown
Collaborator

Why

The CI test matrix was built from a vendored copy of matrix_builder.js plus the tegonal-commons matrix_commons.js helper. The random-matrix logic had to be kept in sync by hand, and the matrix was assembled with several generateRow() 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 a generateRows(maxRows, {require}) API that builds the whole matrix in one call.

What

  • Add .github/workflows/package.json and package-lock.json pinning @vlsi/github-actions-random-matrix@2.1.0.
  • Add .github/workflows/matrix.mjs: a self-contained ESM script that defines the java_distribution, java_version, and os axes, the existing exclusions (graalvm + Java 11/17, dragonwell + macOS), and builds the matrix in a single generateRows(Number(process.env.MATRIX_JOBS || 4), {require: [...]}) call. The require list keeps the previous guarantees: a row each for the oldest and newest Java version and for one Linux and one Windows job. The remaining MATRIX_JOBS budget goes to pairwise coverage, so the job count is now exactly MATRIX_JOBS regardless of the requirement order. It uses a seeded RNG (createGitHubMatrixBuilder), so a build can be reproduced from the seed printed in the step summary.
  • Update quality-assurance.yml to run npm ci --prefix .github/workflows and node .github/workflows/matrix.mjs (the runner's preinstalled Node is enough; no setup-node step needed).
  • Remove matrix.js, matrix_builder.js (replaced by the package), and matrix_commons.js (no longer used).
  • Drop the matrix_commons.js entry from .gt/remotes/tegonal-gh-commons/pulled.tsv. It was the only file vendored from that remote; without this, a future gt update would restore a file that references the removed matrix_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

npm ci --prefix .github/workflows
node .github/workflows/matrix.mjs            # default: 4 jobs
MATRIX_JOBS=6 node .github/workflows/matrix.mjs   # 6 jobs

Each generated row carries java_version, java_distribution, and os, matching what the build-and-test job 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.

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>
@vlsi
vlsi requested a review from robstoll as a code owner June 25, 2026 05:38
@codecov

codecov Bot commented Jun 25, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.28%. Comparing base (827ce4e) to head (91a105f).

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           
Flag Coverage Δ
current 90.90% <ø> (ø)
current_windows 90.00% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

id: set-matrix
run: node .github/workflows/matrix.js
run: |
npm ci --prefix .github/workflows

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

@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?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

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?

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

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)

@robstoll robstoll closed this Jul 20, 2026
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