Repository navigation
ci: gate macOS runners on draft + path relevance - #1594
Merged
Merged
Conversation
The three macos-14 jobs cost ~10x a Linux runner minute and previously ran on every non-docs push/PR. Gate them behind a draft-PR check and per-category path-relevance flags computed by a fail-closed, base-ref classifier (the same anti-tamper discipline as docs-only-changes.sh): - smoke-darwin-arm64 + managed-temp-macos gate on macos_go (irrelevant: docs, user-docs/, website/, sdk/typescript/) - sdk-macos-spawn gates on macos_sdk (irrelevant: docs, user-docs/, website/ — Go changes are relevant since the SDK spawns mecated) All three also skip on draft PRs. The existing docs_only guard is retained. Adds unit + workflow-wiring tests, wired into the race-contracts step. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Measuring the darwin+freebsd build/test closure of what the three macos-14 jobs actually build and test shows ~25 root-module packages sit outside it — a Go change confined to them cannot alter the darwin build or darwin tests, so running the (10x-cost) macOS jobs for them catches nothing. Extend the macos-relevant-changes.sh "irrelevant" allowlist with the terminal leaf directories that no macOS-job binary or test imports: cmd/mecademo, cmd/mecak8s, cmd/mecatequi, examples/, perf/, e2e/, deploy/, docs/lint/. This is a SOUND narrowing with zero coverage loss (skipped builds would be byte-identical), unlike gating on darwin build tags. Guard against fail-open drift with macos-closure-guard.sh: it recomputes the closure via `go list -deps` and fails CI if any allowlisted directory ever enters it, and cross-checks that the guard and classifier name the same dirs. Wired into the build job (needs resolved modules); the offline classifier and wiring tests cover the rest. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
actionlint's embedded shellcheck flags SC2129 now that the classify step
writes three outputs; the added macos_go/macos_sdk echoes turned the single
docs_only redirect into three. Group them into one `{ ...; } >> "$GITHUB_OUTPUT"`
(the house fix, per release.yml), and update the wiring test's literal
assertions to the grouped form.
Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Merged
2 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Gate the three
macos-14jobs inci.yml— which cost ~10× a Linux runner minute — behind draft-PR and path-relevance flags, so they no longer run on every non-docs push/PR regardless of what changed.Extends the repository's existing trusted-classifier idiom (
docs-only-changes.sh+ thechangesjob) rather than addingon:-levelpaths:filters (those would break required status checks).Why
ci.ymlpreviously gated the macOS jobs only ondocs_only != 'true', so any non-docs change ran all three on Apple-silicon runners — including draft PRs and changes that could not possibly affect them (e.g. a TypeScript-SDK-only or website-only change still ran the native Go darwin smokes). macOS is the single most expensive per-minute runner class in this repo.Changes
New scripts
.github/scripts/macos-relevant-changes.sh— fail-closed classifier mirroringdocs-only-changes.sh. Printstrue(RUN) unless it can prove every changed path is irrelevant. Two categories:go— irrelevant: docs,user-docs/,website/,sdk/typescript/(used bysmoke-darwin-arm64,managed-temp-macos).sdk— irrelevant: docs,user-docs/,website/only (the SDK spawnsmecated, so Go changes are relevant too; used bysdk-macos-spawn)..github/scripts/macos-relevant-changes_test.sh— offline unit tests (fail-closed, rename-boundary, and shell-injection-safety cases)..github/scripts/macos-relevant-workflow_test.sh— asserts the wiring stays correct (fail-closed defaults, base-ref extraction ordering, draft gate on all three jobs, exactly-3-macos-jobs tripwire).ci.ymlchangesjob emits newmacos_go/macos_sdkoutputs, computed from the base ref's classifier — same anti-tamper property asdocs_only(a PR cannot edit the classifier to skip a job it should run until it merges; fail-closed to RUN on any failure or missing script).smoke-darwin-arm64+managed-temp-macosgate onmacos_go;sdk-macos-spawngates onmacos_sdk. All three additionally skip on draft PRs. The existingdocs_only != 'true'guard is retained as the outer safety.docs_onlysemantics are untouched (it feeds many other jobs).Expected savings
Safety
This extends an
if:pattern these jobs already rely on (they skip on docs-only PRs today), so branch protection already tolerates them skipping — no required-check/aggregator changes needed.Verification
bash .github/scripts/macos-relevant-changes_test.sh— all checks passbash .github/scripts/macos-relevant-workflow_test.sh— all checks passbash .github/scripts/docs-only-changes_test.sh/docs-only-workflow_test.sh— still pass (unchanged semantics)ci.ymlparses as valid YAML