Files
orca/config/scripts/node-server-fast-runners.test.mjs
T
Neil be0961e911 Overlap adhoc release gates and cache qualified server templates (#31300)
* perf(ci): accelerate adhoc release builds and runner scheduling

* Overlap adhoc release preparation and reuse qualified build inputs

* Bind qualified template reuse to its embedded CLI source commit

* Use the available CPUs for native compilation in fast dev builds

* Verify qualified template cache provenance and daily invalidation

* Avoid incremental MSBuild tracking for fresh fast-release builds

* Right-size Intel macOS and Windows ARM release qualification

* Route Intel qualification through the standard larger macOS label

* Overlap Windows preparation and initialize the server native compiler once

* Test server compiler invocation through its process-runner interface

* Align adhoc signing contract with its larger packaging runner

* Recognize the native cache fingerprint as batch-file metadata
2026-10-20 18:45:13 -07:00

79 lines
3.3 KiB
JavaScript

import { readFileSync } from 'node:fs'
import { runInNewContext } from 'node:vm'
import { expect, it } from 'vitest'
import { parse } from 'yaml'
const workflow = parse(readFileSync('.github/workflows/node-server-tests.yml', 'utf8'))
function runnerFor(job, os, fast) {
return runInNewContext(job['runs-on'].slice(3, -2), {
inputs: { fast_runners: fast },
matrix: { os },
fromJSON: JSON.parse
})
}
it('keeps faster runners opt-in for both reusable and manual qualification', () => {
for (const trigger of ['workflow_call', 'workflow_dispatch']) {
expect(workflow.on[trigger].inputs.fast_runners).toMatchObject({
type: 'boolean',
default: false
})
}
})
it.each([
['ubuntu-22.04', 'blacksmith-8vcpu-ubuntu-2204'],
['ubuntu-24.04-arm', 'blacksmith-8vcpu-ubuntu-2404-arm'],
['macos-15', 'blacksmith-6vcpu-macos-15'],
['macos-15-intel', 'macos-15-large'],
['windows-2022', 'blacksmith-8vcpu-windows-2025'],
['windows-11-arm', 'orca-windows-11-arm64-8core']
])('preserves the qualification architecture for %s', (os, fastRunner) => {
expect(runnerFor(workflow.jobs.persistence, os, false)).toBe(os)
expect(runnerFor(workflow.jobs.persistence, os, true)).toBe(fastRunner)
expect(runnerFor(workflow.jobs.persistence, os, undefined)).toBe(os)
})
it('retains both Linux architectures and the pinned libc qualification containers', () => {
for (const name of ['linux_glibc_floor', 'linux_musl']) {
const job = workflow.jobs[name]
expect(job.strategy.matrix.os).toEqual(['ubuntu-22.04', 'ubuntu-24.04-arm'])
for (const os of job.strategy.matrix.os) {
expect(runnerFor(job, os, false)).toBe(os)
expect(runnerFor(job, os, true)).toBe(
`blacksmith-8vcpu-ubuntu-${os === 'ubuntu-22.04' ? '2204' : '2404-arm'}`
)
}
}
const floor = workflow.jobs.linux_glibc_floor
expect(floor.container).toBe('${{ matrix.image }}')
for (const { image } of floor.strategy.matrix.include) {
expect(image).toMatch(/^quay\.io\/pypa\/manylinux_2_28_.*@sha256:/)
}
expect(workflow.jobs.linux_glibc217_compat.steps.map((step) => step.run).join('\n')).toContain(
'quay.io/pypa/manylinux2014_x86_64@sha256:'
)
})
it.each([
['changes', 'ubuntu-latest', 'blacksmith-2vcpu-ubuntu-2404'],
['mobile_web_bundle', 'ubuntu-latest', 'blacksmith-8vcpu-ubuntu-2404'],
['desktop_template', 'ubuntu-latest', 'blacksmith-4vcpu-ubuntu-2404'],
['linux_glibc217_compat', 'ubuntu-22.04', 'blacksmith-8vcpu-ubuntu-2204']
])('sizes %s for its work without changing default callers', (name, hostedRunner, fastRunner) => {
expect(runnerFor(workflow.jobs[name], undefined, false)).toBe(hostedRunner)
expect(runnerFor(workflow.jobs[name], undefined, true)).toBe(fastRunner)
})
it('still builds and uploads cross-compiled Windows template addons on the x64 lane', () => {
const steps = workflow.jobs.persistence.steps
for (const fragment of ['process-table addons', 'CLI launchers', 'security addons']) {
const upload = steps.find((step) => step.name?.includes(`Keep the Windows ${fragment}`))
expect(upload.if).toContain("matrix.os == 'windows-2022'")
}
const launcher = steps.find((step) => step.uses?.includes('prepare-windows-cli-launcher'))
expect(launcher.with.arches).toContain("matrix.os == 'windows-2022'")
expect(launcher.with.arches).toContain("'x64 arm64'")
})