Skip to content

Commit

Permalink
chore: add nextest and caching to workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
Nuhvi committed Feb 5, 2025
1 parent 48c985f commit e192f05
Show file tree
Hide file tree
Showing 2 changed files with 96 additions and 2 deletions.
57 changes: 55 additions & 2 deletions .github/workflows/rust.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,16 @@ jobs:
components: rustfmt, clippy
override: true

- name: Cache Rust toolchain
uses: actions/cache@v3
id: rust-toolchain
with:
paths:
- $HOME/.cargo/
key: ${{ runner.os }}-rust-${{ hashFiles('Cargo.toml', 'Cargo.lock') }}
restore-keys: |
${{ runner.os }}-rust-
- name: Check no default features
run: cargo check --no-default-features

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

- name: Cache build artifacts
uses: actions/cache@v3
id: build-cache
with:
paths:
- target/
key: ${{ runner.os }}-build-${{ hashFiles('Cargo.toml', 'Cargo.lock') }}
restore-keys: |
${{ runner.os }}-build-
- name: Build
run: cargo build --release --workspace --all-features --verbose

- name: Run tests
run: cargo test --all-features --workspace --verbose
- name: Install Nextest
run: cargo install nextest

- name: Cache Nextest
uses: actions/cache@v3
id: nextest-cache
with:
paths:
- $HOME/.cargo/bin/nextest
key: ${{ runner.os }}-nextest-${{ hashFiles('Cargo.toml', 'Cargo.lock') }}
restore-keys: |
${{ runner.os }}-nextest-
- name: Run tests with Nextest
run: cargo nextest run --all-features --workspace --verbose

- name: Cache test results
uses: actions/cache@v3
id: test-results
with:
paths:
- target/cargo-nextest-reports/
key: ${{ runner.os }}-test-results-${{ hashFiles('Cargo.toml', 'Cargo.lock') }}
restore-keys: |
${{ runner.os }}-test-results-
- name: Run docs
run: cargo doc --workspace --all-features --no-deps --document-private-items --verbose

- name: Cache documentation
uses: actions/cache@v3
id: docs-cache
with:
paths:
- target/doc/
key: ${{ runner.os }}-docs-${{ hashFiles('Cargo.toml', 'Cargo.lock') }}
restore-keys: |
${{ runner.os }}-docs-
41 changes: 41 additions & 0 deletions .github/workflows/wasm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,58 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Cache Rust toolchain
uses: actions/cache@v3
id: rust-toolchain
with:
paths:
- $HOME/.cargo/
key: ${{ runner.os }}-rust-${{ hashFiles('Cargo.toml', 'Cargo.lock') }}
restore-keys: |
${{ runner.os }}-rust-
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: wasm32-unknown-unknown

- name: Cache wasm-pack installation
uses: actions/cache@v3
id: wasm-pack-cache
with:
paths:
- $HOME/.wasm-pack/
key: ${{ runner.os }}-wasm-pack-${{ hashFiles('wasm-pack-installer.sh') }}
restore-keys: |
${{ runner.os }}-wasm-pack-
- name: Install wasm-pack
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh

- name: Cache Cargo build
uses: actions/cache@v3
id: cargo-build-cache
with:
paths:
- target/
key: ${{ runner.os }}-cargo-build-${{ hashFiles('Cargo.toml', 'Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-build-
- name: Build server
run: cargo build

- name: Cache wasm-pack test artifacts
uses: actions/cache@v3
id: wasm-pack-test-cache
with:
paths:
- ./pkarr/target/
- ./pkarr/pkg/
key: ${{ runner.os }}-wasm-pack-test-${{ hashFiles('pkarr/Cargo.toml', 'pkarr/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-wasm-pack-test-
- name: Start server and run tests
run: |
# Start the server binary in the background
Expand Down

0 comments on commit e192f05

Please sign in to comment.