Skip to content

Commit 1876c9d

Browse files
authored
[ci] Replace Rust caching with generic caching (#2931)
Remove the `swatinem/rust-cache`, which turns out to take over 8 minutes [1] in the post-cache step due to the size of the cached artifacts. It's mostly redundant with our `generate_cache` job, so this leads to a significant overall performance improvement. [1] https://github.com/google/zerocopy/actions/runs/21366905772/job/61501094657#step:38:1
1 parent 1f5eea2 commit 1876c9d

File tree

1 file changed

+9
-22
lines changed

1 file changed

+9
-22
lines changed

.github/workflows/ci.yml

Lines changed: 9 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -322,11 +322,6 @@ jobs:
322322
# [1] https://github.com/actions/runner/issues/409#issuecomment-752775072
323323
components: clippy, rust-src ${{ matrix.toolchain == 'nightly' && ', miri' || '' }}
324324

325-
- name: Rust Cache
326-
uses: Swatinem/rust-cache@779680da715d629ac1d338a641029a2f4372abb5 # v2.8.2
327-
with:
328-
key: "${{ matrix.target }}"
329-
330325
# On the `thumbv6m-none-eabi` target, we can't run `cargo check --tests` due
331326
# to the `memchr` crate, so we just do `cargo check` instead.
332327
- name: Check
@@ -676,21 +671,20 @@ jobs:
676671
check_be_aarch64:
677672
runs-on: ubuntu-latest
678673
name: Build (zerocopy / nightly / --simd / aarch64_be-unknown-linux-gnu)
674+
needs: generate_cache
679675
steps:
680676
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
681677
with:
682678
persist-credentials: false
679+
- name: Populate cache
680+
uses: ./.github/actions/cache
683681
- name: Configure environment variables
684682
run: |
685683
set -eo pipefail
686684
ZC_TOOLCHAIN="$(./cargo.sh --version nightly)"
687685
RUSTFLAGS="$RUSTFLAGS $ZC_NIGHTLY_RUSTFLAGS"
688686
echo "RUSTFLAGS=$RUSTFLAGS" >> $GITHUB_ENV
689687
echo "ZC_TOOLCHAIN=$ZC_TOOLCHAIN" >> $GITHUB_ENV
690-
- name: Rust Cache
691-
uses: Swatinem/rust-cache@779680da715d629ac1d338a641029a2f4372abb5 # v2.8.2
692-
with:
693-
key: aarch64_be-unknown-linux-gnu
694688
- name: Install stable Rust for use in 'cargo.sh'
695689
uses: dtolnay/rust-toolchain@e97e2d8cc328f1b50210efc529dca0028893a2d9 # v1
696690
with:
@@ -720,21 +714,20 @@ jobs:
720714
check_avr_atmega:
721715
runs-on: ubuntu-latest
722716
name: Build (zerocopy / nightly / --simd / avr-none)
717+
needs: generate_cache
723718
steps:
724719
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
725720
with:
726721
persist-credentials: false
722+
- name: Populate cache
723+
uses: ./.github/actions/cache
727724
- name: Configure environment variables
728725
run: |
729726
set -eo pipefail
730727
ZC_TOOLCHAIN="$(./cargo.sh --version nightly)"
731728
RUSTFLAGS="$RUSTFLAGS $ZC_NIGHTLY_RUSTFLAGS"
732729
echo "RUSTFLAGS=$RUSTFLAGS" >> $GITHUB_ENV
733730
echo "ZC_TOOLCHAIN=$ZC_TOOLCHAIN" >> $GITHUB_ENV
734-
- name: Rust Cache
735-
uses: Swatinem/rust-cache@779680da715d629ac1d338a641029a2f4372abb5 # v2.8.2
736-
with:
737-
key: avr-none
738731
- name: Install stable Rust for use in 'cargo.sh'
739732
uses: dtolnay/rust-toolchain@e97e2d8cc328f1b50210efc529dca0028893a2d9 # v1
740733
with:
@@ -768,10 +761,13 @@ jobs:
768761
check_fmt:
769762
runs-on: ubuntu-latest
770763
name: Check Rust formatting
764+
needs: generate_cache
771765
steps:
772766
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
773767
with:
774768
persist-credentials: false
769+
- name: Populate cache
770+
uses: ./.github/actions/cache
775771
- name: Check Rust formatting
776772
run: |
777773
set -eo pipefail
@@ -802,10 +798,8 @@ jobs:
802798
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
803799
with:
804800
persist-credentials: false
805-
806801
- name: Populate cache
807802
uses: ./.github/actions/cache
808-
809803
- name: Check Actions
810804
run: ./ci/check_actions.sh
811805

@@ -817,10 +811,8 @@ jobs:
817811
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
818812
with:
819813
persist-credentials: false
820-
821814
- name: Populate cache
822815
uses: ./.github/actions/cache
823-
824816
- name: Check README.md
825817
run: ./ci/check_readme.sh
826818

@@ -832,10 +824,8 @@ jobs:
832824
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
833825
with:
834826
persist-credentials: false
835-
836827
- name: Populate cache
837828
uses: ./.github/actions/cache
838-
839829
# Make sure that both crates are at the same version, and that zerocopy
840830
# depends exactly upon the current version of zerocopy-derive. See
841831
# `INTERNAL.md` for an explanation of why we do this.
@@ -848,12 +838,10 @@ jobs:
848838
name: Check MSRV is minimal
849839
steps:
850840
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
851-
852841
with:
853842
persist-credentials: false
854843
- name: Populate cache
855844
uses: ./.github/actions/cache
856-
857845
- name: Check MSRV is minimal
858846
run: ./ci/check_msrv_is_minimal.sh
859847

@@ -864,7 +852,6 @@ jobs:
864852
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
865853
with:
866854
persist-credentials: false
867-
868855
- name: Populate cache
869856
uses: ./.github/actions/cache
870857
with:

0 commit comments

Comments
 (0)