Skip to content

Commit 8fba3f8

Browse files
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

File tree

.github/actions/test-setup/action.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,16 @@ runs:
2121

2222
- name: 💰 Cache
2323
uses: Swatinem/rust-cache@v2
24+
with:
25+
# Don't cache ~/.cargo/bin. The runner-image rustup binary acts as
26+
# the cargo/rustc/rustup proxy; restoring a stale copy on top of a
27+
# new image leaves the proxy resolving as `rustup-init`, breaking
28+
# `cargo install` (only exposed when the install is a cache miss).
29+
# Tools we need are installed via baptiste0928/cargo-install into a
30+
# separate `--root`, so nothing else in here relies on ~/.cargo/bin.
31+
cache-bin: false
32+
# Bumped to invalidate caches that already include the stale bin.
33+
prefix-key: v1-rust
2434

2535
- name: Install shells (zsh, fish) - Ubuntu
2636
if: runner.os == 'Linux'

0 commit comments

Comments
 (0)