From 6ee21a094105f004fdb1e2af5a12b891bd00f145 Mon Sep 17 00:00:00 2001 From: rUv Date: Wed, 3 Jun 2026 09:12:26 +0200 Subject: [PATCH] ci: use Swatinem/rust-cache for the Rust workspace job (reliability) (#925) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The Rust Workspace Tests job manually cached the whole `v2/target` via actions/cache@v4. For a 38-crate workspace that dir is multi-GB, and several CI runs this cycle intermittently died at the cache/setup step (after toolchain install, before "Run Rust tests"), each needing a rerun. Swatinem/rust-cache@v2 is the de-facto standard Rust CI cache: it caches the cargo registry/git + a pruned target, evicts stale dependencies, and restores large workspaces far more reliably and faster than a naive whole-target cache. `workspaces: v2` points it at the v2/ cargo workspace. Reliability/speed change — verified by observing subsequent main runs. --- .github/workflows/ci.yml | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b213d44a..0e76d4f6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -108,16 +108,18 @@ jobs: - name: Install Rust toolchain uses: dtolnay/rust-toolchain@stable - - name: Cache cargo - uses: actions/cache@v4 + # Swatinem/rust-cache replaces a naive `actions/cache` of the whole + # `v2/target`. That manual cache of a 38-crate target dir (multi-GB) was an + # intermittent failure source — several CI runs this cycle died at the + # cache/setup step (after toolchain install, before "Run Rust tests"), + # needing a rerun. rust-cache is purpose-built for Rust: it caches the + # registry + git + a pruned target, evicts stale deps, and restores far more + # reliably (and faster) on large workspaces. `workspaces: v2` points it at + # the v2/ cargo workspace (keys on v2/Cargo.lock, caches v2/target). + - name: Cache cargo (Swatinem/rust-cache) + uses: Swatinem/rust-cache@v2 with: - path: | - ~/.cargo/registry - ~/.cargo/git - v2/target - key: ${{ runner.os }}-cargo-${{ hashFiles('v2/Cargo.lock') }} - restore-keys: | - ${{ runner.os }}-cargo- + workspaces: v2 - name: Run Rust tests working-directory: v2