From ed7cdf236bdf5678ae46c65c59d984d628f8e5e1 Mon Sep 17 00:00:00 2001 From: erikkaum Date: Mon, 9 Sep 2024 11:31:37 +0200 Subject: [PATCH] add caching to cargo test and audit --- .github/workflows/tests.yml | 38 ++++++++++++++++++++++++++----------- 1 file changed, 27 insertions(+), 11 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 50fee15..d50a557 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -109,17 +109,25 @@ jobs: run: ./.github/scripts/build_sdist_and_wheel.sh cargo-test: - name: Run Cargo tests - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - name: Install Rust - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - override: true - - name: Run cargo test - run: cargo test + name: Run Cargo tests + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Install Rust + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + override: true + - name: Cache Cargo dependencies + uses: actions/cache@v2 + with: + path: | + ~/.cargo/registry + ~/.cargo/git + target + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} + - name: Run cargo test + run: cargo test cargo-audit: name: Run Cargo audit @@ -131,6 +139,14 @@ jobs: with: toolchain: stable override: true + - name: Cache Cargo dependencies + uses: actions/cache@v2 + with: + path: | + ~/.cargo/registry + ~/.cargo/git + target + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} - name: Install cargo-audit run: cargo install cargo-audit - name: Run cargo audit