Skip to content

Commit

Permalink
ci: Add caching
Browse files Browse the repository at this point in the history
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 <rust-lang#4178>)
(cherry picked from commit af7e126)
  • Loading branch information
tgross35 committed Dec 9, 2024
1 parent e9b1ee4 commit 74d02e8
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,20 @@ jobs:
- uses: actions/checkout@v4
- name: Setup Rust toolchain
run: ./ci/install-rust.sh

# FIXME(ci): These `du` statements are temporary for debugging cache
- name: Target size before restoring cache
run: du -sh target | sort -k 2 || true
- uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.os }}-${{ matrix.toolchain }}
- name: Target size after restoring cache
run: du -sh target | sort -k 2 || true

- name: Execute build.sh
run: ./ci/verify-build.sh
- name: Target size after job completion
run: du -sh target | sort -k 2

test_tier1:
name: Test tier1
Expand Down Expand Up @@ -82,6 +94,9 @@ jobs:
- uses: actions/checkout@v4
- name: Setup Rust toolchain
run: ./ci/install-rust.sh
- uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.target }}
- name: Run natively
if: "!matrix.docker"
run: ./ci/run.sh ${{ matrix.target }}
Expand Down Expand Up @@ -133,6 +148,9 @@ jobs:
- uses: actions/checkout@v4
- name: Setup Rust toolchain
run: ./ci/install-rust.sh
- uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.target }}
- name: Execute run-docker.sh
run: ./ci/run-docker.sh ${{ matrix.target }}

Expand Down

0 comments on commit 74d02e8

Please sign in to comment.