Improved CI Actions #332
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
pull_request: | |
push: | |
branches: | |
- master | |
env: | |
RUSTFLAGS: -Dwarnings | |
RUST_BACKTRACE: 1 | |
CARGO_INCREMENTAL: 0 # makes cache smaller | |
CARGO_PROFILE_DEV_DEBUG: 0 | |
jobs: | |
clippy: | |
name: Clipy and format | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: 'recursive' | |
- uses: dtolnay/rust-toolchain@stable | |
with: | |
components: clippy, rustfmt | |
- name: Check format | |
run: cargo fmt -- --check | |
- name: Cache cargo index | |
uses: actions/cache@v4 | |
with: | |
key: immutable # this will always be hit because it's a constant | |
path: ~/.cargo/registry/index | |
- name: Cache cargo crates | |
uses: actions/cache@v4 | |
with: | |
key: crates-${{ hashFiles('Cargo.toml') }} # don't accumulate .crate files of old versions | |
path: ~/.cargo/registry/cache # target/ dir of clippy is not worth caching | |
- name: Fetch dependencies | |
run: cargo fetch | |
- name: Run clippy | |
run: cargo clippy --all --all-targets --target-dir=target | |
- name: Run clippy on integration tests | |
run: cargo clippy --all --all-targets --features=integration_test --target-dir=target | |
- name: Run clippy on C API | |
run: cargo clippy --all-targets --manifest-path=c-api/Cargo.toml --target-dir=target | |
- name: Run clippy on JS API | |
run: cargo clippy --all-targets --manifest-path=js-api/Cargo.toml --target-dir=target | |
test: | |
name: Test | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: 'recursive' | |
- uses: dtolnay/rust-toolchain@stable | |
- name: Cache cargo index and registry | |
uses: actions/cache@v4 | |
with: | |
key: immutable | |
path: ~/.cargo/registry/index | |
- name: Cache cargo crates | |
uses: actions/cache@v4 | |
with: | |
key: crates-${{ hashFiles('Cargo.toml') }} # don't accumulate .crate files of old versions | |
path: ~/.cargo/registry/cache | |
- name: Fetch dependencies | |
run: cargo fetch | |
- name: Cache target directory | |
uses: actions/cache@v4 | |
with: | |
path: target | |
key: target-${{ hashFiles('Cargo.toml') }} | |
- name: Run Rust tests | |
run: scripts/test.sh |