From 9a9cd9d1d32f881c38129cf803626dea97999fdb Mon Sep 17 00:00:00 2001 From: Austin Schaefer Date: Wed, 16 Sep 2026 15:22:30 +0200 Subject: [PATCH] Stop caching target/ and fix sccache's per-run cache key MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- .forgejo/workflows/ci.yml | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/.forgejo/workflows/ci.yml b/.forgejo/workflows/ci.yml index 7be5fc9..3774cde 100644 --- a/.forgejo/workflows/ci.yml +++ b/.forgejo/workflows/ci.yml @@ -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 }}-