@decohere/ci-tools 0.0.1-dev.20261123.379 → 0.0.1-dev.20261123.404

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 CHANGED
@@ -3,15 +3,15 @@
3
3
  Node scripts the repo's GitHub workflows and root `package.json` scripts run. Plain `.mjs`, run from source with `node`. One folder per job, under `src/`:
4
4
 
5
5
  - `audit/`: summarize `npm audit`, fail on findings (`enforce`), and open or close the audit issue (`upsert-issue`). Run by CI (`ci.yml`) and the nightly `npm-audit.yml`.
6
- - `badges/`: the CI status badge (`ci-status`). Run by `pages.yml`, `bench.yml` and `clear-benchmark-history.yml`.
6
+ - `badges/`: main's status badge (`ci-status`, from Publish's last run on `main`). Run by `pages.yml`, `bench.yml` and `clear-benchmark-history.yml`.
7
7
  - `bench/`: build benchmarks (`pnpm bench`, `pnpm bench:save`, `pnpm perf:trace`), and the nightly run and its regression issues. Run by `bench.yml`.
8
8
  - `changeset/`: changeset status and changelog scripts behind `pnpm changeset:check` and `pnpm version:aggregate`. No workflow runs them.
9
9
  - `coverage/`: the coverage report (`pnpm test:coverage:report`) and its badge, run by `pages.yml`.
10
10
  - `github/`: GitHub and npm checks (`ensure-metadata` is used by `publish-verify`): `first-publish-check` (CI), `publish-verify` (`publish.yml`), `failure-report` (the `failure-report` action, used by `ci.yml` and `clear-benchmark-history.yml`), and `npm-bootstrap` (`pnpm npm:bootstrap`, run by hand).
11
11
  - `lib/`: what the scripts share: SVG badges, LCOV parsing, GitHub issues, the workspace's packages. Nothing runs it directly.
12
12
  - `pages/`: the GitHub Pages site (badges, bench history, the artifact). Run by `pages.yml`, `bench.yml` and `clear-benchmark-history.yml`.
