fix(ci): unbreak macOS by disabling rust-cache bin caching#165
Merged
Conversation
Swatinem/rust-cache's default cache-clean step poisons ~/.cargo/bin under rustup 1.28's multicall binary layout — `cargo` ends up restored as `rustup-init`, breaking `maturin`'s `cargo metadata` call on macos-latest. Set cache-bin: false and bump prefix-key to evict the existing poisoned caches. See: Swatinem/rust-cache#16
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
The
Python Tests (macos-latest / Python 3.13)job has been failing on every master push since the Swatinem rust-cache action's saved~/.cargo/bin/got poisoned (master run 25851399868, master run 25845951470).uv sync --extra devruns maturin →cargo metadata, and macOS responds with:i.e. the cached
cargoproxy is dispatching asrustup-init.Root cause
Two upstream behaviours compose into the failure:
cargo,rustc,rustup,rustup-initare hardlinks/symlinks to the same executable, dispatching byargv[0].Swatinem/rust-cache@v2caches~/.cargo/bin/by default and runs a "cache clean" pass that mutates the directory. Under the rustup 1.28 layout, restoring the cached bin dir overwrites the freshly-installed multicall binary with a stalerustup-init, breaking thecargoproxy.The action's README documents this exact failure mode under "Known Issues" and recommends
cache-bin: falseas the fix. References:cargoandrustupget deleted when saving cacheFix
Two inputs added to every
Swatinem/rust-cache@v2invocation in.github/workflows/ci.yml(5 jobs:lint,rust-test,rust-test-postgres,rust-test-redis,test):cache-bin: false— stop caching~/.cargo/bin/.dtolnay/rust-toolchain@stablereinstalls the proxies in <5 s on every run; there is no meaningful cache-hit benefit from including the bin dir, and the failure class is eliminated.prefix-key: v1-rust-bin-fix— bumps the cache key so the existingv0-*caches (which contain the poisoned macOS bin dir) are evicted. Without this the very next run would still restore the broken cache before the newcache-bin: falsedirective applies on save.Applied to all five call sites (not only the macOS-affected
testjob) for consistency and to immunize the Linux/Windows runners against the same regression when their runner images rotate to rustup 1.28.The valuable caches (
target/,~/.cargo/registry/,~/.cargo/git/db/) are unaffected.Test plan
Python Tests (macos-latest / Python 3.13)andPython Tests (macos-latest / Python 3.10)completeuv sync --extra dev, the maturin build, andpytest tests/ -v.gh cache list --ref refs/heads/mastershows new entries starting withv1-rust-bin-fix-…after the post-merge run.