ci: fix macOS prepare_environment on stock GitHub runners#161
Merged
Conversation
Two cascading bugs were keeping every macOS job red since the runner-pool migration in #155: 1. **`script/macos/install_build_deps` ran `xcodebuild -downloadComponent MetalToolchain` against whatever Xcode the runner image shipped with.** Stock `macos-latest` defaults to an Xcode older than 15.3, which doesn't know `-downloadComponent` and exits with code 64. The prepare_environment action installs build deps *before* its `setup-xcode@v1.7.0` step selects Xcode 26, so the script always hit the older Xcode in CI. Make the script resilient: try the command, and if Xcode rejects the option, log a note and continue. The action's later `Install selected Xcode Metal toolchain` step runs the same command after `setup-xcode` and is where the toolchain actually gets pulled in for stock CI. Self-hosted runners keep this script path with their own pre-selected Xcode. 2. **`prepare_environment`'s macOS branch never called `install_cargo_test_deps`.** Even when callers passed `install_test_deps: true`, the macOS branch only chose between `install_cargo_release_deps` and `install_cargo_build_deps`, neither of which installs cargo-nextest. The linux branch already had the test-deps switch; mirror it for macOS so `Run MacOS tests` no longer fails with "no such command: nextest". No behavioural changes for Linux / Windows / wasm. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes macOS CI failures on stock GitHub-hosted runners by making Metal toolchain installation resilient to older default Xcodes and by ensuring macOS installs test-time Rust tooling when requested.
Changes:
- Update
script/macos/install_build_depsto skipxcodebuild -downloadComponentwhen the active Xcode doesn’t support that flag (avoiding early CI failures beforesetup-xcoderuns). - Update
prepare_environmentcomposite action so macOS honorsinstall_test_depsby installing cargo test dependencies (includingcargo-nextest).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
script/macos/install_build_deps |
Adds guarded execution around xcodebuild -downloadComponent to avoid failing on older default Xcode versions. |
.github/actions/prepare_environment/action.yml |
Ensures macOS installs cargo test deps when install_test_deps is true (matching Linux behavior). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+12
to
+17
| # safe for stock CI. Self-hosted runners hit this script with their | ||
| # own Xcode pre-selected and the call should succeed there. | ||
| if out=$(xcodebuild -downloadComponent MetalToolchain 2>&1); then | ||
| printf '%s\n' "$out" | ||
| elif printf '%s' "$out" | grep -q "invalid option '-downloadComponent'"; then | ||
| echo "xcodebuild -downloadComponent unsupported by current Xcode; skipping (CI retries after setup-xcode)." |
Comment on lines
+101
to
+105
| # The linux branch below already handles this; macOS used | ||
| # to fall through to install_cargo_build_deps, which doesn't | ||
| # install nextest -- so `cargo nextest run` blew up later | ||
| # with "no such command: nextest". | ||
| ./script/install_cargo_test_deps |
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.
Summary
Two cascading bugs were keeping every macOS CI job red since #155 moved off the warpdotdev runner pool.
1.
script/macos/install_build_depsranxcodebuild -downloadComponentagainst the default Xcode-downloadComponentwas added in Xcode 15.3. Stockmacos-latestGitHub runners default to an older Xcode, andprepare_environmentinstalls build deps before itssetup-xcode@v1.7.0step selects Xcode 26. Result:xcodebuild: error: invalid option '-downloadComponent'→ exit 64 → the wholeprepare_environmentstep fails → every downstream macOS step (clippy, tests, release-compile) errors out.Fix: make
script/macos/install_build_depsdetect the specific "invalid option" error and silently skip when the current Xcode doesn't support-downloadComponent. The action has a secondInstall selected Xcode Metal toolchainstep that runs the same command aftersetup-xcodeswaps in Xcode 26, so the toolchain still gets installed for stock CI. Self-hosted runners keep using this script with their own pre-selected Xcode and the command should succeed there.2.
prepare_environment's macOS branch never installed test depsEven when callers pass
install_test_deps: true, the macOS arm of the install-dependencies step only chose betweeninstall_cargo_release_depsandinstall_cargo_build_deps. Neither installs cargo-nextest, soRun MacOS testsblew up witherror: no such command: nextestright afterprepare_environmentfinished. The linux branch already had theinstall_test_depsswitch; mirror it for macOS.Test plan
Formatting + Clippy (MacOS)passes (was: exit 64 onxcodebuild -downloadComponent)Run MacOS testsactually runs nextest (was:no such command: nextest)Verify compilation with release flags (MacOS)passes🤖 Generated with Claude Code