@@ -147,24 +147,37 @@ jobs:
147147 name : kasumi-proxy
148148 authToken : ${{ secrets.CACHIX_AUTH_TOKEN }}
149149
150- # ── Cache the cargo registry + workspace build artifacts. The compile of
151- # clippy --all-targets + test + codegen (hundreds of crates: tauri, specta,
152- # webkit bindings) is the bulk of this job; an empty target means a full
153- # rebuild every run. Keyed on the toolchain pin (flake.lock) + the locked
154- # deps (Cargo.lock); restore-keys give the previous target on a lock bump so
155- # only the changed crates recompile. The devshell sets no CARGO_HOME /
156- # CARGO_TARGET_DIR, so cargo uses ~/.cargo and ./target on the host. ──
157- - name : Cache cargo + build
150+ # ── Cargo registry — dependency sources only, no compiled artifacts, so it's
151+ # portable across toolchain bumps and keyed on Cargo.lock alone. ──
152+ - name : Cache cargo registry
158153 uses : actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4
159154 with :
160155 path : |
161156 ~/.cargo/registry/index
162157 ~/.cargo/registry/cache
163158 ~/.cargo/git/db
164- target
165- key : cargo-${{ runner.os }}-${{ hashFiles('flake.lock', 'Cargo.lock') }}
159+ key : cargo-registry-${{ runner.os }}-${{ hashFiles('Cargo.lock') }}
160+ restore-keys : |
161+ cargo-registry-${{ runner.os }}-
162+
163+ # ── Workspace build artifacts (./target). The compile of clippy --all-targets +
164+ # test + codegen (hundreds of crates: tauri, specta, webkit bindings) is the
165+ # bulk of this job; an empty target means a full rebuild every run. But the
166+ # build-script binaries under target are linked against the devshell's glibc,
167+ # so a target restored from a different flake.lock points its ELF interpreter
168+ # at a /nix/store loader that's no longer there and fails to exec ("No such
169+ # file or directory"). So the key AND the restore fallback are both bound to
170+ # flake.lock: a Cargo.lock-only bump still reuses target (only the changed
171+ # crates recompile), but a flake.lock/toolchain bump starts clean instead of
172+ # restoring a poisoned target. The devshell sets no CARGO_HOME /
173+ # CARGO_TARGET_DIR, so cargo uses ~/.cargo and ./target on the host. ──
174+ - name : Cache cargo build
175+ uses : actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4
176+ with :
177+ path : target
178+ key : cargo-target-${{ runner.os }}-${{ hashFiles('flake.lock') }}-${{ hashFiles('Cargo.lock') }}
166179 restore-keys : |
167- cargo-${{ runner.os }}-
180+ cargo-target- ${{ runner.os }}-${{ hashFiles('flake.lock') }}-
168181
169182 - name : Stub the libcronet bundle resource (clippy/codegen build the app)
170183 run : |
0 commit comments