Skip to content

ci: fix macOS prepare_environment on stock GitHub runners#161

Merged
BunsDev merged 1 commit into
mainfrom
fix/ci-macos-prepare-env
May 27, 2026
Merged

ci: fix macOS prepare_environment on stock GitHub runners#161
BunsDev merged 1 commit into
mainfrom
fix/ci-macos-prepare-env

Conversation

@BunsDev

@BunsDev BunsDev commented May 27, 2026

Copy link
Copy Markdown
Member

Summary

Two cascading bugs were keeping every macOS CI job red since #155 moved off the warpdotdev runner pool.

1. script/macos/install_build_deps ran xcodebuild -downloadComponent against the default Xcode

-downloadComponent was added in Xcode 15.3. Stock macos-latest GitHub runners default to an older Xcode, and prepare_environment installs build deps before its setup-xcode@v1.7.0 step selects Xcode 26. Result: xcodebuild: error: invalid option '-downloadComponent' → exit 64 → the whole prepare_environment step fails → every downstream macOS step (clippy, tests, release-compile) errors out.

Fix: make script/macos/install_build_deps detect the specific "invalid option" error and silently skip when the current Xcode doesn't support -downloadComponent. The action has a second Install selected Xcode Metal toolchain step that runs the same command after setup-xcode swaps 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 deps

Even when callers pass install_test_deps: true, the macOS arm of the install-dependencies step only chose between install_cargo_release_deps and install_cargo_build_deps. Neither installs cargo-nextest, so Run MacOS tests blew up with error: no such command: nextest right after prepare_environment finished. The linux branch already had the install_test_deps switch; mirror it for macOS.

Test plan

  • Formatting + Clippy (MacOS) passes (was: exit 64 on xcodebuild -downloadComponent)
  • Run MacOS tests actually runs nextest (was: no such command: nextest)
  • Verify compilation with release flags (MacOS) passes
  • Linux/Windows/wasm CI is unaffected

🤖 Generated with Claude Code

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>
Copilot AI review requested due to automatic review settings May 27, 2026 09:54

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_deps to skip xcodebuild -downloadComponent when the active Xcode doesn’t support that flag (avoiding early CI failures before setup-xcode runs).
  • Update prepare_environment composite action so macOS honors install_test_deps by installing cargo test dependencies (including cargo-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
@BunsDev BunsDev merged commit e3d3fa2 into main May 27, 2026
22 of 26 checks passed
@BunsDev BunsDev deleted the fix/ci-macos-prepare-env branch May 30, 2026 09:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants