Stop caching target/ and fix sccache's per-run cache key
target/ was the majority of the ~1.5GB cache each of the 5 CI jobs tarred and uploaded on every run — expensive on a single runner where those uploads contend for the same disk/network, and pointless since these jobs build different feature-set combinations into one identically-keyed target dir anyway. sccache already gives compiler- level reuse without that duplication. sccache's cache key was keyed to github.run_id, which never gets an exact hit, so its ~377MB also re-uploaded in full every single run with no benefit. Key it to Cargo.lock like the registry cache instead, so it only re-saves when dependencies actually change. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
parent
ef37690473
commit
9a9cd9d1d3
1 changed files with 9 additions and 13 deletions
|
|
@ -24,7 +24,6 @@ jobs:
|
|||
path: |
|
||||
~/.cargo/registry
|
||||
~/.cargo/git
|
||||
target
|
||||
key: cargo-${{ runner.os }}-${{ hashFiles('**/Cargo.lock') }}
|
||||
restore-keys: |
|
||||
cargo-${{ runner.os }}-
|
||||
|
|
@ -33,10 +32,11 @@ jobs:
|
|||
uses: actions/cache@v4
|
||||
with:
|
||||
path: /root/.cache/sccache
|
||||
# Not keyed to Cargo.lock: sccache caches individual compiler
|
||||
# invocations by content hash, so it should accumulate across
|
||||
# dependency bumps rather than reset like the target/ cache above.
|
||||
key: sccache-${{ runner.os }}-${{ github.run_id }}
|
||||
# Keyed to Cargo.lock, not github.run_id: a per-run key never
|
||||
# gets an exact hit, so actions/cache re-uploads the full
|
||||
# sccache dir on every single run even when nothing changed.
|
||||
# This still refreshes whenever dependencies bump.
|
||||
key: sccache-${{ runner.os }}-${{ hashFiles('**/Cargo.lock') }}
|
||||
restore-keys: |
|
||||
sccache-${{ runner.os }}-
|
||||
|
||||
|
|
@ -54,7 +54,6 @@ jobs:
|
|||
path: |
|
||||
~/.cargo/registry
|
||||
~/.cargo/git
|
||||
target
|
||||
key: cargo-${{ runner.os }}-${{ hashFiles('**/Cargo.lock') }}
|
||||
restore-keys: |
|
||||
cargo-${{ runner.os }}-
|
||||
|
|
@ -63,7 +62,7 @@ jobs:
|
|||
uses: actions/cache@v4
|
||||
with:
|
||||
path: /root/.cache/sccache
|
||||
key: sccache-${{ runner.os }}-${{ github.run_id }}
|
||||
key: sccache-${{ runner.os }}-${{ hashFiles('**/Cargo.lock') }}
|
||||
restore-keys: |
|
||||
sccache-${{ runner.os }}-
|
||||
|
||||
|
|
@ -81,7 +80,6 @@ jobs:
|
|||
path: |
|
||||
~/.cargo/registry
|
||||
~/.cargo/git
|
||||
target
|
||||
key: cargo-${{ runner.os }}-${{ hashFiles('**/Cargo.lock') }}
|
||||
restore-keys: |
|
||||
cargo-${{ runner.os }}-
|
||||
|
|
@ -90,7 +88,7 @@ jobs:
|
|||
uses: actions/cache@v4
|
||||
with:
|
||||
path: /root/.cache/sccache
|
||||
key: sccache-${{ runner.os }}-${{ github.run_id }}
|
||||
key: sccache-${{ runner.os }}-${{ hashFiles('**/Cargo.lock') }}
|
||||
restore-keys: |
|
||||
sccache-${{ runner.os }}-
|
||||
|
||||
|
|
@ -115,7 +113,6 @@ jobs:
|
|||
path: |
|
||||
~/.cargo/registry
|
||||
~/.cargo/git
|
||||
target
|
||||
key: cargo-${{ runner.os }}-${{ hashFiles('**/Cargo.lock') }}
|
||||
restore-keys: |
|
||||
cargo-${{ runner.os }}-
|
||||
|
|
@ -124,7 +121,7 @@ jobs:
|
|||
uses: actions/cache@v4
|
||||
with:
|
||||
path: /root/.cache/sccache
|
||||
key: sccache-${{ runner.os }}-${{ github.run_id }}
|
||||
key: sccache-${{ runner.os }}-${{ hashFiles('**/Cargo.lock') }}
|
||||
restore-keys: |
|
||||
sccache-${{ runner.os }}-
|
||||
|
||||
|
|
@ -143,7 +140,6 @@ jobs:
|
|||
path: |
|
||||
~/.cargo/registry
|
||||
~/.cargo/git
|
||||
target
|
||||
key: cargo-${{ runner.os }}-${{ hashFiles('**/Cargo.lock') }}
|
||||
restore-keys: |
|
||||
cargo-${{ runner.os }}-
|
||||
|
|
@ -152,7 +148,7 @@ jobs:
|
|||
uses: actions/cache@v4
|
||||
with:
|
||||
path: /root/.cache/sccache
|
||||
key: sccache-${{ runner.os }}-${{ github.run_id }}
|
||||
key: sccache-${{ runner.os }}-${{ hashFiles('**/Cargo.lock') }}
|
||||
restore-keys: |
|
||||
sccache-${{ runner.os }}-
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue