From 043f1199a031f07ee7f285cd51961c550621d60e Mon Sep 17 00:00:00 2001 From: Daniel McCarney Date: Tue, 3 Oct 2023 10:02:04 -0400 Subject: [PATCH] ci: add caching w/ actions/cache@v3 This commit adds a caching step to the `build-windows`, `build` and `coverage` jobs of the GitHub actions CI configuration. We key based on: 1. Runner OS 2. Rust toolchain 3. Hash of Cargo.lock --- .github/workflows/ci.yml | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b0f25a17..6109c236 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -72,6 +72,16 @@ jobs: - uses: actions/checkout@v4 with: persist-credentials: false + - uses: actions/cache@v3 + with: + path: | + ~/.cargo/bin/ + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + target/ + $VCPKG_DEFAULT_BINARY_CACHE + key: ${{ runner.os }}-cargo-stable-${{ hashFiles('Cargo.lock') }} - uses: egor-tensin/vs-shell@v2 with: arch: amd64 @@ -105,6 +115,15 @@ jobs: - uses: actions/checkout@v4 with: persist-credentials: false + - uses: actions/cache@v3 + with: + path: | + ~/.cargo/bin/ + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + target/ + key: ${{ runner.os }}-cargo-${{matrix.toolchain}}-${{ hashFiles('Cargo.lock') }} - name: Install Rust uses: dtolnay/rust-toolchain@master with: @@ -126,6 +145,15 @@ jobs: uses: actions/checkout@v4 with: persist-credentials: false + - uses: actions/cache@v3 + with: + path: | + ~/.cargo/bin/ + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + target/ + key: ${{ runner.os }}-cargo-stable-${{ hashFiles('Cargo.lock') }} - name: Install cargo-llvm-cov uses: taiki-e/install-action@cargo-llvm-cov - name: Install rust toolchain