Skip to content

Commit e192f05

Browse files
committed
chore: add nextest and caching to workflows
1 parent 48c985f commit e192f05

File tree

2 files changed

+96
-2
lines changed

2 files changed

+96
-2
lines changed

Diff for: .github/workflows/rust.yaml

+55-2
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,16 @@ jobs:
2121
components: rustfmt, clippy
2222
override: true
2323

24+
- name: Cache Rust toolchain
25+
uses: actions/cache@v3
26+
id: rust-toolchain
27+
with:
28+
paths:
29+
- $HOME/.cargo/
30+
key: ${{ runner.os }}-rust-${{ hashFiles('Cargo.toml', 'Cargo.lock') }}
31+
restore-keys: |
32+
${{ runner.os }}-rust-
33+
2434
- name: Check no default features
2535
run: cargo check --no-default-features
2636

@@ -30,11 +40,54 @@ jobs:
3040
- name: Lint with Clippy
3141
run: cargo clippy --workspace --all-features --bins --tests
3242

43+
- name: Cache build artifacts
44+
uses: actions/cache@v3
45+
id: build-cache
46+
with:
47+
paths:
48+
- target/
49+
key: ${{ runner.os }}-build-${{ hashFiles('Cargo.toml', 'Cargo.lock') }}
50+
restore-keys: |
51+
${{ runner.os }}-build-
52+
3353
- name: Build
3454
run: cargo build --release --workspace --all-features --verbose
3555

36-
- name: Run tests
37-
run: cargo test --all-features --workspace --verbose
56+
- name: Install Nextest
57+
run: cargo install nextest
58+
59+
- name: Cache Nextest
60+
uses: actions/cache@v3
61+
id: nextest-cache
62+
with:
63+
paths:
64+
- $HOME/.cargo/bin/nextest
65+
key: ${{ runner.os }}-nextest-${{ hashFiles('Cargo.toml', 'Cargo.lock') }}
66+
restore-keys: |
67+
${{ runner.os }}-nextest-
68+
69+
- name: Run tests with Nextest
70+
run: cargo nextest run --all-features --workspace --verbose
71+
72+
- name: Cache test results
73+
uses: actions/cache@v3
74+
id: test-results
75+
with:
76+
paths:
77+
- target/cargo-nextest-reports/
78+
key: ${{ runner.os }}-test-results-${{ hashFiles('Cargo.toml', 'Cargo.lock') }}
79+
restore-keys: |
80+
${{ runner.os }}-test-results-
3881
3982
- name: Run docs
4083
run: cargo doc --workspace --all-features --no-deps --document-private-items --verbose
84+
85+
- name: Cache documentation
86+
uses: actions/cache@v3
87+
id: docs-cache
88+
with:
89+
paths:
90+
- target/doc/
91+
key: ${{ runner.os }}-docs-${{ hashFiles('Cargo.toml', 'Cargo.lock') }}
92+
restore-keys: |
93+
${{ runner.os }}-docs-

Diff for: .github/workflows/wasm.yaml

+41
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,58 @@ jobs:
1313
steps:
1414
- uses: actions/checkout@v4
1515

16+
- name: Cache Rust toolchain
17+
uses: actions/cache@v3
18+
id: rust-toolchain
19+
with:
20+
paths:
21+
- $HOME/.cargo/
22+
key: ${{ runner.os }}-rust-${{ hashFiles('Cargo.toml', 'Cargo.lock') }}
23+
restore-keys: |
24+
${{ runner.os }}-rust-
25+
1626
- name: Install Rust
1727
uses: dtolnay/rust-toolchain@stable
1828
with:
1929
targets: wasm32-unknown-unknown
2030

31+
- name: Cache wasm-pack installation
32+
uses: actions/cache@v3
33+
id: wasm-pack-cache
34+
with:
35+
paths:
36+
- $HOME/.wasm-pack/
37+
key: ${{ runner.os }}-wasm-pack-${{ hashFiles('wasm-pack-installer.sh') }}
38+
restore-keys: |
39+
${{ runner.os }}-wasm-pack-
40+
2141
- name: Install wasm-pack
2242
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
2343

44+
- name: Cache Cargo build
45+
uses: actions/cache@v3
46+
id: cargo-build-cache
47+
with:
48+
paths:
49+
- target/
50+
key: ${{ runner.os }}-cargo-build-${{ hashFiles('Cargo.toml', 'Cargo.lock') }}
51+
restore-keys: |
52+
${{ runner.os }}-cargo-build-
53+
2454
- name: Build server
2555
run: cargo build
2656

57+
- name: Cache wasm-pack test artifacts
58+
uses: actions/cache@v3
59+
id: wasm-pack-test-cache
60+
with:
61+
paths:
62+
- ./pkarr/target/
63+
- ./pkarr/pkg/
64+
key: ${{ runner.os }}-wasm-pack-test-${{ hashFiles('pkarr/Cargo.toml', 'pkarr/Cargo.lock') }}
65+
restore-keys: |
66+
${{ runner.os }}-wasm-pack-test-
67+
2768
- name: Start server and run tests
2869
run: |
2970
# Start the server binary in the background

0 commit comments

Comments
 (0)