Improved CI Actions #335
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 registry | |
uses: actions/cache@v4 | |
with: | |
key: index-${{ hashFiles('Cargo.lock') }} | |
path: | | |
~/.cargo/registry/index | |
~/.cargo/registry/cache | |
- name: Cache cargo crates | |
uses: actions/cache@v4 | |
with: | |
key: crates-${{ hashFiles('Cargo.lock') }} | |
path: ~/.cargo/registry/cache | |
- name: Cache target directory | |
uses: actions/cache@v4 | |
with: | |
path: target | |
key: clippy-${{ hashFiles('Cargo.lock') }} | |
- 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 registry | |
uses: actions/cache@v4 | |
with: | |
key: index-${{ hashFiles('Cargo.lock') }} | |
path: | | |
~/.cargo/registry/index | |
~/.cargo/registry/cache | |
- name: Cache cargo crates | |
uses: actions/cache@v4 | |
with: | |
key: crates-${{ hashFiles('Cargo.lock') }} | |
- name: Fetch dependencies | |
run: cargo fetch | |
- name: Cache target directory | |
uses: actions/cache@v4 | |
with: | |
path: target | |
key: target-${{ hashFiles('Cargo.lock') }} | |
- name: Run Rust tests | |
run: scripts/test.sh |