Skip to content

Commit d21a3c5

Browse files
authored
Cache llvm-cov and other tools separately (#60)
Adopting NethermindEth/rust-template#34 and NethermindEth/rust-template#35
1 parent 58075d7 commit d21a3c5

4 files changed

Lines changed: 51 additions & 8 deletions

File tree

.github/workflows/coverage-pr.yml

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,21 @@ jobs:
1919
with:
2020
ref: ${{ github.event.pull_request.head.sha }}
2121

22-
- run: cargo install cargo-llvm-cov
22+
- name: Cache llvm-cov build
23+
id: cache-llvm-cov
24+
uses: actions/cache@v4
25+
continue-on-error: false
26+
with:
27+
path: |
28+
~/.cargo/bin/
29+
~/.cargo/registry/index/
30+
~/.cargo/registry/cache/
31+
~/.cargo/git/db/
32+
target/
33+
key: ${{ runner.os }}-cargo-llvm-cov-${{ hashFiles('**/Cargo.lock') }}
34+
restore-keys: ${{ runner.os }}-cargo-llvm-cov
35+
36+
- run: which cargo-llvm-cov || cargo install cargo-llvm-cov
2337
- run: rustup component add llvm-tools-preview
2438
- run: cargo llvm-cov --workspace --lcov --output-path lcov.info --ignore-filename-regex '^examples/'
2539

@@ -71,9 +85,24 @@ jobs:
7185
with:
7286
ref: ${{ github.event.pull_request.base.sha }}
7387

88+
- name: Cache llvm-cov build
89+
id: cache-llvm-cov
90+
if: ${{ steps.base_art.outputs.found == 'false' }}
91+
uses: actions/cache@v4
92+
continue-on-error: false
93+
with:
94+
path: |
95+
~/.cargo/bin/
96+
~/.cargo/registry/index/
97+
~/.cargo/registry/cache/
98+
~/.cargo/git/db/
99+
target/
100+
key: ${{ runner.os }}-cargo-llvm-cov-${{ hashFiles('**/Cargo.lock') }}
101+
restore-keys: ${{ runner.os }}-cargo-llvm-cov
102+
74103
- name: Install cargo-llvm-cov (fallback path)
75104
if: ${{ steps.base_art.outputs.found == 'false' }}
76-
run: cargo install cargo-llvm-cov
105+
run: which cargo-llvm-cov || cargo install cargo-llvm-cov
77106

78107
- name: Install llvm-tools (fallback path)
79108
if: ${{ steps.base_art.outputs.found == 'false' }}

.github/workflows/coverage.yml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,21 @@ jobs:
1414
steps:
1515
- uses: actions/checkout@v4
1616

17-
- run: cargo install cargo-llvm-cov
17+
- name: Cache llvm-cov build
18+
id: cache-llvm-cov
19+
uses: actions/cache@v4
20+
continue-on-error: false
21+
with:
22+
path: |
23+
~/.cargo/bin/
24+
~/.cargo/registry/index/
25+
~/.cargo/registry/cache/
26+
~/.cargo/git/db/
27+
target/
28+
key: ${{ runner.os }}-cargo-llvm-cov-${{ hashFiles('**/Cargo.lock') }}
29+
restore-keys: ${{ runner.os }}-cargo-llvm-cov
30+
31+
- run: which cargo-llvm-cov || cargo install cargo-llvm-cov
1832
- run: rustup component add llvm-tools-preview
1933
- run: cargo llvm-cov --workspace --lcov --output-path lcov.info --ignore-filename-regex '^examples/'
2034

.github/workflows/dependency-audit.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ jobs:
3232
~/.cargo/registry/cache/
3333
~/.cargo/git/db/
3434
target/
35-
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
36-
restore-keys: ${{ runner.os }}-cargo-
35+
key: ${{ runner.os }}-cargo-deny-${{ hashFiles('**/Cargo.lock') }}
36+
restore-keys: ${{ runner.os }}-cargo-deny
3737

3838
- name: Run audit-check action
3939
run: |

.github/workflows/semver-checks.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@ jobs:
3333
~/.cargo/registry/index/
3434
~/.cargo/registry/cache/
3535
~/.cargo/git/db/
36-
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
36+
key: ${{ runner.os }}-cargo-semver-checks-${{ hashFiles('**/Cargo.lock') }}
3737
restore-keys: |
38-
${{ runner.os }}-cargo-
38+
${{ runner.os }}-cargo-semver-checks
3939
4040
- name: Get latest version tag
4141
id: get-baseline
@@ -79,4 +79,4 @@ jobs:
7979
echo "3. Future changes will be checked against tagged versions"
8080
echo ""
8181
echo "Note: Semver checking starts from v0.1.0 as this indicates"
82-
echo "the beginning of API stability commitments in Rust projects"
82+
echo "the beginning of API stability commitments in Rust projects"

0 commit comments

Comments
 (0)