mirror of
https://github.com/nearai/ironclaw.git
synced 2026-09-03 08:06:01 +08:00
ci: share rust-cache across clippy matrix legs (#2610)
* ci: share rust-cache across clippy matrix legs The three clippy matrix entries (all-features, default, libsql-only) each had a distinct cache key, so each leg maintained its own multi-GB target/ in the GitHub Actions cache. GHA caps repo cache at 10 GB and evicts LRU, so these three near-duplicates crowd out other useful entries and forced each leg to re-warm after eviction. Switch to shared-key: clippy for the Linux matrix and shared-key: clippy-windows for the Windows matrix. Whichever leg finishes (and saves) first wins the slot; the other two restore from that cache on the next run. Because --all-features builds a superset of the artifacts needed by default / libsql-only, a shared cache is incrementally useful for every leg even when the saver wasn't all-features. This is independent of and complementary to #2609 (save-if gating); together they reduce total cache churn per clippy job to near-zero wall clock on PR runs after the first main/staging push refreshes the slot. * ci(clippy): run only all-features on push Adds if: github.event_name == 'pull_request' || matrix.name == 'all-features' to the Linux clippy matrix so push events (main/staging) run only the all-features leg. This pins the saver for the new shared-key slot: --all-features builds a superset of the artifacts needed by default and libsql-only, so when those PR legs cache-restore they always start from the richest possible baseline rather than whichever leg happened to win a three-way race. PRs still run all three legs, so lint coverage is unchanged on the path that matters (before merge). Push events are only exercised after a PR has already passed, so the redundant two legs were just warming a cache anyway.
This commit is contained in:
13
.github/workflows/code_style.yml
vendored
13
.github/workflows/code_style.yml
vendored
@@ -49,6 +49,11 @@ jobs:
|
||||
|
||||
clippy:
|
||||
name: Clippy (${{ matrix.name }})
|
||||
# Push events only run the all-features leg. That leg builds a superset
|
||||
# of artifacts, so it deterministically wins the shared cache slot on
|
||||
# main/staging refreshes and PR legs always restore from a useful
|
||||
# starting point. PRs still run all three to enforce lint coverage.
|
||||
if: github.event_name == 'pull_request' || matrix.name == 'all-features'
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
@@ -71,7 +76,11 @@ jobs:
|
||||
components: clippy
|
||||
- uses: Swatinem/rust-cache@e18b497796c12c097a38f9edb9d0641fb99eee32 # v2
|
||||
with:
|
||||
key: clippy-${{ matrix.name }}
|
||||
# Share a single cache across the clippy matrix. `target/` built for
|
||||
# --all-features is a superset of the other two legs, so restoring
|
||||
# from whichever variant saved last is still faster than a cold build
|
||||
# and avoids storing three near-duplicate copies in the GHA cache.
|
||||
shared-key: clippy
|
||||
- name: Check lints
|
||||
run: cargo clippy --all --benches --tests --examples ${{ matrix.flags }} -- -D warnings
|
||||
|
||||
@@ -100,7 +109,7 @@ jobs:
|
||||
components: clippy
|
||||
- uses: Swatinem/rust-cache@e18b497796c12c097a38f9edb9d0641fb99eee32 # v2
|
||||
with:
|
||||
key: clippy-windows-${{ matrix.name }}
|
||||
shared-key: clippy-windows
|
||||
- name: Check lints
|
||||
run: cargo clippy --all --benches --tests --examples ${{ matrix.flags }} -- -D warnings
|
||||
|
||||
|
||||
Reference in New Issue
Block a user