name: CI
on:
pull_request:
branches: [main]
push:
branches: [main]
workflow_dispatch:
env:
CARGO_TERM_COLOR: always
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- name: Show Rust versions
run: |
rustc --version
cargo --version
rustfmt --version
- name: Cache Rust dependencies and build artifacts
uses: Swatinem/rust-cache@v2
- name: Check formatting
if: matrix.os != 'windows-latest'
run: cargo fmt -- --check
- name: Run clippy (all targets)
if: matrix.os != 'windows-latest'
run: cargo clippy --all-targets --all-features --no-deps -- -D warnings
- name: Run tests
run: cargo test --verbose
- name: Build
run: cargo build --verbose