Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,8 @@ jobs:

build:
name: Build
needs: changes
# Release checks is not a required check; a release whose checks fail must fail this one so it cannot merge.
needs: [changes, release-checks]
# A skipped required check passes, so a broken change detection must fail it instead.
if: ${{ !cancelled() && (needs.changes.result != 'success' || needs.changes.outputs.code == 'true' || needs.changes.outputs.cli_bundle == 'true' || needs.changes.outputs.release_only == 'true') }}
runs-on: ubuntu-latest
Expand All @@ -335,6 +336,11 @@ jobs:
run: |
echo "::error::Detect changes did not succeed (it also rejects large binaries outside LFS); see its log. This required check cannot pass."
exit 1
- name: Require the release checks
if: needs.changes.outputs.release_diff == 'true' && needs.release-checks.result != 'success'
run: |
echo "::error::Release checks did not succeed (${{ needs.release-checks.result }}); see that job. A release with stale notes or mixed versions cannot merge."
exit 1
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
with:
lfs: true
Expand Down
19 changes: 19 additions & 0 deletions scripts/ci/release-only-diff.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { mkdirSync, mkdtempSync, readFileSync, writeFileSync } from "node:fs";
import { tmpdir } from "node:os";
import { dirname, join } from "node:path";
import { test } from "node:test";
import { parse } from "yaml";
import { classify } from "./release-only-diff.mjs";

const SCRIPT = new URL("./release-only-diff.mjs", import.meta.url).pathname;
Expand Down Expand Up @@ -282,6 +283,24 @@ test("--verify refuses manifests that move from different versions", () => {
assert.match(run(root, "--verify").stderr, /move from different versions: 0\.8\.1, 0\.8\.0/);
});

// fails without the fix: Release checks is not a required check, so the queue merged v0.9.82 and v0.9.83 while it
// failed on notes that missed a PR merged after the cut.
test("a release whose checks fail cannot merge: the required Build fails with them", () => {
const ci = parse(
readFileSync(new URL("../../.github/workflows/ci.yml", import.meta.url), "utf8"),
);
const build = ci.jobs.build;
assert.equal(build.name, "Build");
assert.ok([build.needs].flat().includes("release-checks"), "Build waits for the release checks");
const gate = build.steps.find((step) =>
/needs\.release-checks\.result != 'success'/.test(step.if ?? ""),
);
assert.ok(gate, "Build has a step that fails when the release checks did not succeed");
assert.match(gate.if, /needs\.changes\.outputs\.release_diff == 'true'/);
assert.match(gate.run, /exit 1/);
assert.equal(build.steps.indexOf(gate), 1, "it fails before Build spends time building");
});

test("the merge queue runs the release checks on a release diff", () => {
const ci = readFileSync(new URL("../../.github/workflows/ci.yml", import.meta.url), "utf8");
assert.match(ci, /release-checks:[\s\S]*merge_group[\s\S]*release_diff/);
Expand Down
Loading