From 528096a062fc3c6e40999435b634be8c6c5869aa Mon Sep 17 00:00:00 2001 From: KevFan Date: Thu, 12 Oct 2023 15:51:46 +0100 Subject: [PATCH] workflow: add cache --- .github/workflows/rust.yml | 39 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 37 insertions(+), 2 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 92bda4b7..3fb25b8b 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -22,6 +22,15 @@ jobs: profile: minimal toolchain: stable override: true + - name: Set up cargo cache + uses: actions/cache@v3 + continue-on-error: false + with: + path: | + ~/.cargo + target/ + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} + restore-keys: ${{ runner.os }}-cargo- - uses: abelfodil/protoc-action@v1 with: protoc-version: '3.19.4' @@ -42,11 +51,18 @@ jobs: PASS: password steps: - uses: actions/checkout@v2 + - name: Set up cargo cache + uses: actions/cache@v3 + continue-on-error: false + with: + path: | + ~/.cargo + target/ + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} + restore-keys: ${{ runner.os }}-cargo- - uses: supercharge/redis-github-action@1.1.0 with: redis-version: 5 - # Nightly is required for code coverage with doctests - # https://github.com/taiki-e/cargo-llvm-cov/issues/2 - uses: actions-rs/toolchain@v1 with: profile: minimal @@ -77,10 +93,20 @@ jobs: args: --all -- --check clippy: + needs: check name: Clippy runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 + - name: Set up cargo cache + uses: actions/cache@v3 + continue-on-error: false + with: + path: | + ~/.cargo + target/ + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} + restore-keys: ${{ runner.os }}-cargo- - uses: actions-rs/toolchain@v1 with: profile: minimal @@ -100,6 +126,15 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 + - name: Set up cargo cache + uses: actions/cache@v3 + continue-on-error: false + with: + path: | + ~/.cargo + target/ + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} + restore-keys: ${{ runner.os }}-cargo- - uses: supercharge/redis-github-action@1.1.0 with: redis-version: 5