diff --git a/.github/workflows/coverage-pr.yml b/.github/workflows/coverage-pr.yml index 4a196aa..e2590b7 100644 --- a/.github/workflows/coverage-pr.yml +++ b/.github/workflows/coverage-pr.yml @@ -19,7 +19,21 @@ jobs: with: ref: ${{ github.event.pull_request.head.sha }} - - run: cargo install cargo-llvm-cov + - name: Cache llvm-cov build + id: cache-llvm-cov + uses: actions/cache@v4 + continue-on-error: false + with: + path: | + ~/.cargo/bin/ + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + target/ + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} + restore-keys: ${{ runner.os }}-cargo- + + - run: which cargo-llvm-cov || cargo install cargo-llvm-cov - run: rustup component add llvm-tools-preview - run: cargo llvm-cov --workspace --lcov --output-path lcov.info --ignore-filename-regex '^examples/' @@ -71,9 +85,24 @@ jobs: with: ref: ${{ github.event.pull_request.base.sha }} + - name: Cache llvm-cov build + id: cache-llvm-cov + if: ${{ steps.base_art.outputs.found == 'false' }} + uses: actions/cache@v4 + continue-on-error: false + with: + path: | + ~/.cargo/bin/ + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + target/ + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} + restore-keys: ${{ runner.os }}-cargo- + - name: Install cargo-llvm-cov (fallback path) if: ${{ steps.base_art.outputs.found == 'false' }} - run: cargo install cargo-llvm-cov + run: which cargo-llvm-cov || cargo install cargo-llvm-cov - name: Install llvm-tools (fallback path) if: ${{ steps.base_art.outputs.found == 'false' }} diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index b0d7bf1..311bd2b 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -14,7 +14,21 @@ jobs: steps: - uses: actions/checkout@v4 - - run: cargo install cargo-llvm-cov + - name: Cache llvm-cov build + id: cache-llvm-cov + uses: actions/cache@v4 + continue-on-error: false + with: + path: | + ~/.cargo/bin/ + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + target/ + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} + restore-keys: ${{ runner.os }}-cargo- + + - run: which cargo-llvm-cov || cargo install cargo-llvm-cov - run: rustup component add llvm-tools-preview - run: cargo llvm-cov --workspace --lcov --output-path lcov.info --ignore-filename-regex '^examples/'