13
- - `release/`: publishing: `check-patch-release`, `find-publish-base` and `restamp-build` (`publish.yml`), `promote-latest` (`promote-latest.yml`, the "Promote to latest" workflow), and `publish-to-temporary-registry` (the `verify-release` action).
13
+ - `release/`: publishing: `check-patch-release`, `find-publish-base` and `restamp-build` (`publish.yml`), `tested-build` (the CI run whose build ships a commit: the merge queue's on `main`; `publish.yml` and `pages.yml`), `promote-latest` (`promote-latest.yml`, the "Promote to latest" workflow), and `publish-to-temporary-registry` (the `verify-release` action).
14
14
 
15
15
  ## Working on this package
16
16
 
17
- Tests are in `tests/`, in folders named like the `src/` folders they test: `*.test.mjs` and, under `release/`, `*.spec.ts`. `pnpm test` runs both. `tests/github/ci-workflow.test.mjs` and `publish-workflow.test.mjs` check the workflow files themselves. There is no canonical suite for ci-tools in the [testing table](../../docs/contributing/testing/README.md#canonical-suite-ownership).
17
+ Most tests are in `tests/`, in folders named like the `src/` folders they test: `*.test.mjs` and, under `release/`, `*.spec.ts`. New specs sit beside their code, as `release/tested-build.service.spec.ts` does ([ADR 0027](../../docs/contributing/adr/0027-code-design.md)). `pnpm test` runs them all. `tests/github/ci-workflow.test.mjs` and `publish-workflow.test.mjs` check the workflow files themselves. There is no canonical suite for ci-tools in the [testing table](../../docs/contributing/testing/README.md#canonical-suite-ownership).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@decohere/ci-tools",
3
- "version": "0.0.1-dev.20261123.379",
3
+ "version": "0.0.1-dev.20261123.404",
4
4
  "description": "CI utility scripts for badge generation, coverage reporting, pages artifact assembly, and GitHub API tooling",
5
5
  "keywords": [
6
6
  "typescript",
@@ -11,9 +11,11 @@ if (repo == null || token == null) {
11
11
  throw new Error("GITHUB_REPOSITORY and GITHUB_TOKEN are required");
12
12
  }
13
13
 
14
- const workflowFileName = "ci.yml";
14
+ // CI doesn't run on main: the merge queue tests each commit before it lands, and Publish ships it.
15
+ // So main's state is whether Publish's last run passed.
16
+ const workflowFileName = "publish.yml";
15
17
 
16
- const branches = [{ branch: "main", label: "CI Main", file: "ci-main.svg" }];
18
+ const branches = [{ branch: "main", label: "Main", file: "ci-main.svg" }];
17
19
 
18
20
  async function getLatestWorkflowRun(branch) {
19
21
  const url =
@@ -3,10 +3,10 @@
3
3
  * Points npm's `latest` tag at a version on every public @decohere package. Run by
4
4
  * `promote-latest.yml`, which authenticates over OIDC.
5
5
  *
6
- * Refuses a version that isn't on every package, has no `v*` tag (a version only gets one once it
7
- * passed CI and fully shipped), or is under a day old, unless `allowYoung` is set: current pnpm
8
- * skips versions that new and would install an older one. Safe to re-run: packages already there
9
- * are skipped.
6
+ * With no version, takes what `dev` points at. Refuses a version that isn't on every package, has
7
+ * no `v*` tag on origin (a version only gets one once it passed CI and fully shipped), or is under
8
+ * a day old, unless `allowYoung` is set: current pnpm skips versions that new and would install an
9
+ * older one. Safe to re-run: packages already there are skipped.
10
10
  */
11
11
  import { spawnSync } from "node:child_process";
12
12
  import { resolve } from "node:path";
@@ -35,8 +35,11 @@ export function promoteLatest(options) {
35
35
  const log = options.log ?? console.log;
36
36
  const npm = (...args) => run("npm", args);
37
37
 
38
- const version =
39
- options.version?.trim() || npm("view", LAUNCH_PACKAGE, "dist-tags.dev").stdout.trim();
38
+ /** `npm dist-tag ls` reads fresh; `npm view` can lag for a minute or more after a move. */
39
+ const distTag = (name, tag) =>
40
+ new RegExp(`^${tag}: (.+)$`, "m").exec(npm("dist-tag", "ls", name).stdout)?.[1]?.trim();
41
+
42
+ const version = options.version?.trim() || distTag(LAUNCH_PACKAGE, "dev");
40
43
  if (!version) {
41
44
  log(`Could not read the dev tag of ${LAUNCH_PACKAGE}. Nothing moved.`);
42
45
  return 1;
@@ -44,14 +47,20 @@ export function promoteLatest(options) {
44
47
  log(`Promoting ${version} to latest on ${packages.length} packages`);
45
48
 
46
49
  // Once a stable version is out, latest belongs to releases: see "Stable release" in docs/contributing/ci.
47
- const current = /^latest: (.+)$/m.exec(npm("dist-tag", "ls", LAUNCH_PACKAGE).stdout)?.[1];
50
+ const current = distTag(LAUNCH_PACKAGE, "latest");
48
51
  if (current != null && !current.includes("-") && version.includes("-")) {
49
52
  log(`latest is the stable ${current}, and ${version} is a dev version. Nothing moved.`);
50
53
  return 1;
51
54
  }
52
55
 
53
- const tag = run("git", ["tag", "--list", `v${version}`]).stdout.trim();
54
- if (tag !== `v${version}`) {
56
+ // Asks origin: the workflow's checkout is shallow and holds only the tip commit's tags.
57
+ const ref = `refs/tags/v${version}`;
58
+ const remote = run("git", ["ls-remote", "--tags", "origin", ref]);
59
+ if (remote.status !== 0) {
60
+ log("Could not read the tags on origin. Nothing moved.");
61
+ return 1;
62
+ }
63
+ if (!remote.stdout.split("\n").some((line) => line.split("\t")[1] === ref)) {
55
64
  log(`${version} has no v${version} tag, so it didn't fully ship. Nothing moved.`);
56
65
  return 1;
57
66
  }
@@ -84,13 +93,7 @@ export function promoteLatest(options) {
84
93
  }
85
94
  }
86
95
 
87
- /** `npm dist-tag ls` reads fresh; `npm view` can lag for a minute or so after a move. */
88
- const onLatest = (name) => {
89
- const line = npm("dist-tag", "ls", name)
90
- .stdout.split("\n")
91
- .find((entry) => entry.startsWith("latest:"));
92
- return line?.slice("latest:".length).trim() === version;
93
- };
96
+ const onLatest = (name) => distTag(name, "latest") === version;
94
97
 
95
98
  const failed = [];
96
99
  for (const name of packages) {
@@ -0,0 +1,41 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Prints the id of the CI run whose release build ships a commit (see tested-build.service.mjs).
4
+ * Exits 1 with a reason when there's none: Publish ships only what CI tested, never a new build.
5
+ *
6
+ * GH_TOKEN=… GITHUB_REPOSITORY=owner/repo node tested-build.command.mjs <sha> <event>[,<event>…]
7
+ */
8
+ import { pathToFileURL } from "node:url";
9
+ import { TestedBuildError } from "./tested-build.error.mjs";
10
+ import { TestedBuild } from "./tested-build.service.mjs";
11
+
12
+ if (import.meta.url === pathToFileURL(process.argv[1]).href) {
13
+ const [sha, events] = process.argv.slice(2);
14
+ const repo = process.env.GITHUB_REPOSITORY;
15
+ const token = process.env.GH_TOKEN ?? process.env.GITHUB_TOKEN;
16
+ const base = process.env.GITHUB_API_URL ?? "https://api.github.com";
17
+ if (!sha || !events || !repo || !token) {
18
+ console.error(
19
+ "Usage: GH_TOKEN=… GITHUB_REPOSITORY=owner/repo tested-build.command.mjs <sha> <event>[,<event>…]",
20
+ );
21
+ process.exit(1);
22
+ }
23
+
24
+ const api = async (path) => {
25
+ const response = await fetch(`${base}/${path}`, {
26
+ headers: { Authorization: `Bearer ${token}`, Accept: "application/vnd.github+json" },
27
+ });
28
+ if (!response.ok) throw new Error(`GitHub answered ${response.status} to GET ${path}`);
29
+ return response.json();
30
+ };
31
+
32
+ try {
33
+ const found = await new TestedBuild({ repo, api }).find(sha, events.split(","));
34
+ console.error(`Tested by ${found.url} (${found.event})`);
35
+ console.log(found.runId);
36
+ } catch (error) {
37
+ if (!(error instanceof TestedBuildError)) throw error;
38
+ console.error(`::error::${error.message}`);
39
+ process.exit(1);
40
+ }
41
+ }
@@ -0,0 +1,8 @@
1
+ /** There's no tested build to ship for a commit: no CI run passed for it, or its build is gone. */
2
+ export class TestedBuildError extends Error {
3
+ /** @param {string} message */
4
+ constructor(message) {
5
+ super(message);
6
+ this.name = "TestedBuildError";
7
+ }
8
+ }
@@ -0,0 +1,114 @@
1
+ /**
2
+ * Finds the CI run that tested a commit and holds its release build, `forge-release-beta-<run id>`,
3
+ * so Publish ships what was tested instead of building again. On `main` that's the merge queue's
4
+ * run: the queue tests the exact commit that lands. A patch branch's is its push run.
5
+ */
6
+ import { TestedBuildError } from "./tested-build.error.mjs";
7
+
8
+ /** How each event's run is named in a message. */
9
+ const WHERE = {
10
+ merge_group: "the merge queue",
11
+ push: "a push",
12
+ workflow_dispatch: "a run started by hand",
13
+ };
14
+
15
+ /**
16
+ * @typedef {{ id: number, status: string, conclusion: string | null, html_url: string }} WorkflowRun
17
+ * @typedef {{ runId: number, event: string, url: string }} Found
18
+ */
19
+
20
+ export class TestedBuild {
21
+ /**
22
+ * @param {{
23
+ * repo: string,
24
+ * api: (path: string) => Promise<any>,
25
+ * now?: () => number,
26
+ * wait?: (ms: number) => Promise<void>,
27
+ * log?: (message: string) => void,
28
+ * patienceMs?: number,
29
+ * pollMs?: number,
30
+ * }} options
31
+ */
32
+ constructor(options) {
33
+ this.repo = options.repo;
34
+ this.api = options.api;
35
+ this.now = options.now ?? Date.now;
36
+ this.wait = options.wait ?? ((ms) => new Promise((resolve) => setTimeout(resolve, ms)));
37
+ this.log = options.log ?? console.error;
38
+ // The queue merges as soon as the `ci` job passes, a moment before its run is marked done.
39
+ this.patienceMs = options.patienceMs ?? 10 * 60_000;
40
+ this.pollMs = options.pollMs ?? 15_000;
41
+ }
42
+
43
+ /**
44
+ * @param {string} sha the commit to ship
45
+ * @param {string[]} events the CI events whose runs count, in the order to try them
46
+ * @returns {Promise<Found>}
47
+ */
48
+ async find(sha, events) {
49
+ /** @type {string[]} */
50
+ const notes = [];
51
+ for (const event of events) {
52
+ const deadline = this.now() + this.patienceMs;
53
+ for (;;) {
54
+ const runs = await this.runs(sha, event);
55
+ const passed = runs.find((run) => run.conclusion === "success");
56
+ if (passed != null) return this.withBuild(sha, passed, event);
57
+ const running = runs.filter((run) => run.status !== "completed");
58
+ if (running.length === 0) {
59
+ notes.push(
60
+ ...runs.map((run) => `${run.html_url} (${run.conclusion ?? run.status})`),
61
+ );
62
+ break;
63
+ }
64
+ if (this.now() >= deadline) {
65
+ notes.push(...running.map((run) => `${run.html_url} (still running)`));
66
+ break;
67
+ }
68
+ this.log(`Waiting for ${running.map((run) => run.html_url).join(", ")} to finish`);
69
+ await this.wait(this.pollMs);
70
+ }
71
+ }
72
+ const where = events.map((event) => WHERE[event] ?? event).join(" or ");
73
+ const queue = events.includes("merge_group")
74
+ ? " A commit reaches main without one when the merge queue is bypassed (an admin merge or a direct push). Land the change through a pull request and the merge queue."
75
+ : "";
76
+ const runs = notes.length > 0 ? ` Runs for it: ${notes.join(", ")}.` : "";
77
+ throw new TestedBuildError(
78
+ `No CI run in ${where} passed for ${sha}, so there's no tested build to ship. Nothing was published.${queue}${runs}`,
79
+ );
80
+ }
81
+
82
+ /**
83
+ * @private
84
+ * @returns {Promise<WorkflowRun[]>} newest first
85
+ */
86
+ async runs(sha, event) {
87
+ const page = await this.api(
88
+ `repos/${this.repo}/actions/workflows/ci.yml/runs?head_sha=${sha}&event=${event}&per_page=100`,
89
+ );
90
+ return page.workflow_runs ?? [];
91
+ }
92
+
93
+ /**
94
+ * @private
95
+ * @param {string} sha
96
+ * @param {WorkflowRun} run
97
+ * @param {string} event
98
+ * @returns {Promise<Found>}
99
+ */
100
+ async withBuild(sha, run, event) {
101
+ const name = `forge-release-beta-${run.id}`;
102
+ const page = await this.api(
103
+ `repos/${this.repo}/actions/runs/${run.id}/artifacts?name=${name}`,
104
+ );
105
+ const build = (page.artifacts ?? []).find((artifact) => artifact.name === name);
106
+ if (build == null || build.expired) {
107
+ const why = build == null ? `has no build ${name}` : `its build ${name} has expired`;
108
+ throw new TestedBuildError(
109
+ `CI run ${run.html_url} passed for ${sha}, but ${why}: CI keeps a build 14 days. Nothing was published.`,
110
+ );
111
+ }
112
+ return { runId: run.id, event, url: run.html_url };
113
+ }
114
+ }
@@ -8,6 +8,12 @@ describe("ci.yml and the merge queue", () => {
8
8
  const yml = fs.readFileSync(CI_YML, "utf8");
9
9
  const triggers = yml.slice(yml.indexOf("\non:"), yml.indexOf("\nconcurrency:"));
10
10
  const gate = yml.slice(yml.indexOf("- id: gate"), yml.indexOf("# Static gates"));
11
+ const jobs = yml.slice(yml.indexOf("\njobs:"));
12
+ /** A job's heading: its needs, `if` and outputs, up to its steps. */
13
+ const heading = (job) => {
14
+ const start = jobs.indexOf(`\n ${job}:`);
15
+ return jobs.slice(start, jobs.indexOf("steps:", start));
16
+ };
11
17
 
12
18
  it("runs for queued pull requests, or the queue waits forever for the required check", () => {
13
19
  expect(triggers).toMatch(/^\s+merge_group:/m);
@@ -17,19 +23,31 @@ describe("ci.yml and the merge queue", () => {
17
23
  expect(gate).toContain('"${{ github.event_name }}" == "merge_group"');
18
24
  });
19
25
 
20
- it("runs the whole suite on a patch branch, whose commits weren't tested on main", () => {
21
- const jobs = yml.slice(yml.indexOf("\njobs:"));
22
- expect(triggers).toContain('branches: [main, "release/**"]');
23
- for (const job of ["coverage", "build", "verify-release"]) {
24
- const start = jobs.indexOf(`\n ${job}:`);
25
- expect(jobs.slice(start, jobs.indexOf("runs-on:", start)), job).toContain(
26
- "startsWith(github.ref, 'refs/heads/release/')",
27
- );
26
+ it("runs nothing on a push to main: the queue tested that same commit, and Publish ships its build", () => {
27
+ expect(triggers).toContain('branches: ["release/**"]');
28
+ expect(triggers).not.toMatch(/branches: \[.*\bmain\b/);
29
+ expect(jobs).not.toContain("refs/heads/main");
30
+ });
31
+
32
+ it("makes the full run in the queue, on a patch branch, and when started by hand", () => {
33
+ const full = gate.slice(0, gate.indexOf('echo "full=true"'));
34
+ expect(full).toContain('"${{ github.event_name }}" == "merge_group"');
35
+ expect(full).toContain('"${{ github.event_name }}" == "workflow_dispatch"');
36
+ expect(full).toContain("refs/heads/release/");
37
+ expect(heading("changes")).toContain("full: ${{ steps.gate.outputs.full }}");
38
+ });
39
+
40
+ it("builds, verifies the release, and runs coverage and Docker tests in the full run", () => {
41
+ for (const job of ["build", "verify-release", "coverage", "test-docker"]) {
42
+ expect(heading(job), job).toContain("needs.changes.outputs.full == 'true'");
28
43
  }
29
44
  });
30
45
 
46
+ it("runs the unit test shards only outside the full run, where coverage runs the same tests", () => {
47
+ expect(heading("test")).toContain("needs.changes.outputs.full != 'true'");
48
+ });
49
+
31
50
  it("makes the required check wait for every job, so a failing job can't be missed", () => {
32
- const jobs = yml.slice(yml.indexOf("\njobs:"));
33
51
  const names = [...jobs.matchAll(/^ {2}([a-z-]+):$/gm)].map((match) => match[1]);
34
52
  const needs = /^ {2}ci:\n {4}needs: \[(.+)\]$/m.exec(jobs)?.[1].split(", ");
35
53
 
@@ -39,3 +57,49 @@ describe("ci.yml and the merge queue", () => {
39
57
  );
40
58
  });
41
59
  });
60
+
61
+ describe("the release build passed between jobs", () => {
62
+ const workflows = ["ci.yml", "publish.yml"].map((name) => ({
63
+ name,
64
+ yml: fs.readFileSync(
65
+ fileURLToPath(new URL(`../../../../.github/workflows/${name}`, import.meta.url)),
66
+ "utf8",
67
+ ),
68
+ }));
69
+
70
+ // upload-artifact leaves hidden files out by default. The scaffolder's templates are mostly
71
+ // dot-files (.devcontainer, .github, .vscode), so without them every new app would lack them,
72
+ // and Publish ships what verify-release tested: the uploaded build.
73
+ it("keeps its hidden files, such as the scaffolder's .devcontainer templates", () => {
74
+ const uploads = workflows.flatMap(({ name, yml }) =>
75
+ [...yml.matchAll(/uses: actions\/upload-artifact@\S+\n {8}with:\n((?: {10}.*\n)+)/g)]
76
+ .map((match) => ({ name, step: match[1] }))
77
+ .filter(({ step }) => /path: dist\/release\//.test(step)),
78
+ );
79
+ expect(uploads.map(({ name }) => name).toSorted()).toEqual(["ci.yml", "publish.yml"]);
80
+ for (const { name, step } of uploads) {
81
+ expect(step, name).toMatch(/include-hidden-files: true/);
82
+ }
83
+ });
84
+ });
85
+
86
+ describe("pages.yml", () => {
87
+ const yml = fs.readFileSync(
88
+ fileURLToPath(new URL("../../../../.github/workflows/pages.yml", import.meta.url)),
89
+ "utf8",
90
+ );
91
+ const on = yml.slice(yml.indexOf("\non:"), yml.indexOf("\nconcurrency:"));
92
+
93
+ it("deploys on a push to main, without waiting for a CI run there", () => {
94
+ expect(on).toMatch(/push:\n\s+branches: \[main\]/);
95
+ expect(yml).not.toContain("workflow_run");
96
+ });
97
+
98
+ it("takes the coverage the merge queue measured for that commit", () => {
99
+ expect(yml).toContain('tested-build.command.mjs "$SHA" merge_group');
100
+ const download = yml.slice(yml.indexOf("name: coverage-data"));
101
+ expect(download.slice(0, download.indexOf("path:"))).toContain(
102
+ "run-id: ${{ steps.tested.outputs.run_id }}",
103
+ );
104
+ });
105
+ });
@@ -47,13 +47,59 @@ describe("publish.yml", () => {
47
47
  expect(guard).not.toContain("HEAD^1");
48
48
  });
49
49
 
50
- it("only releases a patch whose commit passed full CI", () => {
50
+ it("only releases a patch whose commit passed full CI on its branch", () => {
51
51
  const guard = yml.slice(yml.indexOf("\n guard:"), yml.indexOf("\n release-build:"));
52
+ const find = guard.indexOf('tested-build.command.mjs "$sha" "$events"');
52
53
 
53
- expect(guard).toContain("event=push&status=success");
54
- expect(guard.indexOf("git/ref/heads/")).toBeLessThan(
55
- guard.indexOf("event=push&status=success"),
54
+ expect(find).toBeGreaterThan(-1);
55
+ expect(guard).toMatch(/if \[\[ -n "\$PATCH_BRANCH" \]\]; then\n\s+events=push\n/);
56
+ expect(guard.indexOf("git/ref/heads/")).toBeLessThan(find);
57
+ });
58
+
59
+ it("releases a tested version from the queue's build, or main's for a version from before", () => {
60
+ const guard = yml.slice(yml.indexOf("\n guard:"), yml.indexOf("\n release-build:"));
61
+
62
+ expect(guard).toMatch(/else\n\s+events=merge_group,push\n/);
63
+ });
64
+
65
+ it("starts on a push to main, not when a CI run finishes", () => {
66
+ const on = yml.slice(0, yml.indexOf("workflow_dispatch:"));
67
+
68
+ expect(on).toMatch(/push:\n\s+branches: \[main\]/);
69
+ expect(yml).not.toContain("workflow_run");
70
+ });
71
+
72
+ it("ships the build the merge queue tested for this same commit", () => {
73
+ const guard = yml.slice(yml.indexOf("\n guard:"), yml.indexOf("\n release-build:"));
74
+ const queue = guard.slice(guard.indexOf("- name: Find the merge queue's build"));
75
+
76
+ expect(queue).toContain("if: steps.check.outputs.should_publish == 'true'");
77
+ expect(queue).toContain('tested-build.command.mjs "$SHA" merge_group');
78
+ expect(guard).toContain(
79
+ "build_run_id: ${{ steps.release.outputs.build_run_id || steps.queue.outputs.run_id }}",
80
+ );
81
+ });
82
+
83
+ it("gives the guard longer than the wait for a queue run that's still finishing", () => {
84
+ const guard = yml.slice(yml.indexOf("\n guard:"), yml.indexOf("\n release-build:"));
85
+ const minutes = Number(/timeout-minutes: (\d+)/.exec(guard)?.[1]);
86
+ const service = fs.readFileSync(
87
+ fileURLToPath(new URL("../../src/release/tested-build.service.mjs", import.meta.url)),
88
+ "utf8",
56
89
  );
90
+ const patience = Number(/patienceMs \?\? (\d+) \* 60_000/.exec(service)?.[1]);
91
+
92
+ expect(patience).toBeGreaterThan(0);
93
+ expect(minutes).toBeGreaterThan(patience);
94
+ });
95
+
96
+ it("refuses a commit with no tested build rather than building one", () => {
97
+ const queue = yml.slice(yml.indexOf("- name: Find the merge queue's build"));
98
+
99
+ expect(queue.slice(0, queue.indexOf("\n - "))).not.toContain("continue-on-error");
100
+ // Only CI stamps and builds. A stable release only changes the version of a tested build.
101
+ expect(yml).not.toMatch(/forge [^\n]*\bbuild --configuration/);
102
+ expect(yml).not.toMatch(/forge [^\n]*\bversion --channel/);
57
103
  });
58
104
 
59
105
  it("reads a patch's tested version from its build", () => {
@@ -76,7 +122,7 @@ describe("publish.yml", () => {
76
122
  const guard = yml.slice(yml.indexOf("\n guard:"), yml.indexOf("\n release-build:"));
77
123
 
78
124
  expect(on).toContain("branches: [main]");
79
- expect(guard).toContain("head_branch == 'main'");
125
+ expect(guard).toContain("github.ref == 'refs/heads/main'");
80
126
  });
81
127
 
82
128
  it("only tags a version once npm and the images have shipped", () => {