gate: key sccache's cache on Cargo.toml and build.rs only

clippy records clippy.toml in its dep-info, so sccache already sees it.
The one setting sccache leaves out is --check-cfg, declared in Cargo.toml
lints and build scripts. Correct the comment and README.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
FredAppsandClaude Opus 5.5 committed 2026-11-11 13:57:21 +01:00
1 parent 89b1e8c6ba
commit e59a0c94ab
2 files changed
+9 -8

No files matched your search

+6 -5
View File
@@ -79,7 +79,7 @@ on:
required: false
default: true
sccache:
description: "Also cache the workspace crates' compiled libraries (which rust-cache leaves out) with sccache in the GitHub Actions cache. It writes where the dependency cache is saved (pushes to the default branch, opted-in manual runs); other runs read those entries. SCCACHE_GHA_RW_MODE in `env` overrides that. Test executables are never cached. Its cache starts afresh when cache-version or a Cargo.toml, build.rs or clippy.toml changes; bump cache-version when files a procedural macro reads change (see the README)"
description: "Also cache the workspace crates' compiled libraries (which rust-cache leaves out) with sccache in the GitHub Actions cache. It writes where the dependency cache is saved (pushes to the default branch, opted-in manual runs); other runs read those entries. SCCACHE_GHA_RW_MODE in `env` overrides that. Test executables are never cached. Its cache starts afresh when cache-version, a Cargo.toml or a build.rs changes; bump cache-version when files a procedural macro reads change (see the README)"
type: boolean
required: false
default: false
@@ -283,10 +283,11 @@ jobs:
shell: bash
env:
WRITES: ${{ github.event_name != 'pull_request' && (github.ref_name == github.event.repository.default_branch || (inputs.cache-save-on-dispatch && github.event_name == 'workflow_dispatch')) }}
# sccache's key leaves out lint settings that only change diagnostics (`--check-cfg`,
# clippy.toml), so a cached compile would replay its old warnings. A change to the files
# that declare them, or to cache-version, starts a fresh sccache cache instead.
VERSION: ${{ inputs.cache-version }}-${{ hashFiles('**/Cargo.toml', '**/build.rs', '**/clippy.toml', '**/.clippy.toml') }}
# sccache leaves `--check-cfg` out of its key, so after a change to the expected cfgs a
# cached compile would replay its old `unexpected_cfgs` warnings. A change to the files
# that declare them (Cargo.toml lints, build scripts), or to cache-version, starts a
# fresh sccache cache instead.
VERSION: ${{ inputs.cache-version }}-${{ hashFiles('**/Cargo.toml', '**/build.rs') }}
run: |
echo "SCCACHE_GHA_ENABLED=true" >> "$GITHUB_ENV"
echo "RUSTC_WRAPPER=sccache" >> "$GITHUB_ENV"