name: Rust
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
env:
CARGO_TERM_COLOR: always
jobs:
check:
name: Check & Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: clippy, rustfmt
- name: Install ALSA (cpal dev-dependency, used by the voice example)
run: sudo apt-get update && sudo apt-get install -y libasound2-dev pkg-config
- name: Format check
run: cargo fmt --all -- --check
- name: Clippy
run: cargo clippy --all-targets --all-features -- -D warnings
build:
name: Build & Test
runs-on: ubuntu-latest
needs: check
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- name: Install ALSA (cpal dev-dependency, used by the voice example)
run: sudo apt-get update && sudo apt-get install -y libasound2-dev pkg-config
- name: Build
run: cargo build --verbose
- name: Run tests
run: cargo test --verbose
docs:
name: Documentation
runs-on: ubuntu-latest
needs: check
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- name: Doc build
run: cargo doc --no-deps --all-features
env:
RUSTDOCFLAGS: "-D warnings"