@waffle-os/runtime 0.0.145 → 0.0.146
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +32 -0
- package/browser/command-input.ts +86 -0
- package/browser/command-owner.ts +5 -0
- package/browser/display/guest.ts +2 -18
- package/browser/display/surface-info.ts +19 -0
- package/browser/operations/cells.ts +90 -0
- package/browser/operations/guest.ts +94 -0
- package/browser/operations/owner.ts +201 -0
- package/browser/operations/protocol.ts +16 -0
- package/browser/operations/types.ts +41 -0
- package/browser/operations/writer.ts +106 -0
- package/browser/preview1-worker.ts +8 -1
- package/browser/process-broker.ts +372 -22
- package/browser/process-start.ts +5 -2
- package/browser/run-command.ts +388 -0
- package/browser/shared-fs.ts +20 -3
- package/browser/worker-memory.ts +6 -0
- package/browser/worker.ts +121 -27
- package/dist/browser/command-input.js +82 -0
- package/dist/browser/command-owner.js +2 -0
- package/dist/browser/display/guest.js +2 -18
- package/dist/browser/display/surface-info.js +18 -0
- package/dist/browser/operations/cells.js +80 -0
- package/dist/browser/operations/guest.js +67 -0
- package/dist/browser/operations/owner.js +175 -0
- package/dist/browser/operations/protocol.js +0 -0
- package/dist/browser/operations/types.js +0 -0
- package/dist/browser/operations/writer.js +98 -0
- package/dist/browser/preview1-worker.js +4 -0
- package/dist/browser/process-broker.js +317 -18
- package/dist/browser/process-start.js +3 -0
- package/dist/browser/run-command.js +377 -0
- package/dist/browser/shared-fs.js +8 -3
- package/dist/browser/worker-memory.js +10 -1
- package/dist/browser/worker.js +83 -28
- package/dist/fs/client.js +81 -18
- package/dist/fs/resolve-observation.js +11 -0
- package/dist/fs/service.js +51 -4
- package/dist/proc/command-transfer.js +72 -0
- package/dist/proc/directory.js +9 -1
- package/dist/proc/intrinsics/host.js +4 -1
- package/dist/proc/intrinsics.js +1 -0
- package/dist/proc/pipes.js +37 -4
- package/dist/proc/registry.js +25 -14
- package/dist/proc/start-command.js +101 -0
- package/dist/proc/supervisor.js +34 -10
- package/dist/proc/worker-broker.js +86 -31
- package/dist/proc/worker-client.js +67 -31
- package/dist/programs/collection.js +2 -0
- package/dist/runtime.js +14 -1
- package/dist/tooling/program/program-transformer.json +1 -1
- package/fs/client.ts +113 -17
- package/fs/resolve-observation.ts +25 -0
- package/fs/service.ts +63 -4
- package/index.ts +5 -0
- package/package.json +9 -1
- package/proc/command-transfer.ts +96 -0
- package/proc/directory.ts +10 -1
- package/proc/intrinsics/host.ts +5 -1
- package/proc/intrinsics.ts +1 -0
- package/proc/pipes.ts +39 -6
- package/proc/registry.ts +52 -17
- package/proc/start-command.ts +157 -0
- package/proc/supervisor.ts +34 -9
- package/proc/worker-broker.ts +100 -38
- package/proc/worker-client.ts +84 -31
- package/programs/collection.ts +4 -0
- package/runtime.ts +44 -3
- package/scripts/test-browser.ts +49 -29
- package/tests/browser-controls-discovery.test.ts +2 -10
- package/tests/browser-matrix.test.ts +105 -59
- package/tests/browser-navigation.test.ts +1 -1
- package/tests/browser-runner-lifecycle.ts +23 -13
- package/tests/command-input.test.ts +40 -0
- package/tests/command-scope.test.ts +422 -0
- package/tests/filesystem-client-intrinsics.test.ts +2 -0
- package/tests/filesystem-refcount.test.ts +2 -0
- package/tests/filesystem-resolve-observation.test.ts +185 -0
- package/tests/fixtures/command-bounded-admission.ts +31 -0
- package/tests/fixtures/command-disposal.ts +47 -0
- package/tests/fixtures/command-guests.ts +123 -0
- package/tests/fixtures/operation-fs-worker.ts +114 -0
- package/tests/fixtures/operation-observer-worker.ts +41 -0
- package/tests/fixtures/operation-page.ts +522 -0
- package/tests/fixtures/process-start-worker.ts +32 -0
- package/tests/link-browser-runner.ts +95 -22
- package/tests/node-exports.test.ts +29 -0
- package/tests/operation-diagnostics-browser.ts +192 -0
- package/tests/operation-diagnostics.test.ts +291 -0
- package/tests/page-runner/browser-controls-process-fixture.ts +24 -0
- package/tests/page-runner/browser-controls-runner.test.ts +20 -0
- package/tests/page-runner/browser-controls-runner.ts +1 -0
- package/tests/page-runner/browser-controls-suite.ts +20 -3
- package/tests/page-runner/control-run.ts +9 -1
- package/tests/page-runner/driver.ts +2 -0
- package/tests/page-runner/playwright-driver.ts +1 -1
- package/tests/page-runner/suite-host.ts +26 -1
- package/tests/page-runner/suite-startup.test.ts +39 -0
- package/tests/page-runner/threads-runtime-browser.test.ts +4 -6
- package/tests/page-runner/threads-runtime-suite.test.ts +14 -5
- package/tests/page-runner/worker-capability-controls.ts +174 -15
- package/tests/pipe-reader-reuse-races.test.ts +44 -0
- package/tests/process-start-browser-runner.ts +12 -4
- package/tests/process-start-browser.ts +66 -5
- package/tests/program-build-tools.test.ts +1 -1
- package/tests/runtime-facade.test.ts +5 -0
- package/tests/start-command.test.ts +109 -0
- package/tests/threads-guest-fixture.ts +1 -1
- package/tests/threads-guest-module.ts +6 -3
- package/tests/threads-guest.test.ts +25 -0
- package/tests/threads-runtime-browser-runner.ts +36 -13
- package/tests/threads-runtime-browser.ts +231 -92
- package/tests/threads-runtime-cases.ts +18 -1
- package/tests/threads-runtime-cleanup.ts +5 -1
- package/tests/threads-runtime-fd-browser.ts +247 -0
- package/tests/threads-runtime-fd-control.ts +3 -385
- package/tests/threads-runtime-fd-descriptors.test.ts +15 -13
- package/tests/threads-runtime-fd-module.ts +13 -2
- package/tests/threads-runtime-fd-service.ts +23 -2
- package/tests/threads-runtime-growth-worker.ts +61 -0
- package/tests/threads-runtime-host.ts +17 -4
- package/tests/threads-runtime-modules.ts +23 -5
- package/tests/threads-runtime-regression-controls.ts +386 -0
- package/tests/threads-runtime-regression-modules.ts +242 -0
- package/tests/threads-runtime-service-barrier.ts +8 -1
- package/tests/webkit-diagnostics.ts +125 -0
- package/tests/webkit-error-output.test.ts +118 -0
- package/tests/worker-memory-bootstrap.test.ts +19 -1
- package/tests/worker-memory-broker.test.ts +16 -8
- package/tooling/ci-paths.test.ts +329 -61
- package/tooling/private-authority.ts +14 -0
- package/tooling/program/program-transformer.json +1 -1
- package/tooling/tarball-smoke.ts +3 -1
package/tooling/ci-paths.test.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { Glob, YAML } from "bun";
|
|
2
2
|
import { expect, test } from "bun:test";
|
|
3
|
-
import { readFileSync } from "node:fs";
|
|
3
|
+
import { existsSync, mkdtempSync, readFileSync, rmSync } from "node:fs";
|
|
4
|
+
import { tmpdir } from "node:os";
|
|
5
|
+
import { join } from "node:path";
|
|
4
6
|
|
|
5
7
|
function isRecord(value: unknown): value is Record<string, unknown> {
|
|
6
8
|
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
@@ -16,6 +18,7 @@ const workflow = record(
|
|
|
16
18
|
);
|
|
17
19
|
const jobs = record(workflow.jobs);
|
|
18
20
|
const changes = record(jobs.changes);
|
|
21
|
+
const packageTestsCommand = "bun run test --parallel=2 && bun run test:ci";
|
|
19
22
|
if (!Array.isArray(changes.steps)) throw new Error("expected change-detection steps");
|
|
20
23
|
const paths = changes.steps.map(record).find((step) => step.id === "paths");
|
|
21
24
|
const filters = record(YAML.parse(String(record(paths?.with).filters)));
|
|
@@ -32,15 +35,20 @@ for (const name of ["browser", "libc"]) {
|
|
|
32
35
|
const job = record(jobs[name]);
|
|
33
36
|
// libc is also the single producer of the memory group fixture the browser gate consumes.
|
|
34
37
|
expect(job.needs).toEqual(
|
|
35
|
-
name === "browser"
|
|
36
|
-
? ["changes", "network-wasm", "libc", "threads-fixture"]
|
|
37
|
-
: ["changes", "network-wasm"],
|
|
38
|
+
name === "browser" ? ["changes", "libc", "threads-fixture"] : "changes",
|
|
38
39
|
);
|
|
39
|
-
const
|
|
40
|
+
const selected =
|
|
41
|
+
name === "libc"
|
|
42
|
+
? "needs.changes.outputs.paths-result != 'success' || needs.changes.outputs.libc == 'true' || needs.changes.outputs.browser != 'false'"
|
|
43
|
+
: "needs.changes.outputs.browser != 'false'";
|
|
40
44
|
expect(job.if).toBe(
|
|
41
|
-
`\${{ (github.event_name != 'pull_request' || !github.event.pull_request.draft) && (!cancelled() && (github.event_name == 'workflow_dispatch' ||
|
|
45
|
+
`\${{ (github.event_name != 'pull_request' || !github.event.pull_request.draft) && (!cancelled() && (github.event_name == 'workflow_dispatch' || ${selected})) }}`,
|
|
42
46
|
);
|
|
43
|
-
|
|
47
|
+
const output =
|
|
48
|
+
name === "libc"
|
|
49
|
+
? "${{ steps.paths.outputs.libc }}"
|
|
50
|
+
: "${{ steps.paths.outcome != 'success' || steps.paths.outputs.browser != 'false' }}";
|
|
51
|
+
expect(record(changes.outputs)[name]).toBe(output);
|
|
44
52
|
});
|
|
45
53
|
|
|
46
54
|
test(`${name} selects runtime, dependency and workflow inputs`, () => {
|
|
@@ -76,7 +84,7 @@ for (const name of ["browser", "libc"]) {
|
|
|
76
84
|
});
|
|
77
85
|
}
|
|
78
86
|
|
|
79
|
-
test("browser relay inputs select the normal gate and only
|
|
87
|
+
test("browser relay inputs select the normal gate and only the runtime shard installs native peers", () => {
|
|
80
88
|
for (const path of [
|
|
81
89
|
"packages/waffle/tests/network-relay-browser-runner.ts",
|
|
82
90
|
"packages/waffle/tests/network-relay-worker.ts",
|
|
@@ -94,7 +102,7 @@ test("browser relay inputs select the normal gate and only its parallel group in
|
|
|
94
102
|
const native = steps
|
|
95
103
|
.map(record)
|
|
96
104
|
.find((step) => step.name === "Prepare and verify the required native relay prebuild");
|
|
97
|
-
expect(native?.if).toBe("matrix.group == '
|
|
105
|
+
expect(native?.if).toBe("matrix.group == 'runtime'");
|
|
98
106
|
expect(native?.run).toBe("bun packages/waffle-relay/scripts/prepare-native.ts");
|
|
99
107
|
});
|
|
100
108
|
|
|
@@ -181,10 +189,23 @@ test("release workflow publishes to npm with Changesets and OIDC provenance", ()
|
|
|
181
189
|
const publishStep = releaseSteps.find(
|
|
182
190
|
(entry) => entry.name === "Create Release Pull Request or Publish to npm",
|
|
183
191
|
);
|
|
184
|
-
expect(publishStep?.uses).toBe("changesets/action@
|
|
192
|
+
expect(publishStep?.uses).toBe("changesets/action@v2");
|
|
185
193
|
const inputs = record(publishStep?.with);
|
|
186
|
-
expect(inputs
|
|
187
|
-
expect(inputs
|
|
194
|
+
expect(inputs["version-script"]).toBe("bun run release:version");
|
|
195
|
+
expect(inputs["publish-script"]).toBe("bun run release:publish");
|
|
196
|
+
expect(inputs["create-github-releases"]).toBe(true);
|
|
197
|
+
expect(inputs.version).toBeUndefined();
|
|
198
|
+
expect(inputs.publish).toBeUndefined();
|
|
199
|
+
expect(inputs.createGithubReleases).toBeUndefined();
|
|
200
|
+
for (const command of [String(inputs["version-script"]), String(inputs["publish-script"])]) {
|
|
201
|
+
expect(command).not.toMatch(/&&|\|\||[;|]/);
|
|
202
|
+
}
|
|
203
|
+
const rootManifest = record(
|
|
204
|
+
JSON.parse(readFileSync(new URL("../../../package.json", import.meta.url), "utf8")),
|
|
205
|
+
);
|
|
206
|
+
const rootScripts = record(rootManifest.scripts);
|
|
207
|
+
expect(rootScripts["release:version"]).toBe("bun scripts/version-runtime.ts");
|
|
208
|
+
expect(rootScripts["release:publish"]).toBe("bun scripts/publish-runtime.ts");
|
|
188
209
|
expect(record(publishStep?.env).NPM_CONFIG_PROVENANCE).toBe("true");
|
|
189
210
|
});
|
|
190
211
|
|
|
@@ -246,7 +267,7 @@ test("thread, memory and producer inputs select the browser and all its fixture
|
|
|
246
267
|
const producer = record(jobs["threads-fixture"]);
|
|
247
268
|
expect(producer.needs).toBe("changes");
|
|
248
269
|
expect(producer.if).toBe(record(jobs.browser).if);
|
|
249
|
-
expect(String(record(jobs.libc).if)).toContain("needs.changes.outputs.browser
|
|
270
|
+
expect(String(record(jobs.libc).if)).toContain("needs.changes.outputs.browser != 'false'");
|
|
250
271
|
expect(producer.uses).toBe("./.github/workflows/threads-fixture.yml");
|
|
251
272
|
const triggers = record(threadsWorkflow.on);
|
|
252
273
|
expect(Object.keys(triggers).sort()).toEqual(["workflow_call", "workflow_dispatch"]);
|
|
@@ -274,7 +295,7 @@ test("one pinned Rust producer exports its exact uploaded artifact through the r
|
|
|
274
295
|
expect(threadsSteps.some((step) => String(step.run).includes("cache-hit="))).toBe(true);
|
|
275
296
|
});
|
|
276
297
|
|
|
277
|
-
test("
|
|
298
|
+
test("browser groups that run Rust threads verify the producer artifact without compiling", () => {
|
|
278
299
|
const steps = stepsFor("browser");
|
|
279
300
|
const downloads = steps.filter(
|
|
280
301
|
(step) =>
|
|
@@ -289,8 +310,9 @@ test("both browser groups download the producer ID and verify it without compili
|
|
|
289
310
|
expect(inputs["merge-multiple"]).toBe(true);
|
|
290
311
|
for (const field of ["name", "pattern", "run-id", "github-token"])
|
|
291
312
|
expect(inputs[field]).toBeUndefined();
|
|
292
|
-
expect(download.if).
|
|
313
|
+
expect(download.if).toBe("matrix.group == 'runtime'");
|
|
293
314
|
const guard = steps.find((step) => step.name === "Require the Rust threads fixture artifact ID");
|
|
315
|
+
expect(guard?.if).toBe(download.if);
|
|
294
316
|
expect(record(guard?.env).THREAD_ARTIFACT_ID).toBe(inputs["artifact-ids"]);
|
|
295
317
|
expect(steps.indexOf(record(guard))).toBeLessThan(steps.indexOf(download));
|
|
296
318
|
for (const id of ["", "45678"]) {
|
|
@@ -302,6 +324,7 @@ test("both browser groups download the producer ID and verify it without compili
|
|
|
302
324
|
const verify = steps.find(
|
|
303
325
|
(step) => step.run === "bun packages/waffle/scripts/build-thread-fixture.ts --verify",
|
|
304
326
|
);
|
|
327
|
+
expect(verify?.if).toBe(download.if);
|
|
305
328
|
const browser = steps.find((step) => String(step.run).startsWith("bun run test:browser"));
|
|
306
329
|
expect(record(verify?.env).THREAD_FIXTURE_DIR).toBe(inputs.path);
|
|
307
330
|
expect(record(browser?.env).THREAD_FIXTURE_DIR).toBe(inputs.path);
|
|
@@ -325,6 +348,7 @@ test("Complete CI gate rejects a failed or cancelled required threads producer",
|
|
|
325
348
|
const command = Bun.spawnSync(["bash", "-eo", "pipefail", "-c", String(check?.run)], {
|
|
326
349
|
env: {
|
|
327
350
|
...process.env,
|
|
351
|
+
BROWSER_REQUIRED: "false",
|
|
328
352
|
RESULTS: JSON.stringify({
|
|
329
353
|
browser: { result: "skipped" },
|
|
330
354
|
"threads-fixture": { result },
|
|
@@ -335,6 +359,82 @@ test("Complete CI gate rejects a failed or cancelled required threads producer",
|
|
|
335
359
|
}
|
|
336
360
|
});
|
|
337
361
|
|
|
362
|
+
function browserShardOutputs() {
|
|
363
|
+
const browser = record(jobs.browser);
|
|
364
|
+
const groups = record(record(browser.strategy).matrix).group;
|
|
365
|
+
if (!Array.isArray(groups) || !groups.every((group) => typeof group === "string"))
|
|
366
|
+
throw new Error("expected browser matrix groups");
|
|
367
|
+
expect(Object.keys(record(browser.outputs)).sort()).toEqual(groups.toSorted());
|
|
368
|
+
const step = stepsFor("browser").at(-2);
|
|
369
|
+
expect(step?.id).toBe("browser-result");
|
|
370
|
+
expect(step?.if).toBeUndefined();
|
|
371
|
+
expect(record(step?.env).BROWSER_SHARD).toBe("${{ matrix.group }}");
|
|
372
|
+
return Object.fromEntries(
|
|
373
|
+
groups.map((group: string) => {
|
|
374
|
+
expect(record(browser.outputs)[group]).toBe(`\${{ steps.browser-result.outputs.${group} }}`);
|
|
375
|
+
const script = `
|
|
376
|
+
GITHUB_OUTPUT=$(mktemp)
|
|
377
|
+
trap 'rm -f "$GITHUB_OUTPUT"' EXIT
|
|
378
|
+
${step?.run}
|
|
379
|
+
cat "$GITHUB_OUTPUT"
|
|
380
|
+
`;
|
|
381
|
+
const command = Bun.spawnSync(["bash", "-eo", "pipefail", "-c", script], {
|
|
382
|
+
env: { ...process.env, BROWSER_SHARD: group },
|
|
383
|
+
});
|
|
384
|
+
expect(command.exitCode, command.stderr.toString()).toBe(0);
|
|
385
|
+
const output = command.stdout.toString();
|
|
386
|
+
expect(output).toBe(`${group}=passed\n`);
|
|
387
|
+
return [group, output.trimEnd().split("=")[1]];
|
|
388
|
+
}),
|
|
389
|
+
);
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
test("Complete CI gate requires success from each selected browser shard", () => {
|
|
393
|
+
const gate = record(jobs.gate);
|
|
394
|
+
expect(gate.needs).toContain("browser");
|
|
395
|
+
const step = stepsFor("gate").find((step) => step.name === "Reject failed or cancelled CI jobs");
|
|
396
|
+
const selection =
|
|
397
|
+
"github.event_name == 'workflow_dispatch' || needs.changes.outputs.browser != 'false'";
|
|
398
|
+
expect(record(step?.env).BROWSER_REQUIRED).toBe(`\${{ ${selection} }}`);
|
|
399
|
+
expect(record(jobs.browser).if).toContain(selection);
|
|
400
|
+
const allPassed = browserShardOutputs();
|
|
401
|
+
const missingShards = Object.keys(allPassed).map((group) => {
|
|
402
|
+
const partial = { ...allPassed };
|
|
403
|
+
delete partial[group];
|
|
404
|
+
return { result: "success", outputs: partial };
|
|
405
|
+
});
|
|
406
|
+
const passed = { result: "success", outputs: allPassed };
|
|
407
|
+
const outcomes = [
|
|
408
|
+
[passed, "true", 0],
|
|
409
|
+
[{ result: "failure", outputs: allPassed }, "true", 1],
|
|
410
|
+
[{ result: "cancelled", outputs: allPassed }, "true", 1],
|
|
411
|
+
[{ result: "skipped" }, "true", 1],
|
|
412
|
+
[{ result: "success" }, "true", 1],
|
|
413
|
+
[{ result: "skipped" }, "false", 0],
|
|
414
|
+
[{ result: "failure" }, "false", 1],
|
|
415
|
+
[{ result: "cancelled" }, "false", 1],
|
|
416
|
+
[undefined, "true", 1],
|
|
417
|
+
[undefined, "false", 1],
|
|
418
|
+
] satisfies [object | undefined, string, number][];
|
|
419
|
+
for (const [browser, required, expected] of outcomes.concat(
|
|
420
|
+
missingShards.map((browser) => [browser, "true", 1]),
|
|
421
|
+
)) {
|
|
422
|
+
const command = Bun.spawnSync(["bash", "-eo", "pipefail", "-c", String(step?.run)], {
|
|
423
|
+
env: {
|
|
424
|
+
...process.env,
|
|
425
|
+
BROWSER_REQUIRED: required,
|
|
426
|
+
RESULTS: JSON.stringify({
|
|
427
|
+
changes: { result: "success" },
|
|
428
|
+
browser,
|
|
429
|
+
}),
|
|
430
|
+
},
|
|
431
|
+
});
|
|
432
|
+
expect(command.exitCode, `browser=${JSON.stringify(browser)}, required=${required}`).toBe(
|
|
433
|
+
expected,
|
|
434
|
+
);
|
|
435
|
+
}
|
|
436
|
+
});
|
|
437
|
+
|
|
338
438
|
const recoveryReportPath = "${{ runner.temp }}/recovery-r42-report.json";
|
|
339
439
|
const browserProtocolPath = "${{ runner.temp }}/waffle-browser-protocol.log";
|
|
340
440
|
|
|
@@ -356,7 +456,7 @@ test("browser failure retains structured recovery evidence before full protocol"
|
|
|
356
456
|
expect(record(recoveryUpload.with).path).not.toBe(record(protocolUpload.with).path);
|
|
357
457
|
});
|
|
358
458
|
|
|
359
|
-
test("
|
|
459
|
+
test("reporter controls retain durable process evidence even when the command fails", () => {
|
|
360
460
|
const steps = stepsFor("browser");
|
|
361
461
|
const browserTest = steps.find(
|
|
362
462
|
(step) =>
|
|
@@ -365,7 +465,7 @@ test("serial browser controls retain durable process evidence even when the comm
|
|
|
365
465
|
const result = "${{ runner.temp }}/browser-controls-results.json";
|
|
366
466
|
expect(record(browserTest?.env).BROWSER_CONTROLS_RESULT).toBe(result);
|
|
367
467
|
const upload = artifactStep(steps, `${result}*`);
|
|
368
|
-
expect(upload.if).toBe("always() && matrix.group == '
|
|
468
|
+
expect(upload.if).toBe("always() && matrix.group == 'reporter'");
|
|
369
469
|
expect(record(upload.with).name).toBe(
|
|
370
470
|
"browser-controls-${{ github.run_id }}-${{ github.run_attempt }}",
|
|
371
471
|
);
|
|
@@ -373,12 +473,26 @@ test("serial browser controls retain durable process evidence even when the comm
|
|
|
373
473
|
expect(record(upload.with)["if-no-files-found"]).toBe("warn");
|
|
374
474
|
});
|
|
375
475
|
|
|
376
|
-
test("the browser suite
|
|
476
|
+
test("the browser suite dispatches the runtime and reporter groups separately with failures blocking", () => {
|
|
477
|
+
expect(record(jobs.browser).strategy).toEqual({
|
|
478
|
+
"fail-fast": false,
|
|
479
|
+
matrix: { group: ["runtime", "reporter"] },
|
|
480
|
+
});
|
|
377
481
|
const browserTest = stepsFor("browser").find(
|
|
378
482
|
(step) =>
|
|
379
483
|
step.run === 'bun run test:browser 2>&1 | tee "$RUNNER_TEMP/waffle-browser-protocol.log"',
|
|
380
484
|
);
|
|
485
|
+
expect(browserTest?.if).toBeUndefined();
|
|
486
|
+
expect(browserTest?.shell).toBe("bash");
|
|
381
487
|
expect(record(browserTest?.env).WAFFLE_BROWSER_GROUP).toBe("${{ matrix.group }}");
|
|
488
|
+
const publication = stepsFor("browser").find(
|
|
489
|
+
(step) =>
|
|
490
|
+
step.run === "bun packages/waffle/tests/publication-browser-runner.ts --workspace chromium",
|
|
491
|
+
);
|
|
492
|
+
expect(browserTest?.id).toBe("browser-tests");
|
|
493
|
+
expect(publication?.if).toBe(
|
|
494
|
+
"${{ !cancelled() && matrix.group == 'runtime' && (steps.browser-tests.outcome == 'success' || steps.browser-tests.outcome == 'failure') }}",
|
|
495
|
+
);
|
|
382
496
|
});
|
|
383
497
|
|
|
384
498
|
test("missing recovery report does not replace the browser failure", () => {
|
|
@@ -391,10 +505,9 @@ test("package installs share one Bun package-manager cache contract", () => {
|
|
|
391
505
|
const expectedCacheUses = {
|
|
392
506
|
package: "actions/cache@v4",
|
|
393
507
|
browser: "actions/cache/restore@v4",
|
|
394
|
-
site: "actions/cache/restore@v4",
|
|
395
508
|
};
|
|
396
509
|
let sharedKey: string | undefined;
|
|
397
|
-
for (const name of ["package", "browser"
|
|
510
|
+
for (const name of ["package", "browser"] as const) {
|
|
398
511
|
const steps = stepsFor(name);
|
|
399
512
|
const cacheSteps = steps.filter((step) => {
|
|
400
513
|
if (step.uses !== expectedCacheUses[name]) return false;
|
|
@@ -433,13 +546,94 @@ test("package installs share one Bun package-manager cache contract", () => {
|
|
|
433
546
|
}
|
|
434
547
|
});
|
|
435
548
|
|
|
436
|
-
test("
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
549
|
+
test("the site runs once for ready events before runtime prerequisites", () => {
|
|
550
|
+
const job = record(jobs.package);
|
|
551
|
+
expect(jobs.site).toBeUndefined();
|
|
552
|
+
expect(job.if).toBe(
|
|
553
|
+
"${{ !cancelled() && (github.event_name != 'pull_request' || !github.event.pull_request.draft) }}",
|
|
554
|
+
);
|
|
555
|
+
expect(job.needs).toBe("changes");
|
|
556
|
+
expect(job.env).toBeUndefined();
|
|
557
|
+
|
|
558
|
+
const steps = stepsFor("package");
|
|
559
|
+
const site = steps.filter((step) => step["working-directory"] === "site");
|
|
560
|
+
expect(site.map((step) => step.run)).toEqual([
|
|
561
|
+
"bun install --frozen-lockfile",
|
|
562
|
+
"bun run build",
|
|
563
|
+
"bun run typecheck",
|
|
564
|
+
]);
|
|
565
|
+
const [install, build, typecheck] = site;
|
|
566
|
+
expect(install?.if).toBeUndefined();
|
|
567
|
+
expect(build?.if).toBe("steps.site-install.outcome == 'success'");
|
|
568
|
+
expect(typecheck?.if).toBe("steps.site-install.outcome == 'success'");
|
|
569
|
+
const requireNetwork = steps.findIndex(
|
|
570
|
+
(step) => step.name === "Require the network producer for runtime checks",
|
|
571
|
+
);
|
|
572
|
+
for (const step of site) {
|
|
573
|
+
expect(step["continue-on-error"]).toBe(true);
|
|
574
|
+
expect(step.env).toBeUndefined();
|
|
575
|
+
expect(steps.indexOf(step)).toBeLessThan(requireNetwork);
|
|
576
|
+
}
|
|
577
|
+
expect(record(job.outputs)).toEqual({
|
|
578
|
+
"site-build": "${{ steps.site-build.outcome }}",
|
|
579
|
+
"site-typecheck": "${{ steps.site-typecheck.outcome }}",
|
|
580
|
+
});
|
|
581
|
+
expect(steps.some((step) => String(step.run).startsWith("bun install --cwd site"))).toBe(false);
|
|
582
|
+
});
|
|
583
|
+
|
|
584
|
+
test("package runtime setup requires a successful producer after both site checks", () => {
|
|
585
|
+
const steps = stepsFor("package");
|
|
586
|
+
const requireNetwork = steps.find(
|
|
587
|
+
(step) => step.name === "Require the network producer for runtime checks",
|
|
588
|
+
);
|
|
589
|
+
expect(record(requireNetwork?.env).NETWORK_RESULT).toBe("${{ needs.changes.result }}");
|
|
590
|
+
expect(requireNetwork?.if).toBeUndefined();
|
|
591
|
+
expect(requireNetwork?.["continue-on-error"]).toBeUndefined();
|
|
592
|
+
expect(steps.indexOf(record(requireNetwork))).toBeLessThan(
|
|
593
|
+
steps.findIndex((step) => step.id === "network-artifact"),
|
|
594
|
+
);
|
|
595
|
+
const scratch = mkdtempSync(join(tmpdir(), "waffle-ci-network-"));
|
|
596
|
+
const output = join(scratch, "github-env");
|
|
597
|
+
try {
|
|
598
|
+
for (const result of ["failure", "skipped", "cancelled", "", "success"]) {
|
|
599
|
+
const run = Bun.spawnSync(["bash", "-eo", "pipefail", "-c", String(requireNetwork?.run)], {
|
|
600
|
+
env: { ...process.env, NETWORK_RESULT: result, GITHUB_ENV: output },
|
|
601
|
+
});
|
|
602
|
+
expect(run.exitCode, result).toBe(result === "success" ? 0 : 1);
|
|
603
|
+
expect(existsSync(output), result).toBe(result === "success");
|
|
604
|
+
}
|
|
605
|
+
expect(readFileSync(output, "utf8")).toBe("WAFFLE_NETWORK_PREBUILT=1\n");
|
|
606
|
+
} finally {
|
|
607
|
+
rmSync(scratch, { recursive: true, force: true });
|
|
608
|
+
}
|
|
609
|
+
});
|
|
610
|
+
|
|
611
|
+
test("Complete CI requires explicit success from the runtime package and both site checks", () => {
|
|
612
|
+
const gate = record(jobs.gate);
|
|
613
|
+
expect(gate.name).toBe("Complete CI gate");
|
|
614
|
+
expect(gate.needs).toContain("package");
|
|
615
|
+
expect(gate.needs).not.toContain("site");
|
|
616
|
+
const check = stepsFor("gate").find(
|
|
617
|
+
(step) => step.name === "Require successful package and site checks",
|
|
618
|
+
);
|
|
619
|
+
const results = {
|
|
620
|
+
PACKAGE_RESULT: "${{ needs.package.result }}",
|
|
621
|
+
SITE_BUILD: "${{ needs.package.outputs.site-build }}",
|
|
622
|
+
SITE_TYPECHECK: "${{ needs.package.outputs.site-typecheck }}",
|
|
623
|
+
};
|
|
624
|
+
expect(record(check?.env)).toEqual(results);
|
|
625
|
+
const env = {
|
|
626
|
+
...process.env,
|
|
627
|
+
PACKAGE_RESULT: "success",
|
|
628
|
+
SITE_BUILD: "success",
|
|
629
|
+
SITE_TYPECHECK: "success",
|
|
630
|
+
};
|
|
631
|
+
const command = ["bash", "-eo", "pipefail", "-c", String(check?.run)];
|
|
632
|
+
expect(Bun.spawnSync(command, { env }).exitCode).toBe(0);
|
|
633
|
+
for (const field of Object.keys(results)) {
|
|
634
|
+
for (const failure of ["failure", "skipped", "cancelled", ""]) {
|
|
635
|
+
expect(Bun.spawnSync(command, { env: { ...env, [field]: failure } }).exitCode).toBe(1);
|
|
636
|
+
}
|
|
443
637
|
}
|
|
444
638
|
});
|
|
445
639
|
|
|
@@ -459,9 +653,7 @@ test("package runs each test root once without repeating preparation", () => {
|
|
|
459
653
|
const steps = record(jobs.package).steps;
|
|
460
654
|
if (!Array.isArray(steps)) throw new Error("expected package steps");
|
|
461
655
|
const commands = steps.map((step) => record(step).run);
|
|
462
|
-
expect(commands.filter((command) => command ===
|
|
463
|
-
1,
|
|
464
|
-
);
|
|
656
|
+
expect(commands.filter((command) => command === packageTestsCommand)).toHaveLength(1);
|
|
465
657
|
expect(commands).not.toContain("bun run prepare");
|
|
466
658
|
});
|
|
467
659
|
|
|
@@ -486,7 +678,7 @@ test("Rust network inputs select one release test/build lane and an exact WASM c
|
|
|
486
678
|
])
|
|
487
679
|
expect(selected("network", path), path).toBe(true);
|
|
488
680
|
expect(selected("network", "docs/network.md")).toBe(false);
|
|
489
|
-
const steps = stepsFor("
|
|
681
|
+
const steps = stepsFor("changes");
|
|
490
682
|
expect(
|
|
491
683
|
steps.filter((step) => typeof step.run === "string" && step.run.includes("cargo test")),
|
|
492
684
|
).toHaveLength(1);
|
|
@@ -513,11 +705,19 @@ test("network consumers verify restored bytes before install and forbid Cargo",
|
|
|
513
705
|
(step) => step.run === "bun run --cwd packages/waffle tooling/build-network.ts --verify",
|
|
514
706
|
);
|
|
515
707
|
const installed = steps.findIndex(
|
|
516
|
-
(step) =>
|
|
708
|
+
(step) =>
|
|
709
|
+
typeof step.run === "string" &&
|
|
710
|
+
step.run.startsWith("bun install") &&
|
|
711
|
+
step["working-directory"] !== "site",
|
|
517
712
|
);
|
|
518
713
|
expect(verified).toBeGreaterThan(restored);
|
|
519
714
|
expect(verified).toBeLessThan(installed);
|
|
520
|
-
|
|
715
|
+
for (const index of [restored, verified, installed]) {
|
|
716
|
+
expect(steps[index]?.if).toBeUndefined();
|
|
717
|
+
expect(steps[index]?.["continue-on-error"]).toBeUndefined();
|
|
718
|
+
}
|
|
719
|
+
if (name === "browser")
|
|
720
|
+
expect(record(record(jobs[name]).env).WAFFLE_NETWORK_PREBUILT).toBe("1");
|
|
521
721
|
expect(steps.some((step) => typeof step.run === "string" && /cargo\s/.test(step.run))).toBe(
|
|
522
722
|
false,
|
|
523
723
|
);
|
|
@@ -526,7 +726,7 @@ test("network consumers verify restored bytes before install and forbid Cargo",
|
|
|
526
726
|
});
|
|
527
727
|
|
|
528
728
|
test("network producer checks Rust target ownership with lockfile-sensitive caches", () => {
|
|
529
|
-
const steps = stepsFor("
|
|
729
|
+
const steps = stepsFor("changes");
|
|
530
730
|
const cache = steps.find((step) => step.id === "rust-cache");
|
|
531
731
|
expect(String(record(cache?.with).key)).toContain(
|
|
532
732
|
"hashFiles('packages/waffle/Cargo.lock', 'packages/waffle/rust-toolchain.toml')",
|
|
@@ -617,9 +817,9 @@ test("programs prepares locked Cargo sources after cache restore and before sour
|
|
|
617
817
|
|
|
618
818
|
test("jq has a separate leaf with the shared network artifact prerequisite", () => {
|
|
619
819
|
const job = record(jobs.jq);
|
|
620
|
-
expect(job.needs).
|
|
820
|
+
expect(job.needs).toBe("changes");
|
|
621
821
|
expect(job.if).toBe(
|
|
622
|
-
"${{ (github.event_name != 'pull_request' || !github.event.pull_request.draft) && (!cancelled() && (github.event_name == 'workflow_dispatch' || needs.changes.result != 'success' || needs.changes.outputs.jq == 'true')) }}",
|
|
822
|
+
"${{ (github.event_name != 'pull_request' || !github.event.pull_request.draft) && (!cancelled() && (github.event_name == 'workflow_dispatch' || needs.changes.outputs.paths-result != 'success' || needs.changes.outputs.jq == 'true')) }}",
|
|
623
823
|
);
|
|
624
824
|
expect(record(changes.outputs).jq).toBe("${{ steps.paths.outputs.jq }}");
|
|
625
825
|
const steps = stepsFor("jq");
|
|
@@ -824,9 +1024,10 @@ test("the browser rejects a missing fixture artifact ID before download", () =>
|
|
|
824
1024
|
expect(record(guard?.env).MEMORY_GROUP_ARTIFACT_ID).toBe(
|
|
825
1025
|
"${{ needs.libc.outputs.memory-group-artifact-id }}",
|
|
826
1026
|
);
|
|
827
|
-
expect(guard?.if).
|
|
1027
|
+
expect(guard?.if).toBe("matrix.group == 'runtime'");
|
|
828
1028
|
expect(guard?.["continue-on-error"]).toBeUndefined();
|
|
829
1029
|
const downloadIndex = steps.findIndex((step) => step.uses === "actions/download-artifact@v8");
|
|
1030
|
+
expect(steps[downloadIndex]?.if).toBe(guard?.if);
|
|
830
1031
|
expect(guard).toBeDefined();
|
|
831
1032
|
expect(steps.indexOf(record(guard))).toBeLessThan(downloadIndex);
|
|
832
1033
|
for (const id of ["", "12345"]) {
|
|
@@ -855,7 +1056,7 @@ test("program producers explicitly provision the pinned optimizer before running
|
|
|
855
1056
|
expect(steps[optimizer]?.["continue-on-error"]).toBeUndefined();
|
|
856
1057
|
}
|
|
857
1058
|
expect(
|
|
858
|
-
stepsFor("
|
|
1059
|
+
stepsFor("changes").some((step) => step.uses === "./.github/actions/program-optimizer"),
|
|
859
1060
|
).toBe(false);
|
|
860
1061
|
for (const path of [
|
|
861
1062
|
"ci.yml",
|
|
@@ -878,10 +1079,10 @@ test("program producers explicitly provision the pinned optimizer before running
|
|
|
878
1079
|
|
|
879
1080
|
test("diffutils selects its exact integration inputs", () => {
|
|
880
1081
|
const job = record(jobs.diffutils);
|
|
881
|
-
expect(job.needs).
|
|
1082
|
+
expect(job.needs).toBe("changes");
|
|
882
1083
|
expect(record(changes.outputs).diffutils).toBe("${{ steps.paths.outputs.diffutils }}");
|
|
883
1084
|
expect(job.if).toBe(
|
|
884
|
-
"${{ (github.event_name != 'pull_request' || !github.event.pull_request.draft) && (!cancelled() && (github.event_name == 'workflow_dispatch' || needs.changes.result != 'success' || needs.changes.outputs.diffutils == 'true')) }}",
|
|
1085
|
+
"${{ (github.event_name != 'pull_request' || !github.event.pull_request.draft) && (!cancelled() && (github.event_name == 'workflow_dispatch' || needs.changes.outputs.paths-result != 'success' || needs.changes.outputs.diffutils == 'true')) }}",
|
|
885
1086
|
);
|
|
886
1087
|
for (const path of [
|
|
887
1088
|
".github/workflows/ci.yml",
|
|
@@ -906,7 +1107,7 @@ test("diffutils selects its exact integration inputs", () => {
|
|
|
906
1107
|
});
|
|
907
1108
|
|
|
908
1109
|
test("diffutils consumes the single verified network artifact before installation", () => {
|
|
909
|
-
const producer = stepsFor("
|
|
1110
|
+
const producer = stepsFor("changes");
|
|
910
1111
|
const steps = stepsFor("diffutils");
|
|
911
1112
|
const cache = producer.find((step) => step.id === "network-artifact");
|
|
912
1113
|
const restore = steps.findIndex((step) => step.id === "network-artifact");
|
|
@@ -1012,7 +1213,7 @@ test("diffutils package exposes its actual commands", async () => {
|
|
|
1012
1213
|
test("gh selects its inputs without selecting native program jobs for gh-only changes", () => {
|
|
1013
1214
|
const job = record(jobs.gh);
|
|
1014
1215
|
expect(record(changes.outputs).gh).toBe("${{ steps.paths.outputs.gh }}");
|
|
1015
|
-
expect(job.needs).
|
|
1216
|
+
expect(job.needs).toBe("changes");
|
|
1016
1217
|
expect(String(job.if)).toContain("needs.changes.outputs.gh == 'true'");
|
|
1017
1218
|
for (const path of [
|
|
1018
1219
|
"packages/gh/src/program.ts",
|
|
@@ -1037,7 +1238,7 @@ test("gh selects its inputs without selecting native program jobs for gh-only ch
|
|
|
1037
1238
|
|
|
1038
1239
|
test("gh restores the exact network asset and does not set up native compilers", () => {
|
|
1039
1240
|
const steps = stepsFor("gh");
|
|
1040
|
-
const producer = stepsFor("
|
|
1241
|
+
const producer = stepsFor("changes").find((step) => step.id === "network-artifact");
|
|
1041
1242
|
const restore = steps.find((step) => step.id === "network-artifact");
|
|
1042
1243
|
expect(record(restore?.with).key).toBe(record(producer?.with).key);
|
|
1043
1244
|
expect(record(restore?.with)["fail-on-cache-miss"]).toBe(true);
|
|
@@ -1070,9 +1271,9 @@ test("gh restores the exact network asset and does not set up native compilers",
|
|
|
1070
1271
|
|
|
1071
1272
|
test("awk has one bounded leaf using the normal finalizer and verified network bytes", () => {
|
|
1072
1273
|
const job = record(jobs.awk);
|
|
1073
|
-
expect(job.needs).
|
|
1274
|
+
expect(job.needs).toBe("changes");
|
|
1074
1275
|
expect(job.if).toBe(
|
|
1075
|
-
"${{ (github.event_name != 'pull_request' || !github.event.pull_request.draft) && (!cancelled() && (github.event_name == 'workflow_dispatch' || needs.changes.result != 'success' || needs.changes.outputs.awk == 'true')) }}",
|
|
1276
|
+
"${{ (github.event_name != 'pull_request' || !github.event.pull_request.draft) && (!cancelled() && (github.event_name == 'workflow_dispatch' || needs.changes.outputs.paths-result != 'success' || needs.changes.outputs.awk == 'true')) }}",
|
|
1076
1277
|
);
|
|
1077
1278
|
expect(record(changes.outputs).awk).toBe("${{ steps.paths.outputs.awk }}");
|
|
1078
1279
|
expect(job["timeout-minutes"]).toBe(15);
|
|
@@ -1094,7 +1295,7 @@ test("awk has one bounded leaf using the normal finalizer and verified network b
|
|
|
1094
1295
|
expect(producer).toBeDefined();
|
|
1095
1296
|
expect(steps.indexOf(record(producer))).toBeGreaterThan(optimizer);
|
|
1096
1297
|
expect(record(producer?.env).AWK_SCRATCH_ROOT).toBe("${{ runner.temp }}");
|
|
1097
|
-
const network = stepsFor("
|
|
1298
|
+
const network = stepsFor("changes").find((step) => step.id === "network-artifact");
|
|
1098
1299
|
expect(record(steps[restore]?.with).key).toBe(record(network?.with).key);
|
|
1099
1300
|
expect(record(steps[restore]?.with)["fail-on-cache-miss"]).toBe(true);
|
|
1100
1301
|
const commands = steps.map((step) => step.run).join("\n");
|
|
@@ -1153,10 +1354,10 @@ test("tar scratch path is resolved by a runner step, not job-context evaluation"
|
|
|
1153
1354
|
test("procps selects its exact inputs without selecting native work for package-only changes", () => {
|
|
1154
1355
|
const job = record(jobs.procps);
|
|
1155
1356
|
expect(record(changes.outputs).procps).toBe("${{ steps.paths.outputs.procps }}");
|
|
1156
|
-
expect(job.needs).
|
|
1357
|
+
expect(job.needs).toBe("changes");
|
|
1157
1358
|
expect(record(job.env).WAFFLE_NETWORK_PREBUILT).toBe("1");
|
|
1158
1359
|
expect(job.if).toBe(
|
|
1159
|
-
"${{ (github.event_name != 'pull_request' || !github.event.pull_request.draft) && (!cancelled() && (github.event_name == 'workflow_dispatch' || needs.changes.result != 'success' || needs.changes.outputs.procps == 'true')) }}",
|
|
1360
|
+
"${{ (github.event_name != 'pull_request' || !github.event.pull_request.draft) && (!cancelled() && (github.event_name == 'workflow_dispatch' || needs.changes.outputs.paths-result != 'success' || needs.changes.outputs.procps == 'true')) }}",
|
|
1160
1361
|
);
|
|
1161
1362
|
expect(filters.procps).toEqual([
|
|
1162
1363
|
".github/workflows/ci.yml",
|
|
@@ -1200,7 +1401,7 @@ test("procps runs pure and runtime controls once using verified network bytes wi
|
|
|
1200
1401
|
expect(execute).toBeGreaterThan(prepare);
|
|
1201
1402
|
expect(runs.filter((run) => run === "bun run prepare:package")).toHaveLength(1);
|
|
1202
1403
|
expect(runs.filter((run) => run === "bun run programs:procps")).toHaveLength(1);
|
|
1203
|
-
const network = stepsFor("
|
|
1404
|
+
const network = stepsFor("changes").find((step) => step.id === "network-artifact");
|
|
1204
1405
|
expect(record(steps[restore]?.with).key).toBe(record(network?.with).key);
|
|
1205
1406
|
expect(record(steps[restore]?.with)["fail-on-cache-miss"]).toBe(true);
|
|
1206
1407
|
expect(runs).toContain(
|
|
@@ -1224,9 +1425,9 @@ test("procps runs pure and runtime controls once using verified network bytes wi
|
|
|
1224
1425
|
|
|
1225
1426
|
test("checksums has a bounded leaf using the existing producer route", () => {
|
|
1226
1427
|
const job = record(jobs["coreutils-checksums"]);
|
|
1227
|
-
expect(job.needs).
|
|
1428
|
+
expect(job.needs).toBe("changes");
|
|
1228
1429
|
expect(job.if).toBe(
|
|
1229
|
-
"${{ (github.event_name != 'pull_request' || !github.event.pull_request.draft) && (!cancelled() && (github.event_name == 'workflow_dispatch' || needs.changes.result != 'success' || needs.changes.outputs.checksums == 'true')) }}",
|
|
1430
|
+
"${{ (github.event_name != 'pull_request' || !github.event.pull_request.draft) && (!cancelled() && (github.event_name == 'workflow_dispatch' || needs.changes.outputs.paths-result != 'success' || needs.changes.outputs.checksums == 'true')) }}",
|
|
1230
1431
|
);
|
|
1231
1432
|
expect(record(changes.outputs).checksums).toBe("${{ steps.paths.outputs.checksums }}");
|
|
1232
1433
|
expect(job["timeout-minutes"]).toBe(30);
|
|
@@ -1453,7 +1654,7 @@ test("package prepares exactly the pinned shallow-safe allocation reference befo
|
|
|
1453
1654
|
const setup = steps.findIndex(
|
|
1454
1655
|
(step) => step.run === "bun packages/waffle/tooling/prepare-allocation-reference.ts",
|
|
1455
1656
|
);
|
|
1456
|
-
const tests = steps.findIndex((step) => step.run ===
|
|
1657
|
+
const tests = steps.findIndex((step) => step.run === packageTestsCommand);
|
|
1457
1658
|
expect(setup).toBeGreaterThanOrEqual(0);
|
|
1458
1659
|
expect(setup).toBeLessThan(tests);
|
|
1459
1660
|
const source = readFileSync(
|
|
@@ -1535,8 +1736,8 @@ test("native relay setup requires prebuilt bytes before package and parallel bro
|
|
|
1535
1736
|
expect(record(cache?.with)["restore-keys"]).toBeUndefined();
|
|
1536
1737
|
if (!cache) throw new Error("Missing prebuild cache step");
|
|
1537
1738
|
expect(steps.indexOf(cache)).toBeLessThan(prepare);
|
|
1538
|
-
expect(cache?.if).toBe(name === "browser" ? "matrix.group == '
|
|
1539
|
-
expect(steps[prepare]?.if).toBe(name === "browser" ? "matrix.group == '
|
|
1739
|
+
expect(cache?.if).toBe(name === "browser" ? "matrix.group == 'runtime'" : undefined);
|
|
1740
|
+
expect(steps[prepare]?.if).toBe(name === "browser" ? "matrix.group == 'runtime'" : undefined);
|
|
1540
1741
|
}
|
|
1541
1742
|
});
|
|
1542
1743
|
|
|
@@ -1546,7 +1747,7 @@ test("package setup explicitly prepares Waffle after the script-free install", (
|
|
|
1546
1747
|
(step) => step.run === "bun packages/waffle-relay/scripts/prepare-native.ts",
|
|
1547
1748
|
);
|
|
1548
1749
|
const prepare = steps.findIndex((step) => step.run === "bun run prepare:package");
|
|
1549
|
-
const quality = steps.findIndex((step) => step.run === "bun run quality");
|
|
1750
|
+
const quality = steps.findIndex((step) => step.run === "bun run --cwd packages/waffle quality");
|
|
1550
1751
|
expect(prepare).toBeGreaterThan(native);
|
|
1551
1752
|
expect(prepare).toBeLessThan(quality);
|
|
1552
1753
|
const adapter = steps.findIndex(
|
|
@@ -1573,7 +1774,7 @@ test("translated network inputs and assets share every exact cache and only one
|
|
|
1573
1774
|
expect(selected("network", `packages/waffle/${path}`), path).toBe(true);
|
|
1574
1775
|
expect(selected("browser", `packages/waffle/${path}`), path).toBe(true);
|
|
1575
1776
|
}
|
|
1576
|
-
const producer = stepsFor("
|
|
1777
|
+
const producer = stepsFor("changes").find((step) => step.id === "network-artifact");
|
|
1577
1778
|
const key = String(record(producer?.with).key);
|
|
1578
1779
|
expect(key).toContain("network-wasm-v2-");
|
|
1579
1780
|
expect(key).toContain("tooling/network-translator/**");
|
|
@@ -1586,7 +1787,7 @@ test("translated network inputs and assets share every exact cache and only one
|
|
|
1586
1787
|
expect(record(cache.with).key).toBe(key);
|
|
1587
1788
|
for (const artifact of ["network.buffer.js", "network.buffer.sha256", "network.growth.json"])
|
|
1588
1789
|
expect(String(record(cache.with).path)).toContain(artifact);
|
|
1589
|
-
if (name === "
|
|
1790
|
+
if (name === "changes") continue;
|
|
1590
1791
|
expect(
|
|
1591
1792
|
steps.some(
|
|
1592
1793
|
(step) =>
|
|
@@ -1595,12 +1796,12 @@ test("translated network inputs and assets share every exact cache and only one
|
|
|
1595
1796
|
).toBe(false);
|
|
1596
1797
|
}
|
|
1597
1798
|
expect(
|
|
1598
|
-
stepsFor("
|
|
1799
|
+
stepsFor("changes").filter((step) => String(step.run).includes("build:network")),
|
|
1599
1800
|
).toHaveLength(1);
|
|
1600
1801
|
});
|
|
1601
1802
|
|
|
1602
1803
|
test("release, echo and xargs restore all translated artifacts under the producer key", async () => {
|
|
1603
|
-
const producer = stepsFor("
|
|
1804
|
+
const producer = stepsFor("changes").find((step) => step.id === "network-artifact");
|
|
1604
1805
|
const key = record(producer?.with).key;
|
|
1605
1806
|
for (const name of ["release", "coreutils-echo", "findutils-xargs"]) {
|
|
1606
1807
|
const source = await Bun.file(
|
|
@@ -1623,10 +1824,10 @@ test("release, echo and xargs restore all translated artifacts under the produce
|
|
|
1623
1824
|
});
|
|
1624
1825
|
|
|
1625
1826
|
test("compiler lifecycle and truly raw source proof run only in the network producer", () => {
|
|
1626
|
-
const producer = stepsFor("
|
|
1827
|
+
const producer = stepsFor("changes");
|
|
1627
1828
|
expect(producer.some((step) => String(step.run).includes("network-source-smoke.ts"))).toBe(true);
|
|
1628
1829
|
for (const [name, job] of Object.entries(jobs)) {
|
|
1629
|
-
if (name === "
|
|
1830
|
+
if (name === "changes" || !Array.isArray(record(job).steps)) continue;
|
|
1630
1831
|
expect(
|
|
1631
1832
|
stepsFor(name).some((step) =>
|
|
1632
1833
|
/network-source-smoke|network-translator.test/.test(String(step.run)),
|
|
@@ -1634,3 +1835,70 @@ test("compiler lifecycle and truly raw source proof run only in the network prod
|
|
|
1634
1835
|
).toBe(false);
|
|
1635
1836
|
}
|
|
1636
1837
|
});
|
|
1838
|
+
|
|
1839
|
+
test("change detection shares the network producer's runner and remains blocking", () => {
|
|
1840
|
+
expect(changes.needs).toBeUndefined();
|
|
1841
|
+
expect(paths?.["continue-on-error"]).toBe(true);
|
|
1842
|
+
expect(record(changes.outputs)["paths-result"]).toBe("${{ steps.paths.outcome }}");
|
|
1843
|
+
const steps = stepsFor("changes");
|
|
1844
|
+
expect(steps.filter((step) => step.uses === "actions/checkout@v4")).toHaveLength(1);
|
|
1845
|
+
expect(steps.findIndex((step) => step.id === "paths")).toBeLessThan(
|
|
1846
|
+
steps.findIndex((step) => step.id === "network-artifact"),
|
|
1847
|
+
);
|
|
1848
|
+
const validation = steps.find((step) => step.name === "Rust native, state and actual WASM tests");
|
|
1849
|
+
expect(validation?.if).toBe(
|
|
1850
|
+
"steps.network-artifact.outputs.cache-hit != 'true' || steps.paths.outputs.network == 'true' || steps.paths.outcome != 'success' || github.event_name == 'workflow_dispatch'",
|
|
1851
|
+
);
|
|
1852
|
+
const gate = record(jobs.gate);
|
|
1853
|
+
expect(gate.needs).toContain("changes");
|
|
1854
|
+
expect(gate.needs).not.toContain("network-wasm");
|
|
1855
|
+
expect(gate.name).toBe("Complete CI gate");
|
|
1856
|
+
const gateSteps = stepsFor("gate");
|
|
1857
|
+
const check = gateSteps.find((step) => step.name === "Require successful change detection");
|
|
1858
|
+
expect(record(check?.env).PATHS_RESULT).toBe("${{ needs.changes.outputs.paths-result }}");
|
|
1859
|
+
const reject = gateSteps.find((step) => step.name === "Reject failed or cancelled CI jobs");
|
|
1860
|
+
expect(gateSteps.indexOf(record(check))).toBeLessThan(gateSteps.indexOf(record(reject)));
|
|
1861
|
+
const outcomes = [
|
|
1862
|
+
["success", "success", 0],
|
|
1863
|
+
["failure", "success", 1],
|
|
1864
|
+
["cancelled", "success", 1],
|
|
1865
|
+
["success", "failure", 1],
|
|
1866
|
+
["success", "cancelled", 1],
|
|
1867
|
+
["success", "skipped", 1],
|
|
1868
|
+
["success", "", 1],
|
|
1869
|
+
["skipped", "", 1],
|
|
1870
|
+
[undefined, "", 1],
|
|
1871
|
+
] as const;
|
|
1872
|
+
for (const [producer, pathsResult, expected] of outcomes) {
|
|
1873
|
+
const command = Bun.spawnSync(
|
|
1874
|
+
["bash", "-eo", "pipefail", "-c", `${check?.run}\n${reject?.run}`],
|
|
1875
|
+
{
|
|
1876
|
+
env: {
|
|
1877
|
+
...process.env,
|
|
1878
|
+
PATHS_RESULT: pathsResult,
|
|
1879
|
+
BROWSER_REQUIRED: "false",
|
|
1880
|
+
RESULTS: JSON.stringify({
|
|
1881
|
+
changes: producer === undefined ? undefined : { result: producer },
|
|
1882
|
+
browser: { result: "skipped" },
|
|
1883
|
+
}),
|
|
1884
|
+
},
|
|
1885
|
+
},
|
|
1886
|
+
);
|
|
1887
|
+
expect(command.exitCode, `producer=${producer}, paths=${pathsResult}`).toBe(expected);
|
|
1888
|
+
}
|
|
1889
|
+
});
|
|
1890
|
+
|
|
1891
|
+
test("Complete CI requires actual success from the network producer", () => {
|
|
1892
|
+
const check = stepsFor("gate").find(
|
|
1893
|
+
(step) => step.name === "Require successful network preparation",
|
|
1894
|
+
);
|
|
1895
|
+
expect(record(check?.env).NETWORK_RESULT).toBe("${{ needs.changes.result }}");
|
|
1896
|
+
expect(check?.if).toBeUndefined();
|
|
1897
|
+
expect(check?.["continue-on-error"]).toBeUndefined();
|
|
1898
|
+
for (const result of ["success", "failure", "cancelled", "skipped", ""]) {
|
|
1899
|
+
const command = Bun.spawnSync(["bash", "-eo", "pipefail", "-c", String(check?.run)], {
|
|
1900
|
+
env: { ...process.env, NETWORK_RESULT: result },
|
|
1901
|
+
});
|
|
1902
|
+
expect(command.exitCode, result).toBe(result === "success" ? 0 : 1);
|
|
1903
|
+
}
|
|
1904
|
+
});
|