Skip to content

Commit 3fa6099

Browse files
authored
Save rust cache for CI jobs on main only (#21359)
1 parent 73b1fce commit 3fa6099

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

.github/workflows/ci.yaml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,8 @@ jobs:
231231
with:
232232
persist-credentials: false
233233
- uses: Swatinem/rust-cache@f13886b937689c021905a6b90929199931d60db1 # v2.8.1
234+
with:
235+
save-if: ${{ github.ref == 'refs/heads/main' }}
234236
- name: "Install Rust toolchain"
235237
run: |
236238
rustup component add clippy
@@ -251,6 +253,8 @@ jobs:
251253
with:
252254
persist-credentials: false
253255
- uses: Swatinem/rust-cache@f13886b937689c021905a6b90929199931d60db1 # v2.8.1
256+
with:
257+
save-if: ${{ github.ref == 'refs/heads/main' }}
254258
- name: "Install Rust toolchain"
255259
run: rustup show
256260
- name: "Install mold"
@@ -315,6 +319,8 @@ jobs:
315319
with:
316320
persist-credentials: false
317321
- uses: Swatinem/rust-cache@f13886b937689c021905a6b90929199931d60db1 # v2.8.1
322+
with:
323+
save-if: ${{ github.ref == 'refs/heads/main' }}
318324
- name: "Install Rust toolchain"
319325
run: rustup show
320326
- name: "Install mold"
@@ -350,6 +356,8 @@ jobs:
350356
with:
351357
persist-credentials: false
352358
- uses: Swatinem/rust-cache@f13886b937689c021905a6b90929199931d60db1 # v2.8.1
359+
with:
360+
save-if: ${{ github.ref == 'refs/heads/main' }}
353361
- name: "Install Rust toolchain"
354362
run: rustup show
355363
- name: "Install cargo nextest"
@@ -376,6 +384,8 @@ jobs:
376384
with:
377385
persist-credentials: false
378386
- uses: Swatinem/rust-cache@f13886b937689c021905a6b90929199931d60db1 # v2.8.1
387+
with:
388+
save-if: ${{ github.ref == 'refs/heads/main' }}
379389
- name: "Install Rust toolchain"
380390
run: rustup target add wasm32-unknown-unknown
381391
- uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0
@@ -411,6 +421,8 @@ jobs:
411421
file: "Cargo.toml"
412422
field: "workspace.package.rust-version"
413423
- uses: Swatinem/rust-cache@f13886b937689c021905a6b90929199931d60db1 # v2.8.1
424+
with:
425+
save-if: ${{ github.ref == 'refs/heads/main' }}
414426
- name: "Install Rust toolchain"
415427
env:
416428
MSRV: ${{ steps.msrv.outputs.value }}
@@ -435,6 +447,7 @@ jobs:
435447
- uses: Swatinem/rust-cache@f13886b937689c021905a6b90929199931d60db1 # v2.8.1
436448
with:
437449
workspaces: "fuzz -> target"
450+
save-if: ${{ github.ref == 'refs/heads/main' }}
438451
- name: "Install Rust toolchain"
439452
run: rustup show
440453
- name: "Install mold"
@@ -496,6 +509,8 @@ jobs:
496509
with:
497510
persist-credentials: false
498511
- uses: Swatinem/rust-cache@f13886b937689c021905a6b90929199931d60db1 # v2.8.1
512+
with:
513+
save-if: ${{ github.ref == 'refs/heads/main' }}
499514
- uses: astral-sh/setup-uv@85856786d1ce8acfbcc2f13a5f3fbd6b938f9f41 # v7.1.2
500515
- name: "Install Rust toolchain"
501516
run: rustup component add rustfmt
@@ -650,6 +665,8 @@ jobs:
650665
persist-credentials: false
651666
- uses: astral-sh/setup-uv@85856786d1ce8acfbcc2f13a5f3fbd6b938f9f41 # v7.1.2
652667
- uses: Swatinem/rust-cache@f13886b937689c021905a6b90929199931d60db1 # v2.8.1
668+
with:
669+
save-if: ${{ github.ref == 'refs/heads/main' }}
653670
- name: "Install Rust toolchain"
654671
run: rustup show
655672
- name: "Install mold"
@@ -707,6 +724,8 @@ jobs:
707724
persist-credentials: false
708725
- uses: astral-sh/setup-uv@85856786d1ce8acfbcc2f13a5f3fbd6b938f9f41 # v7.1.2
709726
- uses: Swatinem/rust-cache@f13886b937689c021905a6b90929199931d60db1 # v2.8.1
727+
with:
728+
save-if: ${{ github.ref == 'refs/heads/main' }}
710729
- name: "Install Rust toolchain"
711730
run: rustup show
712731
- name: "Install mold"
@@ -730,6 +749,8 @@ jobs:
730749
python-version: ${{ env.PYTHON_VERSION }}
731750
architecture: x64
732751
- uses: Swatinem/rust-cache@f13886b937689c021905a6b90929199931d60db1 # v2.8.1
752+
with:
753+
save-if: ${{ github.ref == 'refs/heads/main' }}
733754
- name: "Prep README.md"
734755
run: python scripts/transform_readme.py --target pypi
735756
- name: "Build wheels"
@@ -754,6 +775,8 @@ jobs:
754775
persist-credentials: false
755776
- uses: astral-sh/setup-uv@85856786d1ce8acfbcc2f13a5f3fbd6b938f9f41 # v7.1.2
756777
- uses: Swatinem/rust-cache@f13886b937689c021905a6b90929199931d60db1 # v2.8.1
778+
with:
779+
save-if: ${{ github.ref == 'refs/heads/main' }}
757780
- uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0
758781
with:
759782
node-version: 22
@@ -784,6 +807,8 @@ jobs:
784807
with:
785808
persist-credentials: false
786809
- uses: Swatinem/rust-cache@f13886b937689c021905a6b90929199931d60db1 # v2.8.1
810+
with:
811+
save-if: ${{ github.ref == 'refs/heads/main' }}
787812
- name: "Add SSH key"
788813
if: ${{ env.MKDOCS_INSIDERS_SSH_KEY_EXISTS == 'true' }}
789814
uses: webfactory/ssh-agent@a6f90b1f127823b31d4d4a8d96047790581349bd # v0.9.1
@@ -826,6 +851,8 @@ jobs:
826851
with:
827852
persist-credentials: false
828853
- uses: Swatinem/rust-cache@f13886b937689c021905a6b90929199931d60db1 # v2.8.1
854+
with:
855+
save-if: ${{ github.ref == 'refs/heads/main' }}
829856
- name: "Install Rust toolchain"
830857
run: rustup show
831858
- name: "Run checks"
@@ -896,6 +923,8 @@ jobs:
896923
- name: "Install Rust toolchain"
897924
run: rustup target add wasm32-unknown-unknown
898925
- uses: Swatinem/rust-cache@f13886b937689c021905a6b90929199931d60db1 # v2.8.1
926+
with:
927+
save-if: ${{ github.ref == 'refs/heads/main' }}
899928
- uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0
900929
with:
901930
node-version: 22
@@ -934,6 +963,8 @@ jobs:
934963
persist-credentials: false
935964

936965
- uses: Swatinem/rust-cache@f13886b937689c021905a6b90929199931d60db1 # v2.8.1
966+
with:
967+
save-if: ${{ github.ref == 'refs/heads/main' }}
937968
- uses: astral-sh/setup-uv@85856786d1ce8acfbcc2f13a5f3fbd6b938f9f41 # v7.1.2
938969

939970
- name: "Install Rust toolchain"
@@ -972,6 +1003,8 @@ jobs:
9721003
persist-credentials: false
9731004

9741005
- uses: Swatinem/rust-cache@f13886b937689c021905a6b90929199931d60db1 # v2.8.1
1006+
with:
1007+
save-if: ${{ github.ref == 'refs/heads/main' }}
9751008
- uses: astral-sh/setup-uv@85856786d1ce8acfbcc2f13a5f3fbd6b938f9f41 # v7.1.2
9761009

9771010
- name: "Install Rust toolchain"
@@ -1010,6 +1043,8 @@ jobs:
10101043
persist-credentials: false
10111044

10121045
- uses: Swatinem/rust-cache@f13886b937689c021905a6b90929199931d60db1 # v2.8.1
1046+
with:
1047+
save-if: ${{ github.ref == 'refs/heads/main' }}
10131048
- uses: astral-sh/setup-uv@85856786d1ce8acfbcc2f13a5f3fbd6b938f9f41 # v7.1.2
10141049

10151050
- name: "Install Rust toolchain"

0 commit comments

Comments
 (0)