Skip to content

Commit faf6b6a

Browse files
committed
ci: use cache for rustup to accelerate CI further
1 parent 3df6d9e commit faf6b6a

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

.github/workflows/_build-rust.yml

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,27 @@ jobs:
4040
steps:
4141
- name: Check out
4242
uses: actions/checkout@v3
43-
- name: Install Rust
43+
- name: Set up rustup cache
44+
uses: actions/cache@v3
45+
continue-on-error: false
46+
with:
47+
path: |
48+
~/.rustup/downloads
49+
~/.rustup/toolchains
50+
key: ${{ runner.os }}-rustup-${{ inputs.rust-version }}-${{ inputs.rust-target }}-${{ hashFiles('**/rustup-toolchain.toml') }}
51+
# The effect of this is must smaller than the cache for Cargo. However, it
52+
# still saves a few seconds. Note that many CI runs within a week may
53+
# quickly bring you close to the 10GB limit:
54+
# https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows#managing-caches
55+
- name: Install Rust Toolchain via Rustup
4456
uses: actions-rs/toolchain@v1
4557
with:
4658
profile: minimal
4759
toolchain: ${{ inputs.rust-version }}
4860
override: true
4961
components: clippy, rustfmt
5062
target: ${{ inputs.rust-target }}
51-
- name: Set up cargo cache
63+
- name: Set up Cargo cache
5264
uses: actions/cache@v3
5365
continue-on-error: false
5466
with:
@@ -60,7 +72,6 @@ jobs:
6072
target/
6173
# We do not have a Cargo.lock here, so I hash Cargo.toml
6274
key: ${{ runner.os }}-rust-${{ inputs.rust-version }}-cargo-${{ hashFiles('**/Cargo.toml') }}
63-
restore-keys: ${{ runner.os }}-cargo-${{ inputs.rust-version }}
6475
- run: cargo version
6576
- name: Build (library)
6677
run: cargo build --target ${{ inputs.rust-target }} --features ${{ inputs.features }}

0 commit comments

Comments
 (0)