Skip to content

Commit e25de76

Browse files
vlsiclaude
andcommitted
Replace vendored matrix_builder with npm @vlsi/github-actions-random-matrix
Use the published npm package instead of vendored matrix_builder.js, converting to ESM modules (.mjs) with seeded RNG from the package. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent e4259c2 commit e25de76

6 files changed

Lines changed: 38 additions & 263 deletions

File tree

.github/workflows/main.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ jobs:
3030
- uses: actions/checkout@v6
3131
- id: set-matrix
3232
run: |
33-
node .github/workflows/matrix.js
33+
npm ci --prefix .github/workflows
34+
node .github/workflows/matrix.mjs
3435
3536
test:
3637
needs: matrix_prep
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
// The script generates a random subset of valid jdk, os, timezone, and other axes.
2-
// You can preview the results by running "node matrix.js"
2+
// You can preview the results by running "node matrix.mjs"
33
// See https://github.com/vlsi/github-actions-random-matrix
4-
let fs = require('fs');
5-
let os = require('os');
6-
let {MatrixBuilder} = require('./matrix_builder');
7-
const matrix = new MatrixBuilder();
4+
import { appendFileSync } from 'fs';
5+
import { EOL } from 'os';
6+
import { createGitHubMatrixBuilder } from '@vlsi/github-actions-random-matrix/github';
7+
const { matrix, random } = createGitHubMatrixBuilder();
88
matrix.addAxis({
99
name: 'java_distribution',
1010
values: [
@@ -130,7 +130,7 @@ include.forEach(v => {
130130
v.oracle_java_website = v.java_version === eaJava ? 'jdk.java.net' : 'oracle.com';
131131
}
132132
v.non_ea_java_version = v.java_version === eaJava ? '' : v.java_version;
133-
if (v.java_distribution !== 'semeru' && Math.random() > 0.5) {
133+
if (v.java_distribution !== 'semeru' && random() > 0.5) {
134134
// The following options randomize instruction selection in JIT compiler
135135
// so it might reveal missing synchronization
136136
v.name += ', stress JIT';
@@ -164,7 +164,7 @@ console.log(include);
164164

165165
let filePath = process.env['GITHUB_OUTPUT'] || '';
166166
if (filePath) {
167-
fs.appendFileSync(filePath, `matrix<<MATRIX_BODY${os.EOL}${JSON.stringify({include})}${os.EOL}MATRIX_BODY${os.EOL}`, {
167+
appendFileSync(filePath, `matrix<<MATRIX_BODY${EOL}${JSON.stringify({include})}${EOL}MATRIX_BODY${EOL}`, {
168168
encoding: 'utf8'
169169
});
170170
}

.github/workflows/matrix_builder.js

Lines changed: 0 additions & 255 deletions
This file was deleted.

.github/workflows/package-lock.json

Lines changed: 21 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.github/workflows/package.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"private": true,
3+
"type": "module",
4+
"dependencies": {
5+
"@vlsi/github-actions-random-matrix": "2.0.0"
6+
}
7+
}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ jmeter-fb.*
8484
*.iml
8585

8686
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
87+
node_modules
8788
hs_err_pid*
8889
# other jvm related files
8990
.attach_*

0 commit comments

Comments
 (0)