Skip to content

Commit 6819e54

Browse files
committed
Speedup CI by avoiding to rewrite caches
1 parent b188a7d commit 6819e54

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

.github/workflows/ci.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,8 @@ jobs:
187187
persist-credentials: false
188188
- uses: dtolnay/rust-toolchain@stable
189189
- uses: Swatinem/rust-cache@v2
190+
with:
191+
save-if: ${{ github.ref == 'refs/heads/main' }}
190192
- name: Setup dependencies
191193
run: |
192194
sudo apt-get update
@@ -209,6 +211,8 @@ jobs:
209211
persist-credentials: false
210212
- uses: dtolnay/rust-toolchain@stable
211213
- uses: Swatinem/rust-cache@v2
214+
with:
215+
save-if: ${{ github.ref == 'refs/heads/main' }}
212216
- uses: extractions/setup-just@v3
213217
- name: Run journey tests
214218
run: just ci-journey-tests
@@ -235,6 +239,8 @@ jobs:
235239
persist-credentials: false
236240
- uses: dtolnay/rust-toolchain@stable
237241
- uses: Swatinem/rust-cache@v2
242+
with:
243+
save-if: ${{ github.ref == 'refs/heads/main' }}
238244
- name: cargo check default features
239245
if: startsWith(matrix.os, 'windows')
240246
run: cargo check --workspace --bins --examples
@@ -284,6 +290,8 @@ jobs:
284290
persist-credentials: false
285291
- uses: dtolnay/rust-toolchain@stable
286292
- uses: Swatinem/rust-cache@v2
293+
with:
294+
save-if: ${{ github.ref == 'refs/heads/main' }}
287295
- uses: taiki-e/install-action@v2
288296
with:
289297
tool: nextest
@@ -363,6 +371,8 @@ jobs:
363371
- name: Add Rust tools to path
364372
run: echo "PATH=$HOME/.cargo/bin:$PATH" >> "$GITHUB_ENV"
365373
- uses: Swatinem/rust-cache@v2
374+
with:
375+
save-if: ${{ github.ref == 'refs/heads/main' }}
366376
- uses: taiki-e/install-action@v2
367377
with:
368378
tool: nextest
@@ -387,6 +397,8 @@ jobs:
387397
with:
388398
targets: ${{ env.TARGET }}
389399
- uses: Swatinem/rust-cache@v2
400+
with:
401+
save-if: ${{ github.ref == 'refs/heads/main' }}
390402
- uses: taiki-e/install-action@v2
391403
with:
392404
tool: nextest
@@ -473,6 +485,8 @@ jobs:
473485
rustup default stable
474486
rustup target add "$TARGET"
475487
- uses: Swatinem/rust-cache@v2
488+
with:
489+
save-if: ${{ github.ref == 'refs/heads/main' }}
476490
- name: 'WASI only: crates without feature toggle'
477491
if: endsWith(matrix.target, '-wasi')
478492
run: |

.github/workflows/cron.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,7 @@ jobs:
1717
with:
1818
persist-credentials: false
1919
- uses: Swatinem/rust-cache@v2
20+
with:
21+
save-if: ${{ github.ref == 'refs/heads/main' }}
2022
- name: stress
2123
run: make stress

0 commit comments

Comments
 (0)