Skip to content

The micro-VM for AI agents — light enough to embed on your laptop, elastic enough to power an agentic cloud.

ci(test): reserve merge queue macOS jobs for release PRs (#3271)

kekxy795f6f879a6f
diff --git a/.github/actions/is-release-pr/action.yml b/.github/actions/is-release-pr/action.yml
new file mode 100644
index 000000000..3266c2745
--- /dev/null
+++ b/.github/actions/is-release-pr/action.yml
@@ -0,0 +1,26 @@
+name: Identify the release pull request
+description: Match the title of the PR that owns this event or merge queue entry.
+outputs:
+ is-release:
+ description: Whether the PR has the release version title prefix.
+ value: ${{ steps.classify.outputs.result }}
+runs:
+ using: composite
+ steps:
+ - id: classify
+ uses: actions/github-script@v8
+ with:
+ result-encoding: string
+ script: |
+ let title
+ if (context.eventName === 'pull_request') {
+ title = context.payload.pull_request.title
+ } else if (context.eventName === 'merge_group') {
+ const ref = context.payload.merge_group.head_ref
+ const match = /^refs\/heads\/gh-readonly-queue\/.+\/pr-([1-9]\d*)-[0-9a-f]{40}$/.exec(ref)
+ if (!match) throw new Error('Cannot identify the pull request from the merge queue ref')
+ const { data } = await github.rest.pulls.get({ ...context.repo, pull_number: Number(match[1]) })
+ title = data.title
+ }
+ if (typeof title !== 'string' || !title.length) throw new Error('Missing pull request title')
+ return title.toLowerCase().startsWith('chore(release): bump version to ')
diff --git a/.github/workflows/README.md b/.github/workflows/README.md
index 3153b5733..f278124d0 100644
--- a/.github/workflows/README.md
+++ b/.github/workflows/README.md
@@ -102,7 +102,7 @@ CONFIG ci-config action ◀── lint, test, c
| `config.yml` | `workflow_call` | call-only | Loads `.github/ci-config.json` before build matrices expand |
| `lint.yml` | push, PR, merge_group | — | Format and lint per language, plus the installer smoke test. `Lint (conclusion)` is the required check |
| `test.yml` | push, PR, merge_group, weekly, dispatch | — | Lightweight draft checks; SDK tests and combined Rust/CLI coverage on ready PRs. Compact routine matrices and full weekly/manual matrices. Codecov requires 90% patch coverage |
-| `release-dependency-audit.yml` | PR, merge_group | — | Audits production application dependencies on release version PRs selected by title; other PRs and merge groups skip the job |
+| `release-dependency-audit.yml` | PR, merge_group | — | Audits production application dependencies on release version PRs selected by title. Merge groups skip the job |
| `codeql.yml` | push, PR, dispatch, weekly | — | CodeQL advanced setup, so fork PRs are scanned |
| `api-client-drift.yml` | PR | — | Regenerates the product API clients and checks their committed output. For hosted Apps it installs `rustfmt` to compare the generated Rust CLI bindings, then tests the public methods, paths, permissions and response schemas against the mounted API. |
| `author-review.yml` | PR (target), issue_comment, merge_group | — | Converts unacknowledged PRs to draft, posts author instructions, and publishes `Author reviewed the PR` on the current head. Merge queues carry forward the required PR admission check |
@@ -199,14 +199,24 @@ merge groups, weekly runs and manual dispatches retain SDK testing.
Deferred coverage may remain pending on a draft; it is never replaced by
an empty upload when coverage-bearing files changed.
-Python runs all four supported versions on Linux x64 and the latest on macOS and Linux ARM
+On ready PRs and main pushes, Python runs all four supported versions on Linux x64 and the latest on macOS and Linux ARM
(six jobs); Node runs all three versions on Linux x64 and the latest on the other platforms
(five jobs). Weekly and manually dispatched tests exercise every platform/version combination
-and bypass change filters. Combined Rust and CLI coverage runs on all three platforms, including
-non-VM integration tests and Linux guest tests. Linux CI also runs the volume REST lifecycle
+and bypass change filters. Combined Rust and CLI coverage includes non-VM integration tests and Linux guest tests. Linux CI also runs the volume REST lifecycle
against a real `boxlite serve` process. Codecov requires 90% coverage of changed lines
and reports total coverage.
+### macOS tests in the merge queue
+
+Test resolves the PR number from the queue entry's `gh-readonly-queue/<base>/pr-<number>-<sha>` ref
+and passes its current title to the [shared release classifier](../actions/is-release-pr/action.yml).
+An ordinary entry uses the `linux` platform selection for Rust, Python and Node and skips the Go macOS job.
+Linux x64 and ARM64 follow the usual path filters.
+
+Rust has separate Linux and macOS jobs that share the same test steps. A release entry always runs the macOS job, even when the Rust path filter skips Linux. Python, Node and Go also run on macOS when their paths select them.
+`Test (conclusion)` requires success from the selected release suites. An unreadable PR title or unexpected skip blocks the entry.
+If release PR A enters the queue before ordinary PR B, only A requests macOS, even when B's test commit includes both changes.
+
The Linux Rust jobs enable unprivileged user namespaces on their disposable runners
so SSH guest tests can create private user/mount namespaces. This temporarily disables
Ubuntu's AppArmor user-namespace restriction, as the Nix job does for its jailer.
@@ -355,8 +365,8 @@ The job runs `make audit:apps` with Node 22, using the pinned Yarn version witho
installing dependencies. It applies the same production, high/critical audit as
[mbuild publication](../../apps/infra/mbuild/README.md#dependency-audit-failures).
Findings and registry/service failures fail the check and retain their diagnostics.
-Other PRs skip the job before runner allocation; merge groups also skip because
-release PRs complete their preflight before queue admission. Publication retains its
+Every PR runs the shared classifier on a Linux runner. Only a matching PR sets up the audit tools
+and runs the audit. Merge groups skip this job before runner allocation. Publication retains its
own audit because advisory data can change after the PR check.
After the workflow lands and produces a check run, require `Release dependency audit`
diff --git a/.github/workflows/release-dependency-audit.yml b/.github/workflows/release-dependency-audit.yml
index 50c14b80a..8df2fa833 100644
--- a/.github/workflows/release-dependency-audit.yml
+++ b/.github/workflows/release-dependency-audit.yml
@@ -18,20 +18,21 @@ concurrency:
jobs:
audit:
name: Release dependency audit
- # Skip the job, not the workflow, so other PRs satisfy the required check
- # without a runner. Merge queues rely on the PR's preflight before admission.
- if: >-
- ${{ github.event_name == 'pull_request' &&
- startsWith(github.event.pull_request.title, 'chore(release): bump version to ') }}
+ if: github.event_name == 'pull_request'
runs-on: boxlite
timeout-minutes: 5
steps:
- uses: actions/checkout@v5
with:
persist-credentials: false
+ - id: release
+ uses: ./.github/actions/is-release-pr
- uses: ./.github/actions/setup-boxlite-runner
+ if: &release-pr steps.release.outputs.is-release == 'true'
- uses: actions/setup-node@v4
+ if: *release-pr
with:
node-version: '22'
- name: Audit application production dependencies
+ if: *release-pr
run: make audit:apps
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index 9696fbb1a..18fda8c3c 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -108,14 +108,15 @@ jobs:
contents: read
pull-requests: read
outputs:
- platforms: ${{ steps.config.outputs.platforms }}
+ is-release: ${{ steps.release.outputs.is-release }}
+ linux-platforms: ${{ steps.native.outputs.linux-platforms }}
linux-x64: ${{ steps.native.outputs.linux-x64-gnu }}
linux-arm64: ${{ steps.native.outputs.linux-arm64-gnu }}
darwin-arm64: ${{ steps.native.outputs.darwin-arm64 }}
rust-toolchain: ${{ steps.config.outputs.rust-toolchain }}
artifact-retention-days: ${{ steps.config.outputs.artifact-retention-days }}
- python-test-matrix: ${{ steps.config.outputs.python-test-matrix }}
- node-test-matrix: ${{ steps.config.outputs.node-test-matrix }}
+ python-test-matrix: ${{ steps.native.outputs.python-test-matrix }}
+ node-test-matrix: ${{ steps.native.outputs.node-test-matrix }}
# Keep file selection separate: deferred SDK coverage is not an empty diff.
sdk-tests-enabled: ${{ github.event_name != 'pull_request' || !github.event.pull_request.draft }}
rust: ${{ github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' || steps.filter.outputs.rust == 'true' }}
@@ -137,6 +138,9 @@ jobs:
- uses: ./.github/actions/setup-boxlite-runner
- name: Validate Makefile syntax
run: make -n help
+ - id: release
+ if: github.event_name == 'merge_group'
+ uses: ./.github/actions/is-release-pr
- uses: ./.github/actions/ci-config
id: config
with:
@@ -363,12 +367,23 @@ jobs:
# source, so a change to it has to run that suite.
- 'codecov.yml'
- - name: Read per-platform test matrices
+ - name: Select test platforms for this run
id: native
env:
PLATFORMS: ${{ steps.config.outputs.platforms }}
+ PYTHON_MATRIX: ${{ steps.config.outputs.python-test-matrix }}
+ NODE_MATRIX: ${{ steps.config.outputs.node-test-matrix }}
+ IS_RELEASE: ${{ steps.release.outputs.is-release }}
run: |
- jq -r '.[] | "\(.target)=\([.] | tojson)"' <<< "$PLATFORMS" >> "$GITHUB_OUTPUT"
+ jq -nr '
+ def linux: .target | startswith("linux-");
+ def sdk: fromjson | if env.IS_RELEASE == "false" then map(select(.platform | linux)) else . end;
+ (env.PLATFORMS | fromjson) as $platforms |
+ ($platforms[] | "\(.target)=\([.] | tojson)"),
+ "linux-platforms=\($platforms | map(select(linux)) | tojson)",
+ "python-test-matrix=\(env.PYTHON_MATRIX | sdk | tojson)",
+ "node-test-matrix=\(env.NODE_MATRIX | sdk | tojson)"
+ ' >> "$GITHUB_OUTPUT"
infra:
name: Workflow and infrastructure checks
@@ -559,12 +574,12 @@ jobs:
strategy:
fail-fast: false
matrix:
- platform: ${{ fromJSON(needs.changes.outputs.platforms) }}
+ platform: ${{ fromJSON(needs.changes.outputs.linux-platforms) }}
permissions: &coverage-permissions
contents: read
id-token: write
- steps:
+ steps: &rust-test-steps
- name: Checkout code
uses: actions/checkout@v5
@@ -694,6 +709,19 @@ jobs:
disable_search: true
fail_ci_if_error: true
+ rust-macos:
+ name: Rust Tests (darwin-arm64)
+ needs: changes
+ if: >-
+ ${{ needs.changes.outputs.is-release == 'true' ||
+ (github.event_name != 'merge_group' && needs.changes.outputs.sdk-tests-enabled == 'true' && needs.changes.outputs.rust == 'true') }}
+ runs-on: ${{ matrix.platform.os }}
+ strategy:
+ matrix:
+ platform: ${{ fromJSON(needs.changes.outputs.darwin-arm64) }}
+ permissions: *coverage-permissions
+ steps: *rust-test-steps
+
rust-copy-vm:
name: Rust VM file-copy coverage (Linux x64)
needs: [changes, build-test-runtime]
@@ -1022,7 +1050,9 @@ jobs:
go-darwin-arm64:
name: Go Tests (darwin-arm64)
needs: [changes, build-test-guest-arm64]
- if: *go-selected
+ if: >-
+ ${{ needs.changes.outputs.sdk-tests-enabled == 'true' && needs.changes.outputs.go == 'true' &&
+ (github.event_name != 'merge_group' || needs.changes.outputs.is-release == 'true') }}
runs-on: ${{ matrix.platform.os }}
strategy:
matrix:
@@ -1315,7 +1345,7 @@ jobs:
needs: changes
if: >-
${{ (github.event_name == 'pull_request' || github.event_name == 'merge_group') &&
- needs.changes.result == 'success' &&
+ needs.changes.result == 'success' && needs.changes.outputs['is-release'] != 'true' &&
needs.changes.outputs.rust == 'false' &&
needs.changes.outputs.python == 'false' &&
needs.changes.outputs.node == 'false' &&
@@ -1339,9 +1369,7 @@ jobs:
fail_ci_if_error: true
# Single required status check for branch protection / merge queue.
- # Passes only if every job above succeeded or was skipped (path- or event-filtered).
- # `if: !cancelled()` is required: without it a failed dependency would skip
- # this job, and GitHub treats a skipped required check as success.
+ # Report queue cancellations and require successful macOS tests for release entries.
# NOTE: keep `needs` in sync with the jobs above when adding/removing jobs.
test-conclusion:
name: Test (conclusion)
@@ -1352,6 +1380,7 @@ jobs:
- build-test-guest-arm64
- build-test-runtime
- rust
+ - rust-macos
- rust-copy-vm
- serve-rest-e2e
- python
@@ -1366,7 +1395,7 @@ jobs:
- plugins
- guest_artifacts
- coverage-empty
- if: ${{ !cancelled() }}
+ if: ${{ !cancelled() || github.event_name == 'merge_group' }}
runs-on: boxlite
permissions: {}
steps:
@@ -1374,3 +1403,20 @@ jobs:
run: |
jq -C <<< '${{ toJSON(needs) }}'
jq --exit-status 'all(.result == "success" or .result == "skipped")' <<< '${{ toJSON(needs) }}'
+
+ - name: Require macOS results for the queued release PR
+ if: github.event_name == 'merge_group'
+ env:
+ TEST_JOBS: ${{ toJSON(needs) }}
+ run: |
+ jq --exit-status '
+ def has_macos: fromjson | any(.[]; (.platform // .).target == "darwin-arm64");
+ .changes.outputs as $plan |
+ if $plan["is-release"] == "false" then true
+ elif $plan["is-release"] == "true" then
+ .["rust-macos"].result == "success" and
+ ($plan.python == "false" or (.python.result == "success" and ($plan["python-test-matrix"] | has_macos))) and
+ ($plan.node == "false" or (.node.result == "success" and ($plan["node-test-matrix"] | has_macos))) and
+ ($plan.go == "false" or .["go-darwin-arm64"].result == "success")
+ else error("Missing release classification for queue entry") end
+ ' <<< "$TEST_JOBS"
diff --git a/apps/infra/deployment/draft-ci.test.ts b/apps/infra/deployment/draft-ci.test.ts
index 2ca935d3b..6597321a3 100644
--- a/apps/infra/deployment/draft-ci.test.ts
+++ b/apps/infra/deployment/draft-ci.test.ts
@@ -167,3 +167,57 @@ test('the required conclusion propagates infrastructure regression failures', ()
assert.equal(run.status === 0, result === 'success' || result === 'skipped', run.stderr)
}
})
+
+test('release Rust runs on macOS even without a Rust path change', () => {
+ const jobs = workflow().jobs
+ const ctx = context('merge_group', false, false)
+ const outputs = ctx.needs.changes.outputs
+ outputs['is-release'] = 'true'
+ assert.equal(evaluate(jobs['rust-macos'].if, ctx), true)
+ assert.equal(evaluate(jobs.rust.if, ctx), false)
+ assert.equal(evaluate(jobs['rust-copy-vm'].if, ctx), false)
+ outputs.rust = 'true'
+ assert.equal(evaluate(jobs.rust.if, ctx), true)
+ outputs.go = 'true'
+ assert.equal(evaluate(jobs['go-darwin-arm64'].if, ctx), true)
+ outputs['is-release'] = 'false'
+ assert.equal(evaluate(jobs['rust-macos'].if, ctx), false)
+ assert.equal(evaluate(jobs['go-darwin-arm64'].if, ctx), false)
+ assert.equal(evaluate(jobs['go-linux-arm64'].if, ctx), true)
+})
+
+test('queue conclusion requires successful macOS jobs for the selected release suites', () => {
+ const job = workflow().jobs['test-conclusion']
+ const ctx = context('merge_group')
+ assert.equal(evaluate(job.if, { ...ctx, cancelled: () => true }), true)
+ const gate = job.steps.find((s: any) => s.env?.TEST_JOBS)
+ assert.equal(evaluate(gate.if, ctx), true)
+ assert.equal(gate.env.TEST_JOBS, '${{ toJSON(needs) }}')
+ const results = Object.fromEntries(job.needs.map((id: string) => [id, { result: 'success' }]))
+ const mac = JSON.stringify([{ target: 'darwin-arm64' }])
+ const sdk = JSON.stringify([{ platform: { target: 'darwin-arm64' } }])
+ const plan: Record<string, string> = { ...ctx.needs.changes.outputs, 'is-release': 'true', 'darwin-arm64': mac,
+ 'python-test-matrix': sdk, 'node-test-matrix': sdk }
+ results.changes.outputs = plan
+ const passes = () => spawnSync('bash', ['-ec', gate.run], {
+ env: { ...process.env, TEST_JOBS: JSON.stringify(results) },
+ }).status === 0
+ assert.equal(passes(), true)
+ for (const id of ['rust-macos', 'python', 'node', 'go-darwin-arm64']) {
+ for (const result of ['skipped', 'cancelled', 'failure']) {
+ results[id].result = result
+ assert.equal(passes(), false, id + ' ' + result)
+ }
+ results[id].result = 'success'
+ }
+ plan['node-test-matrix'] = '[]'
+ assert.equal(passes(), false, 'Linux-only SDK success cannot qualify a release')
+ plan.node = 'false'
+ results.node.result = 'skipped'
+ assert.equal(passes(), true, 'unselected SDK may skip')
+ plan['is-release'] = ''
+ assert.equal(passes(), false, 'unknown queue classification cannot pass')
+ plan['is-release'] = 'false'
+ results['rust-macos'].result = 'skipped'
+ assert.equal(passes(), true)
+})
diff --git a/apps/infra/deployment/release-audit-workflow.test.ts b/apps/infra/deployment/release-audit-workflow.test.ts
index 85ce6f0ea..f7864a3dd 100644
--- a/apps/infra/deployment/release-audit-workflow.test.ts
+++ b/apps/infra/deployment/release-audit-workflow.test.ts
@@ -21,10 +21,16 @@ const auditJob = () => {
}
const releaseTitle = 'chore(release): bump version to 0.11.2'
-function selected(title: string, event = 'pull_request', draft = false): boolean {
- return runInNewContext(auditJob().if.replace(/^\$\{\{\s*|\s*\}\}$/g, ''), {
- github: { event_name: event, event: event === 'pull_request' ? { pull_request: { title, draft } } : {} },
- startsWith: (value: string, prefix: string) => value.toLowerCase().startsWith(prefix.toLowerCase()),
+const sharedAction = './.github/actions/is-release-pr'
+const classifier = load(readFileSync(join(root, sharedAction, 'action.yml'), 'utf8')) as any
+
+async function classify(eventName: string, payload: object, lookup?: (request: any) => unknown) {
+ const step = classifier.runs.steps[0]
+ assert.equal(classifier.outputs['is-release'].value, `\${{ steps.${step.id}.outputs.result }}`)
+ assert.equal(step.with['result-encoding'], 'string')
+ return runInNewContext(`(async () => { ${step.with.script} })()`, {
+ context: { eventName, payload, repo: { owner: 'example', repo: 'boxlite' } },
+ github: { rest: { pulls: { get: lookup } } },
}, { timeout: 1000 })
}
@@ -41,15 +47,45 @@ test('release audit covers PR updates and title edits without changing Test trig
assert.ok(!tests.on.pull_request.types.includes('edited'), 'metadata edits must not rerun the test matrices')
})
-test('release audit selection follows title changes and includes drafts', () => {
- assert.equal(selected('feat(api): add an endpoint'), false)
- assert.equal(selected(releaseTitle), true, 'renaming an ordinary PR to a release enables the audit')
- assert.equal(selected('chore: update release notes'), false, 'renaming away from release disables the audit')
- assert.equal(selected(releaseTitle, 'pull_request', true), true)
- assert.equal(selected('Chore(Release): bump version to 0.11.2'), true)
- assert.equal(selected('fix: ' + releaseTitle), false)
- assert.equal(selected('chore(release): bump version to'), false)
- assert.equal(selected(releaseTitle, 'merge_group'), false, 'merge queues allocate no audit runner')
+test('both workflows use the same classifier and the audit runs only for a matching PR', async () => {
+ const job = auditJob()
+ assert.equal(job.if, "github.event_name == 'pull_request'")
+ const release = job.steps.find((s: any) => s.uses === sharedAction)
+ assert.ok(release)
+ const after = job.steps.slice(job.steps.indexOf(release) + 1)
+ assert.ok(after.length)
+ for (const step of after) assert.equal(step.if, `steps.${release.id}.outputs.is-release == 'true'`)
+ const testWorkflow = load(readFileSync(join(root, '.github/workflows/test.yml'), 'utf8')) as any
+ const queue = testWorkflow.jobs.changes.steps.find((s: any) => s.uses === sharedAction)
+ assert.equal(queue.if, "github.event_name == 'merge_group'")
+ assert.equal(testWorkflow.jobs.changes.outputs['is-release'], `\${{ steps.${queue.id}.outputs.is-release }}`)
+
+ for (const [title, expected] of [
+ [releaseTitle, true], [releaseTitle.toUpperCase(), true], ['fix: ' + releaseTitle, false],
+ ['chore(release): bump version to', false], ['chore: update release notes', false],
+ ]) {
+ assert.equal(await classify('pull_request', { pull_request: { title, draft: true } }), expected)
+ }
+})
+
+test('a queue entry classifies only its own PR and fails on unavailable metadata', async () => {
+ const entry = (number: number) => ({ merge_group: {
+ head_ref: `refs/heads/gh-readonly-queue/main/pr-${number}-${'a'.repeat(40)}`,
+ head_commit: { message: releaseTitle },
+ } })
+ const calls: number[] = []
+ const lookup = (request: any) => {
+ assert.equal(request.owner, 'example')
+ assert.equal(request.repo, 'boxlite')
+ calls.push(request.pull_number)
+ return { data: { title: request.pull_number === 42 ? releaseTitle : 'fix: docs' } }
+ }
+ assert.equal(await classify('merge_group', entry(42), lookup), true)
+ assert.equal(await classify('merge_group', entry(43), lookup), false)
+ await assert.rejects(classify('merge_group', { merge_group: { head_ref: 'refs/heads/main' } }, lookup), /queue ref/)
+ assert.deepEqual(calls, [42, 43])
+ await assert.rejects(classify('merge_group', entry(42), () => { throw Error('HTTP 403') }), /403/)
+ await assert.rejects(classify('merge_group', entry(42), () => ({ data: {} })), /title/)
})
test('release audit uses a bounded job with read-only checkout and skips app dependency installation', () => {
diff --git a/apps/infra/deployment/test-build-artifacts.test.ts b/apps/infra/deployment/test-build-artifacts.test.ts
index 389167144..c0745e88d 100644
--- a/apps/infra/deployment/test-build-artifacts.test.ts
+++ b/apps/infra/deployment/test-build-artifacts.test.ts
@@ -22,7 +22,7 @@ test('Go tests wait for matching native inputs and the Rust matrix starts after
const work = mkdtempSync(join(tmpdir(), 'native-matrix-'))
t.after(() => rmSync(work, { recursive: true, force: true }))
const file = join(work, 'output')
- execFileSync('bash', ['-e', '-c', select], { env: { ...process.env, GITHUB_OUTPUT: file, PLATFORMS: JSON.stringify(platforms) } })
+ execFileSync('bash', ['-e', '-c', select], { env: { ...process.env, GITHUB_OUTPUT: file, PLATFORMS: JSON.stringify(platforms), PYTHON_MATRIX: '[]', NODE_MATRIX: '[]' } })
const outputs = Object.fromEntries(readFileSync(file, 'utf8').trim().split('\n').map(line => line.split('=')))
function evaluate(expression: string, context: object) {
const ast = new Parser(new Lexer(expression.slice(3, -2)).lex().tokens, Object.keys(context), []).parse()
@@ -59,10 +59,12 @@ test('Go tests wait for matching native inputs and the Rust matrix starts after
assert.deepEqual(targets.sort(), platforms.map((p: any) => p.target).sort())
const rust = jobs.rust
assert.equal(rust.needs, 'changes')
- const config = { outputs: { platforms: JSON.stringify(platforms) } }
- const configured = evaluate(jobs.changes.outputs.platforms, { steps: { config } }).coerceString()
- const matrix = evaluate(rust.strategy.matrix.platform, { needs: { changes: { outputs: { platforms: configured } } } }) as data.Array
- assert.deepEqual(matrix.values().map(p => (p as data.Dictionary).get('target')?.coerceString()).sort(), targets.sort())
+ const matrix = evaluate(rust.strategy.matrix.platform, { needs: { changes: { outputs: native } } }) as data.Array
+ const linuxTargets = matrix.values().map(p => (p as data.Dictionary).get('target')?.coerceString()).sort()
+ assert.deepEqual(linuxTargets, ['linux-arm64-gnu', 'linux-x64-gnu'])
+ assert.equal(platform('rust-macos'), 'darwin-arm64')
+ assert.deepEqual(jobs['rust-macos'].steps, rust.steps)
+ assert.ok(jobs['test-conclusion'].needs.includes('rust-macos'))
assert.equal(rust.strategy['fail-fast'], false)
assert.ok(jobs['test-conclusion'].needs.includes('rust'))
})
diff --git a/apps/infra/deployment/workflow-checks.test.ts b/apps/infra/deployment/workflow-checks.test.ts
index 2c8458e13..5b4079836 100644
--- a/apps/infra/deployment/workflow-checks.test.ts
+++ b/apps/infra/deployment/workflow-checks.test.ts
@@ -660,6 +660,35 @@ function workflowConfig(fullMatrix: string) {
}
}
+test('only ordinary queue entries remove macOS rows from the SDK matrices', t => {
+ const changes = coverageWorkflow.jobs.changes
+ const selection = changes.steps.find((step: any) => step.id === 'native')
+ assert.equal(selection.env.IS_RELEASE, '${{ steps.release.outputs.is-release }}')
+ const dir = mkdtempSync(join(tmpdir(), 'test-platforms-'))
+ t.after(() => rmSync(dir, { recursive: true, force: true }))
+ for (const [name, release, full] of [
+ ['routine queue', 'false', 'false'], ['release queue', 'true', 'false'],
+ ['PR or push', '', 'false'], ['weekly or manual', '', 'true'],
+ ]) {
+ const { values, result } = workflowConfig(full)
+ assert.equal(result.status, 0, result.stderr)
+ const output = join(dir, name)
+ const run = spawnSync('bash', ['-ec', selection.run], { encoding: 'utf8', env: { ...process.env,
+ GITHUB_OUTPUT: output, IS_RELEASE: release, PLATFORMS: values.get('platforms'),
+ PYTHON_MATRIX: values.get('python-test-matrix'), NODE_MATRIX: values.get('node-test-matrix'),
+ } })
+ assert.equal(run.status, 0, run.stderr)
+ const matrices = Object.fromEntries(readFileSync(output, 'utf8').trim().split('\n').map(row => row.split('=')))
+ for (const sdk of ['python', 'node']) {
+ const key = sdk + '-test-matrix'
+ assert.equal(changes.outputs[key], `\${{ steps.native.outputs.${key} }}`)
+ const configured = JSON.parse(values.get(key)!)
+ const expected = release === 'false' ? configured.filter((r: any) => r.platform.target !== 'darwin-arm64') : configured
+ assert.deepEqual(JSON.parse(matrices[key]), expected, name + ' ' + sdk)
+ }
+ }
+})
+
for (const [sdk, compactCount, fullCount] of [['python', 6, 12], ['node', 5, 9]] as const) {
test(`${sdk} PR matrix covers every version and platform without the full cross product`, () => {
const { result, values } = workflowConfig('false')