From e8642fe5211a3ea2c3e83ab8035b7d6b6849dc13 Mon Sep 17 00:00:00 2001 From: HAOYUatHZ <37070449+HAOYUatHZ@users.noreply.github.com> Date: Sat, 3 Dec 2022 07:39:41 +0800 Subject: [PATCH] build(github CI): replace `actions/cache@v2` with `Swatinem/rust-cache@v2` (#123) --- .github/workflows/release.yml | 36 ++++------------------------------- .github/workflows/test.yml | 32 ++++--------------------------- 2 files changed, 8 insertions(+), 60 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index edaaddb..ad25c28 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -20,14 +20,7 @@ jobs: - name: install target run: rustup target add aarch64-apple-darwin - - name: cargo cache artifacts - uses: actions/cache@v2 - with: - path: | - ~/.cargo/registry - ~/.cargo/git - target - key: ${{ runner.os }}-${{ runner.arch }}-cargo-build-target-${{ hashFiles('Cargo.lock') }} + - uses: Swatinem/rust-cache@v2 - name: build run: cargo build --package cli --release --target aarch64-apple-darwin @@ -66,14 +59,7 @@ jobs: - name: install target run: rustup target add x86_64-apple-darwin - - name: cargo cache artifacts - uses: actions/cache@v2 - with: - path: | - ~/.cargo/registry - ~/.cargo/git - target - key: ${{ runner.os }}-${{ runner.arch }}-cargo-build-target-${{ hashFiles('Cargo.lock') }} + - uses: Swatinem/rust-cache@v2 - name: build run: cargo build --package cli --release --target x86_64-apple-darwin @@ -118,14 +104,7 @@ jobs: sudo apt-get install -y gcc-aarch64-linux-gnu echo "CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc" >> $GITHUB_ENV - - name: cargo cache artifacts - uses: actions/cache@v2 - with: - path: | - ~/.cargo/registry - ~/.cargo/git - target - key: ${{ runner.os }}-${{ runner.arch }}-cargo-build-target-${{ hashFiles('Cargo.lock') }} + - uses: Swatinem/rust-cache@v2 - name: build run: cargo build --package cli --release --target aarch64-unknown-linux-gnu @@ -164,14 +143,7 @@ jobs: - name: install target run: rustup target add x86_64-unknown-linux-gnu - - name: cargo cache artifacts - uses: actions/cache@v2 - with: - path: | - ~/.cargo/registry - ~/.cargo/git - target - key: ${{ runner.os }}-${{ runner.arch }}-cargo-build-target-${{ hashFiles('Cargo.lock') }} + - uses: Swatinem/rust-cache@v2 - name: build run: cargo build --package cli --release --target x86_64-unknown-linux-gnu diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index fe102de..295d046 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -17,13 +17,7 @@ jobs: profile: minimal toolchain: nightly override: true - - uses: actions/cache@v2 - with: - path: | - ~/.cargo/registry - ~/.cargo/git - target - key: ${{ runner.os }}-${{ runner.arch }}-cargo-build-target-${{ hashFiles('Cargo.lock') }} + - uses: Swatinem/rust-cache@v2 - uses: actions-rs/cargo@v1 with: command: check @@ -38,13 +32,7 @@ jobs: profile: minimal toolchain: nightly override: true - - uses: actions/cache@v2 - with: - path: | - ~/.cargo/registry - ~/.cargo/git - target - key: ${{ runner.os }}-${{ runner.arch }}-cargo-build-target-${{ hashFiles('Cargo.lock') }} + - uses: Swatinem/rust-cache@v2 - uses: actions-rs/cargo@v1 with: command: test @@ -61,13 +49,7 @@ jobs: toolchain: nightly override: true components: rustfmt - - uses: actions/cache@v2 - with: - path: | - ~/.cargo/registry - ~/.cargo/git - target - key: ${{ runner.os }}-${{ runner.arch }}-cargo-build-target-${{ hashFiles('Cargo.lock') }} + - uses: Swatinem/rust-cache@v2 - uses: actions-rs/cargo@v1 with: command: fmt @@ -84,13 +66,7 @@ jobs: toolchain: nightly override: true components: clippy - - uses: actions/cache@v2 - with: - path: | - ~/.cargo/registry - ~/.cargo/git - target - key: ${{ runner.os }}-${{ runner.arch }}-cargo-build-target-${{ hashFiles('Cargo.lock') }} + - uses: Swatinem/rust-cache@v2 - uses: actions-rs/cargo@v1 with: command: clippy