name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
env:
CARGO_TERM_COLOR: always
RUSTFLAGS: --deny warnings
RUSTDOCFLAGS: --deny warnings
jobs:
format:
name: Format
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@nightly
with:
components: rustfmt
- name: Check formatting
run: cargo fmt --all -- --check
clippy:
name: Clippy
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: clippy
- name: Install dependencies
run: sudo apt-get update; sudo apt-get install --no-install-recommends libasound2-dev libudev-dev libwayland-dev libxkbcommon-dev
- name: Restore Rust cache
uses: Swatinem/rust-cache@v2
with:
save-if: ${{ github.ref == 'refs/heads/main' }}
- name: Run Clippy lints
run: |
cargo clippy --workspace --no-default-features --all-targets -- --deny warnings
for backend in log tracing; do
for level in trace debug info warn error; do
cargo clippy --workspace --no-default-features --features "${backend},${level}" --all-targets -- --deny warnings
done
done
doc:
name: Docs
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Install dependencies
run: sudo apt-get update; sudo apt-get install --no-install-recommends libasound2-dev libudev-dev libwayland-dev libxkbcommon-dev
- name: Restore Rust cache
uses: Swatinem/rust-cache@v2
with:
save-if: ${{ github.ref == 'refs/heads/main' }}
- name: Check documentation
run: |
cargo doc --workspace --no-default-features --document-private-items --no-deps
for backend in log tracing; do
for level in trace debug info warn error; do
cargo doc --workspace --no-default-features --features "${backend},${level}" --document-private-items --no-deps
done
done
test:
name: Tests
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Install dependencies
run: sudo apt-get update; sudo apt-get install --no-install-recommends libasound2-dev libudev-dev libwayland-dev libxkbcommon-dev
- name: Restore Rust cache
uses: Swatinem/rust-cache@v2
with:
save-if: ${{ github.ref == 'refs/heads/main' }}
- name: Run tests
run: |
cargo test --workspace --no-default-features --all-targets
# TODO: Workaround for <https://github.com/rust-lang/cargo/issues/6669>.
cargo test --workspace --no-default-features --doc
for backend in log tracing; do
for level in trace debug info warn error; do
cargo test --workspace --no-default-features --features "${backend},${level}" --all-targets
# TODO: Workaround for <https://github.com/rust-lang/cargo/issues/6669>.
cargo test --workspace --no-default-features --features "${backend},${level}" --doc
done
done