From 15ded3a5bd6cc1748785e64af3d4f77d6054a934 Mon Sep 17 00:00:00 2001 From: rob thijssen Date: Thu, 16 Apr 2026 09:44:45 +0300 Subject: [PATCH] ci: cache target/, disable incremental, drop redundant build Three complementary tweaks to close the gap sccache alone can't: - CARGO_INCREMENTAL=0: reclaims the 17 incremental-mode cache misses per run and prevents cargo from writing incremental fingerprints that defeat sccache. Incremental mode is useless in CI anyway since each run starts from scratch. - actions/cache for ~/.cargo and target/: sidesteps sccache's structural limits (proc-macro non-cacheables, clippy-vs-rustc separate namespaces) by caching the whole build output keyed on Cargo.lock. Also caches ~/.cargo/bin so the installed sccache binary survives between runs. - Drop the separate 'cargo build' step: 'cargo test --workspace' builds everything anyway, so the standalone build was a full redundant workspace compile pass. Co-Authored-By: Claude Opus 4.6 (1M context) --- .gitea/workflows/ci.yml | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index c62fe1b..7d1b0c8 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -8,6 +8,7 @@ on: branches: [main] env: + CARGO_INCREMENTAL: "0" RUSTC_WRAPPER: sccache SCCACHE_BUCKET: sccache SCCACHE_ENDPOINT: http://caveman.kosherinata.internal:9000 @@ -23,6 +24,19 @@ jobs: steps: - uses: actions/checkout@v4 + - name: Cache cargo registry and target + uses: actions/cache@v4 + with: + path: | + ~/.cargo/bin + ~/.cargo/registry/index + ~/.cargo/registry/cache + ~/.cargo/git/db + target + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} + restore-keys: | + ${{ runner.os }}-cargo- + - name: Ensure sccache with S3 support env: RUSTC_WRAPPER: "" @@ -39,9 +53,6 @@ jobs: - name: Clippy run: cargo clippy --workspace -- -D warnings - - name: Build - run: cargo build --workspace - - name: Test run: cargo test --workspace