Skip to content

Commit 74d02e8

Browse files
committed
ci: Add caching
We have a handful of jobs that could benefit from reusing the target directory. Make use of Swatinem/rust-cache to do so. Something still isn't quite right since the largest job only seems to be restoring a portion of the cache, but this still shows an improvement for most jobs. (backport <#4178>) (cherry picked from commit af7e126)
1 parent e9b1ee4 commit 74d02e8

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

.github/workflows/ci.yaml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,20 @@ jobs:
4444
- uses: actions/checkout@v4
4545
- name: Setup Rust toolchain
4646
run: ./ci/install-rust.sh
47+
48+
# FIXME(ci): These `du` statements are temporary for debugging cache
49+
- name: Target size before restoring cache
50+
run: du -sh target | sort -k 2 || true
51+
- uses: Swatinem/rust-cache@v2
52+
with:
53+
key: ${{ matrix.os }}-${{ matrix.toolchain }}
54+
- name: Target size after restoring cache
55+
run: du -sh target | sort -k 2 || true
56+
4757
- name: Execute build.sh
4858
run: ./ci/verify-build.sh
59+
- name: Target size after job completion
60+
run: du -sh target | sort -k 2
4961

5062
test_tier1:
5163
name: Test tier1
@@ -82,6 +94,9 @@ jobs:
8294
- uses: actions/checkout@v4
8395
- name: Setup Rust toolchain
8496
run: ./ci/install-rust.sh
97+
- uses: Swatinem/rust-cache@v2
98+
with:
99+
key: ${{ matrix.target }}
85100
- name: Run natively
86101
if: "!matrix.docker"
87102
run: ./ci/run.sh ${{ matrix.target }}
@@ -133,6 +148,9 @@ jobs:
133148
- uses: actions/checkout@v4
134149
- name: Setup Rust toolchain
135150
run: ./ci/install-rust.sh
151+
- uses: Swatinem/rust-cache@v2
152+
with:
153+
key: ${{ matrix.target }}
136154
- name: Execute run-docker.sh
137155
run: ./ci/run-docker.sh ${{ matrix.target }}
138156

0 commit comments

Comments
 (0)