Avoid redundant corpus work and superseded CI runs

- Cover release and development compilation once per combined differential lane.
- Cancel superseded pull request runs to free runner capacity for the latest commit.
This commit is contained in:
Chris Tate
2026-09-29 14:07:04 -05:00
parent f5fc43d352
commit f072df8e0a
2 changed files with 18 additions and 2 deletions
+8
View File
@@ -5,6 +5,10 @@ on:
branches: [main] branches: [main]
pull_request: pull_request:
concurrency:
group: ci-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs: jobs:
tests: tests:
name: test (${{ matrix.flavor }}, ${{ matrix.shard }}/10) name: test (${{ matrix.flavor }}, ${{ matrix.shard }}/10)
@@ -117,6 +121,10 @@ jobs:
SCRIPTC_TEST_STABLE_TOOLCHAIN: "0" SCRIPTC_TEST_STABLE_TOOLCHAIN: "0"
run: pnpm test packages/compiler/src/backend/native-toolchain.test.ts run: pnpm test packages/compiler/src/backend/native-toolchain.test.ts
- name: Tests (case-sharded, slice ${{ matrix.shard }}/10) - name: Tests (case-sharded, slice ${{ matrix.shard }}/10)
env:
# differential.test.ts owns release; this companion adds dev.
# Packaged-artifact jobs still exercise both optimization modes.
SCRIPTC_LLVM_TEST_MODE: dev
run: >- run: >-
pnpm test pnpm test
tests/harness/differential.test.ts tests/harness/differential.test.ts
+10 -2
View File
@@ -28,6 +28,14 @@ const files = shardSelect(
(f) => f.slice(corpusDir.length + 1), (f) => f.slice(corpusDir.length + 1),
); );
const sanitize = process.env["SCRIPTC_SAN"] === "1"; const sanitize = process.env["SCRIPTC_SAN"] === "1";
const requestedMode = process.env["SCRIPTC_LLVM_TEST_MODE"];
if (requestedMode !== undefined && requestedMode !== "release" && requestedMode !== "dev") {
throw new Error("SCRIPTC_LLVM_TEST_MODE must be release or dev when set");
}
// Combined CI lanes cover release in differential.test.ts. Standalone and
// packaged-artifact runs retain both modes unless one is explicitly selected.
const optimizationModes: readonly ("release" | "dev")[] = requestedMode === undefined
? ["release", "dev"] : [requestedMode];
// Same known-env contract as the main differential suite. // Same known-env contract as the main differential suite.
process.env["SCRIPTC_TEST_ENV"] = "from-harness"; process.env["SCRIPTC_TEST_ENV"] = "from-harness";
@@ -172,12 +180,12 @@ async function build(file: string, optimization: "release" | "dev") {
}); });
} }
describe(`llvm differential corpus (${files.length} programs${sanitize ? ", sanitized" : ""}${shardSuffix()})`, () => { describe(`llvm differential corpus (${files.length} programs, ${optimizationModes.join("+")}${sanitize ? ", sanitized" : ""}${shardSuffix()})`, () => {
test.for(files.map((f) => [f.slice(corpusDir.length + 1), f] as const))("%s", async ([rel, file]) => { test.for(files.map((f) => [f.slice(corpusDir.length + 1), f] as const))("%s", async ([rel, file]) => {
const oracle = await runBinary(process.execPath, nodeOracleArgs(file)); const oracle = await runBinary(process.execPath, nodeOracleArgs(file));
const expectedExit = expectedExitCode(file); const expectedExit = expectedExitCode(file);
expect(oracle.exitCode).toBe(expectedExit); expect(oracle.exitCode).toBe(expectedExit);
for (const optimization of ["release", "dev"] as const) { for (const optimization of optimizationModes) {
const result = await build(file, optimization); const result = await build(file, optimization);
if (!result.ok) throw new Error(`${rel} (${optimization}): ` + result.diagnostics.map((d) => `${d.code}: ${d.message}`).join("; ")); if (!result.ok) throw new Error(`${rel} (${optimization}): ` + result.diagnostics.map((d) => `${d.code}: ${d.message}`).join("; "));
expect(result.backend).toBe("llvm"); expect(result.backend).toBe("llvm");