name: Build and test rust
on:
pull_request:
paths:
- 'src/**'
- 'Cargo.toml'
- '.github/workflows/build.yml'
jobs:
test-rust:
name: Build and test Rust
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
components: rustfmt, clippy
- name: Cache Cargo
uses: actions/cache@v3
with:
path: /github/home/.cargo
key: cargo-cache-test-rs
- name: Cache Rust dependencies
uses: actions/cache@v3
with:
path: /github/home/target
key: ubuntu-x86-64-target-cache-stable
- name: Run formatting checks
run: |
cargo fmt --all -- --check
- name: Run lints
run: |
cargo clippy --all-features
- name: Run tests
run: |
cargo test --all-features