Skip to content

Commit

Permalink
test: cache
Browse files Browse the repository at this point in the history
  • Loading branch information
heemankv committed Aug 20, 2024
1 parent f1f80c4 commit cd7df15
Showing 1 changed file with 18 additions and 41 deletions.
59 changes: 18 additions & 41 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
name: Task - Rust Tests & Coverage

on:
Expand Down Expand Up @@ -33,57 +34,33 @@ jobs:
steps:
- uses: actions/checkout@v3

# selecting a toolchain either by action or manual `rustup` calls should happen
# before the plugin, as the cache uses the current rustc version as its cache key
- run: rustup show

- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true

- name: Generate lockfile
run: cargo generate-lockfile

- name: Cache cargo registry
uses: actions/cache@v3
id: cache-registry
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}

- name: Cache cargo index
uses: actions/cache@v3
id: cache-index
with:
path: ~/.cargo/git
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}

- name: Cache cargo build
- name: Cache dependencies
uses: actions/cache@v3
id: cache-build
with:
path: target
key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}-${{ hashFiles('**/Cargo.toml') }}

- name: Debug cache status
run: |
echo "Registry cache hit: ${{ steps.cache-registry.outputs.cache-hit }}"
echo "Index cache hit: ${{ steps.cache-index.outputs.cache-hit }}"
echo "Build cache hit: ${{ steps.cache-build.outputs.cache-hit }}"
echo "Cargo registry size:"
du -sh ~/.cargo/registry || echo "Registry not found"
echo "Cargo index size:"
du -sh ~/.cargo/git || echo "Index not found"
echo "Target directory size:"
du -sh target || echo "Target not found"
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}

echo "Content of target directory:"
ls -R target || echo "Target directory not found"
- name: Install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov

- name: Install cargo-llvm-cov and nextest
uses: taiki-e/install-action@v2
with:
tool: cargo-llvm-cov,nextest
- name: Install nextest
uses: taiki-e/install-action@nextest

- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
Expand Down Expand Up @@ -116,4 +93,4 @@ jobs:
debug: true

- uses: colpal/actions-clean@v1
if: ${{ always() }}
if: ${{ always() }} # To ensure this step runs even when earlier steps fail

0 comments on commit cd7df15

Please sign in to comment.