name: Build and Test
on:
push:
branches: [main]
pull_request:
branches: [main]
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1
jobs:
build:
runs-on: ${{ matrix.os }}
timeout-minutes: 10
strategy:
fail-fast: false
matrix:
os: [ubuntu-22.04, windows-latest, macos-14]
steps:
- uses: actions/checkout@v6
- uses: dtolnay/rust-toolchain@1.71.0
with:
components: rustfmt, clippy
- name: Run rustfmt and fail if any warnings
run: cargo fmt -- --check
- name: Run docs and fail if any warnings
env:
RUSTDOCFLAGS: "-D warnings"
run: cargo doc --all-features
- name: Build with feature configuration
run: cargo build --no-default-features --features async
- name: Build
run: cargo build
- name: Run clippy and fail if any warnings
run: cargo clippy -- -D warnings
- name: Run clippy for tests and fail if any warnings
run: cargo clippy --tests -- -D warnings
- name: Run clippy for tests with features enabled
run: cargo clippy --tests --all-features -- -D warnings
- name: Run tests with debugs
if: matrix.os == 'ubuntu-20.04' || matrix.os == 'macos-14'
timeout-minutes: 2
run: RUST_LOG=debug cargo test -- --nocapture
- name: Run tests on Windows
env:
RUST_LOG: debug
if: matrix.os == 'windows-latest'
run: cargo test -- --nocapture
- name: Run tests with features
if: matrix.os == 'ubuntu-20.04' || matrix.os == 'macos-14'
timeout-minutes: 2
run: RUST_LOG=debug cargo test --all-features -- --nocapture
- name: Run tests with features on Windows
env:
RUST_LOG: debug
if: matrix.os == 'windows-latest'
run: cargo test --all-features -- --nocapture