ci: optional compile-only pull request runs, and fail-fast merge groups
Nothing changes when this merges. It adds a switch, off by default, that lets pull requests run compile admission only and leaves the full macOS suite to the merge queue.
Why
Last 7 days of ci.yml pull-request runs: 1,111 runs for about 230 merges (74 succeeded, 433 failed, 604 cancelled by a newer push). About 80% of Mac time, roughly 53,000 Mac-minutes a week, goes to commits that never merge (shares estimated from 25 sampled runs per bucket).
A merge queue runs CI again on every queued pull request, so with today's workflow each macOS pull request would pay for the full suite twice. With compile-only, a merged pull request costs one full suite on the commit that lands plus about 21 Mac-minutes per push: about today's spend, and main can no longer break from two pull requests that each passed alone.
The cost: test failures show up when a pull request is queued, not on each push, and a flaky shard now costs a queue slot.
Summary
- Switch: repository variable
CI_PULL_REQUEST_SUITE=compile-onlymakes pull requests skip the app-host shards, package tests, lag build and Release build. Merge groups and dispatches always run everything. Unset (today), pull requests run everything. - Opt back in: the
full-cilabel restores the full suite for one pull request; labels are read live, so label and re-run. - Fails safe: unreadable labels, an unknown value or a missing output all mean full suite. The
testsgate accepts a skipped suite only whenfull_suiteis explicitlyfalse. - Fail-fast merge groups: the shard matrix fails fast, and a new
merge-group-fail-fast.ymlcancels a merge group's run at the first failed job so the queue drops it without waiting on the remaining Macs. It needsactions: write, so it runs fromworkflow_runon the default branch's copy (a queued pull request cannot edit it), checks out nothing, and uses a GitHub-hosted runner.ci.ymlgets no write permission.
Rollout (maintainers)
- Admin-merge #13114, then merge this.
- Together: set
CI_PULL_REQUEST_SUITE=compile-only, create thefull-cilabel, and add "Require merge queue" to the ruleset "main: block force-push or delete" (squash, status check timeout 360 min, merge limits min 1 / max 5, build concurrency 3, only merge non-failing pull requests). - Back out by deleting the variable. Do not set the variable without the queue: macOS changes would merge on compile admission alone.
Testing
tests/test_ci_change_areas.py(Python 3.9 and 3.12): runs the realtestsgate script against compile-only, full, failed and missing-output inputs, covers the policy for every event, and asserts the fail-fast job never checks out code and is not aci-statusdependency. Pass.test_ci_self_hosted_guard.sh,test_ci_merge_queue_required_checks.py,test_ci_reusable_workflow_permissions.py,actionlint: pass.- The watcher's step script against a stubbed
gh: failure on the second page of jobs (cancels), completed run (exits), API down (errors after ten tries). - Not exercised on a real merge group: the queue is off.
Related: #13095
🤖 Generated with Claude Code