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
14 changes: 8 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
name: CI

# No push trigger: the merge queue already validated the exact tree that lands
# on master or develop. The daily full runs keep those branches' caches warm.
on:
push:
branches: [master, develop]
pull_request:
merge_group:
# Full validation also runs without a change filter, including quiet periods.
Expand Down Expand Up @@ -443,7 +443,9 @@ jobs:
arm64-backend:
name: ARM64 Backend Test
needs: changes
if: always() && (needs.changes.result != 'success' || needs.changes.outputs.rust == 'true')
# Platform jobs run in merge groups and full runs, not on pull requests.
# They almost never fail alone; dispatch ci.yml on a branch to run them.
if: always() && github.event_name != 'pull_request' && (needs.changes.result != 'success' || needs.changes.outputs.rust == 'true')
runs-on: ubuntu-26.04-arm
steps:
- uses: actions/checkout@v7
Expand Down Expand Up @@ -480,7 +482,7 @@ jobs:
napi-windows:
name: NAPI Build (Windows)
needs: changes
if: always() && (needs.changes.result != 'success' || needs.changes.outputs.napi == 'true')
if: always() && github.event_name != 'pull_request' && (needs.changes.result != 'success' || needs.changes.outputs.napi == 'true')
runs-on: windows-latest
steps:
- uses: actions/checkout@v7
Expand Down Expand Up @@ -516,7 +518,7 @@ jobs:
napi-linux-arm64:
name: NAPI Build (Linux ARM64 GNU)
needs: changes
if: always() && (needs.changes.result != 'success' || needs.changes.outputs.napi_arm64 == 'true')
if: always() && github.event_name != 'pull_request' && (needs.changes.result != 'success' || needs.changes.outputs.napi_arm64 == 'true')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
Expand Down Expand Up @@ -603,7 +605,7 @@ jobs:
js-windows:
name: JS Test (Windows)
needs: [changes, napi-windows]
if: always() && (needs.changes.result != 'success' || needs.changes.outputs.javascript == 'true')
if: always() && github.event_name != 'pull_request' && (needs.changes.result != 'success' || needs.changes.outputs.javascript == 'true')
runs-on: windows-latest
steps:
- uses: actions/checkout@v7
Expand Down
15 changes: 5 additions & 10 deletions .github/workflows/sync-develop.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
name: Sync Develop

on:
push:
branches: [master]
pull_request_target:
types: [closed]
branches: [develop]
# Sync once a day rather than on every master push. Each update re-runs the
# synchronization pull request's CI, and develop only needs master daily.
# This runs early enough to merge before the develop full CI at 02:43 UTC.
schedule:
- cron: "7 22 * * *"
workflow_dispatch:

concurrency:
Expand All @@ -17,11 +17,6 @@ permissions: {}
jobs:
sync:
name: Merge master into develop
if: >-
github.event_name != 'pull_request_target' ||
(github.event.pull_request.merged == true &&
github.event.pull_request.head.ref == 'integration/master-to-develop' &&
github.event.pull_request.head.repo.full_name == github.repository)
runs-on: ubuntu-latest
env:
SYNC_BRANCH: integration/master-to-develop
Expand Down
17 changes: 16 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,22 @@ minimum safety net, not the definition of validation completeness.

## CI coverage and cadence

Pull requests and pushes use `scripts/ci-changes.mjs` to select jobs:
Pull requests and merge groups use `scripts/ci-changes.mjs` to select jobs.
Each change is validated where it matters rather than repeatedly:

- Pull requests run the Linux jobs (lint, Rust tests, Linux and WASI NAPI, JS
on Ubuntu, Playground). Windows NAPI/JS and the ARM64 NAPI and backend jobs
are skipped there, which their required checks accept, and run in the merge
group instead. They rarely fail when the Linux jobs pass. Dispatch `ci.yml` on
a branch to run them before queueing.
- The merge group validates the exact tree that lands, so pushes to `master` and
`develop` do not run CI again. Daily full runs keep those branches' build
caches current for pull requests.
- `sync-develop.yml` opens or updates the master-to-develop synchronization pull
request once a day (22:07 UTC) rather than on every master push. Dispatch it
to sync sooner.

Job selection:

- Rust tests, benches, the common test suite, benchmark crates, VPI, the separate
wasm binding crate, and lydite retain Rust checks without triggering NAPI and
Expand Down
20 changes: 7 additions & 13 deletions scripts/check-sync-branch-head.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,17 @@ const guard = fileURLToPath(
new URL("./check-sync-branch-head.sh", import.meta.url),
);

test("sync workflow retries after its preserved pull request lands", () => {
// A daily run also retries after a preserved (hand-resolved) synchronization
// lands, without re-syncing, and re-running its CI, on every master push.
test("sync workflow runs daily instead of on every master push", () => {
const workflow = readFileSync(
new URL("../.github/workflows/sync-develop.yml", import.meta.url),
"utf8",
);
assert.match(
workflow,
/pull_request_target:\n\s+types: \[closed\]\n\s+branches: \[develop\]/,
);
assert.match(
workflow,
/github\.event\.pull_request\.head\.ref == 'integration\/master-to-develop'/,
);
assert.match(
workflow,
/github\.event\.pull_request\.head\.repo\.full_name == github\.repository/,
);
const triggers = workflow.match(/^on:\n([\s\S]*?)\n\S/m)[1];
assert.match(triggers, /schedule:\n\s+- cron: "7 22 \* \* \*"/);
assert.match(triggers, /workflow_dispatch:/);
assert.doesNotMatch(triggers, /^\s+(push|pull_request_target):/m);
});

test("sync branch guard preserves unresolved branch work", (t) => {
Expand Down
27 changes: 27 additions & 0 deletions scripts/ci-workflow.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,33 @@ test("artifact consumers wait for their producer rather than the Rust test gate"
assert.match(browser, /name: napi-wasm32-wasi/);
});

test("landed commits are not re-validated by a push run", () => {
const triggers = workflow.match(/^on:\n([\s\S]*?)\n\S/m)[1];
assert.doesNotMatch(triggers, /^\s+push:/m);
assert.match(triggers, /^\s+merge_group:/m);
assert.match(triggers, /^\s+schedule:/m);
});

test("platform jobs run in merge groups and full runs, not on pull requests", () => {
const platform = [
"arm64-backend",
"napi-windows",
"napi-linux-arm64",
"js-windows",
];
for (const name of platform) {
assert.match(
job(name),
/\n if: always\(\) && github\.event_name != 'pull_request' && \(/,
name,
);
}
// Linux jobs still give pull requests their feedback.
for (const name of ["lint", "rust-tests", "napi-linux", "js-ubuntu", "rust"]) {
assert.doesNotMatch(job(name), /github\.event_name != 'pull_request'/, name);
}
});

test("full runs on long-lived branches report every job's result", () => {
const report = job("report-full-validation");
const jobs = [...workflow.split(/^jobs:\n/m)[1].matchAll(/^ ([\w-]+):\n/gm)]
Expand Down
Loading