Commit 8fba3f8
fix(ci): drop ~/.cargo/bin from rust-cache to unbreak macOS (#2757)
## Problem
`test (macos)` started failing at the `Install wt` step. Stack:
```
[command]/Users/runner/.cargo/bin/cargo install worktrunk --force --root ... --version 0.49.0 --locked
error: error: unexpected argument 'install' found
Usage: rustup-init[EXE] [OPTIONS]
```
Run:
[25867040335](https://github.com/max-sixty/worktrunk/actions/runs/25867040335).
Same shape on a sibling PR run hours earlier
([25847613183](https://github.com/max-sixty/worktrunk/actions/runs/25847613183)),
so this is durable, not transient.
Root cause: the macos-15 runner image rolled to a new rustup release
some time around 2026-05-13 15:43Z (when `baptiste0928/cargo-install`'s
per-crate cache-key suffix shifted, e.g.
`cargo-install-worktrunk-0.49.0-280a63ff…` → `…-ec5a37f3…`).
`Swatinem/rust-cache@v2` caches `~/.cargo/bin`, which holds the rustup
proxy that backs `cargo`, `rustc`, etc. After the image update the
cached proxy is incompatible with the rest of the toolchain — invoked as
`cargo`, it falls through to `rustup-init`'s installer mode, so `cargo
install …` is rejected as unknown args.
Yesterday's main run
([4cfc8e6](https://github.com/max-sixty/worktrunk/actions/runs/25813800064))
hit the same poisoned cache but didn't expose it: `Install wt` was a
cache hit on the prior cargo-install key (`280a63ff`), so `cargo
install` never ran. Today, the new suffix (`ec5a37f3`) has no cache →
the action actually invokes `cargo install` → the broken proxy surfaces.
## Solution
Two changes in `.github/actions/test-setup/action.yaml`:
- `cache-bin: false` — stop caching `~/.cargo/bin`. The proxy binary is
part of the runner image and shouldn't be carried across image
generations. Our installed tools (`cargo-insta`, `cargo-nextest`,
`worktrunk`) go to `/Users/runner/.cargo-install/<crate>/bin/` via
`baptiste0928/cargo-install --root`, so nothing else here relies on
`~/.cargo/bin`.
- `prefix-key: v1-rust` — invalidates the existing `v0-rust-test-…`
caches, which already contain the bad bin. Without this, the next run
still restores the broken proxy.
Trade-off: one cache-miss rebuild per OS in test-setup (test
linux/macos/windows, collect-affected, affected-tests). Other workflows
(lint, feature-check, code-coverage, nightly, msrv) don't use test-setup
and keep their existing `v0-rust` caches untouched.
## Testing
Validated by this PR's own `test (macos)` run: with the new
`prefix-key`, the bad cache is bypassed and `cargo install worktrunk`
runs against the fresh runner-image rustup. Will monitor and report.
---
Automated fix for [failed run
25867040335](https://github.com/max-sixty/worktrunk/actions/runs/25867040335).
Co-authored-by: worktrunk-bot <worktrunk-bot@users.noreply.github.com>
Co-authored-by: Claude <noreply@anthropic.com>1 parent 941a2bf commit 8fba3f8
1 file changed
Lines changed: 10 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
24 | 34 | | |
25 | 35 | | |
26 | 36 | | |
| |||
0 commit comments