Skip to content

ci: fix macOS rustup cache corruption in install-rust action#357

Open
GuillaumeLagrange wants to merge 1 commit into
mainfrom
fix-ci-rustup-macos
Open

ci: fix macOS rustup cache corruption in install-rust action#357
GuillaumeLagrange wants to merge 1 commit into
mainfrom
fix-ci-rustup-macos

Conversation

@GuillaumeLagrange
Copy link
Copy Markdown
Contributor

@GuillaumeLagrange GuillaumeLagrange commented May 16, 2026

Switch the install-rust composite action back to rustup toolchain install and disable cache-bin on the rust-cache step for macOS.

macOS lint jobs were failing with:

error: unexpected argument 'fmt' found
Usage: rustup-init[EXE] [OPTIONS]

Two compounding causes:

  • rustup show was used to materialize the toolchain pinned in rust-toolchain.toml. Per the rustup 1.28 release notes, rustup show no longer auto-installs the active toolchain — the documented replacement is rustup toolchain install (with no arguments). Behavior was partially restored in 1.28.1 behind RUSTUP_AUTO_INSTALL, so relying on rustup show is fragile across runner image updates.
  • Swatinem/rust-cache caches ~/.cargo/bin by default. On macOS, the cache had been saved on a runner with a different rustup version; on restore it overwrote the freshly-installed cargo proxy with a stale rustup-init binary, which is why cargo fmt/cargo clippy reported Usage: rustup-init[EXE].

This matches the pattern tokio uses (tokio-rs/tokio CI): install the toolchain first, then run rust-cache with cache-bin: false on macOS only.

Tested with 10 runs of just the macos lint

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented May 16, 2026

Merging this PR will not alter performance

⚠️ Unknown Walltime execution environment detected

Using the Walltime instrument on standard Hosted Runners will lead to inconsistent data.

For the most accurate results, we recommend using CodSpeed Macro Runners: bare-metal machines fine-tuned for performance measurement consistency.

✅ 7 untouched benchmarks


Comparing fix-ci-rustup-macos (0d87670) with main (149a618)

Open in CodSpeed

Switch back to `rustup toolchain install` (the rustup-documented way to
install the toolchain pinned by rust-toolchain.toml across rustup 1.28+
versions) and disable `cache-bin` on macOS.

Caching ~/.cargo/bin caused macOS jobs to fail with
`error: unexpected argument 'fmt' found / Usage: rustup-init[EXE]`:
rust-cache was restoring a stale cargo proxy from a runner with a
different rustup version, overwriting the proxy installed in this run
and leaving cargo behaving like rustup-init.

Co-Authored-By: Claude <noreply@anthropic.com>
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