name: Test
on:
push:
branches:
- master
pull_request:
jobs:
fmt:
name: "Rustfmt"
runs-on: ubuntu-latest
env:
TOOLCHAIN: nightly-2024-04-20
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.TOOLCHAIN }}
components: rustfmt
- name: Cache Rust files
uses: swatinem/rust-cache@v2
- name: Rustfmt
run: cargo +${{ env.TOOLCHAIN }} fmt -- --check
lint:
name: Check/Lint - ${{ matrix.platform.name }}
strategy:
fail-fast: false
matrix:
platform:
- name: Linux
os: ubuntu-latest
target: x86_64-unknown-linux-gnu
- name: Windows
os: windows-latest
target: x86_64-pc-windows-msvc
- name: macOS
os: macOS-latest
target: aarch64-apple-darwin
runs-on: ${{ matrix.platform.os }}
steps:
- uses: actions/checkout@v4
- name: Cache Rust files
uses: swatinem/rust-cache@v2
with:
key: ${{ matrix.platform.target }}
- name: Install toolchain
run: rustup target add ${{ matrix.platform.target }}
- name: Clippy
run: cargo clippy --target ${{ matrix.platform.target }} --all-targets --all-features -- -D clippy::all
doc:
name: Check Docs
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Cache Rust files
uses: swatinem/rust-cache@v2
- name: Doc
run: cargo doc --no-deps --all-features --document-private-items
env:
RUSTDOCFLAGS: -D warnings
test:
name: Test - ${{ matrix.platform.name }}
strategy:
fail-fast: false
matrix:
platform:
- name: Linux
os: ubuntu-latest
target: x86_64-unknown-linux-gnu
- name: Windows
os: windows-latest
target: x86_64-pc-windows-msvc
- name: macOS
os: macOS-latest
target: aarch64-apple-darwin
runs-on: ${{ matrix.platform.os }}
steps:
- uses: actions/checkout@v4
- name: Cache Rust files
uses: swatinem/rust-cache@v2
with:
key: ${{ matrix.platform.target }}
- name: Install toolchain
run: rustup target add ${{ matrix.platform.target }}
- name: Run tests
run: cargo test --workspace