ci(windows): align rust cache save key with restore key (arch + v5)

The save action wrote windows-rust-Windows-v3-<lock> with no arch while
restore fanned out on windows-rust-Windows-<arch>-v4-<lock> — so every
saved entry was unreachable by design. It also made the two matrix legs
race to reserve the same key: ARM won, x64 got 'another job may be
creating this cache'. Save now uses the exact restore key (arch + v5);
restore falls back only to same-arch v5 prefixes to avoid pulling the
stale archless v3 entries into the wrong build.
This commit is contained in:
2026-10-20 02:39:30 +03:00
Unverified
parent 913bded394
commit efd8ec0fb4
2 changed files with 8 additions and 4 deletions
@@ -16,8 +16,7 @@ runs:
~/.cargo/registry
~/.cargo/git
app/desktop/windows-setup/target
key: windows-rust-${{ runner.os }}-${{ runner.arch }}-v4-${{ hashFiles('app/desktop/windows-setup/Cargo.lock') }}
key: windows-rust-${{ runner.os }}-${{ runner.arch }}-v5-${{ hashFiles('app/desktop/windows-setup/Cargo.lock') }}
restore-keys: |
windows-rust-${{ runner.os }}-${{ runner.arch }}-v4-
windows-rust-${{ runner.os }}-${{ runner.arch }}-v3-
windows-rust-${{ runner.os }}-${{ runner.arch }}-v5-
cargo-registry-${{ runner.os }}-
@@ -4,10 +4,15 @@ description: Save Cargo registry, git checkouts, and the windows-setup target di
runs:
using: composite
steps:
# The save key MUST match cache-windows-rust-tools' exact restore key byte for byte: it has to
# carry runner.arch — the two matrix legs race to save the same key otherwise (actions/cache
# rejects the second with "another job may be creating this cache"), and a saved entry without
# the arch can never be restored because no restore key matches its shape. v3 was an archless
# relic: every entry it ever wrote was dead on arrival.
- uses: actions/cache/save@v5
continue-on-error: true
with:
key: windows-rust-${{ runner.os }}-v3-${{ hashFiles('app/desktop/windows-setup/Cargo.lock') }}
key: windows-rust-${{ runner.os }}-${{ runner.arch }}-v5-${{ hashFiles('app/desktop/windows-setup/Cargo.lock') }}
path: |
~/.cargo/registry
~/.cargo/git