name: Rust
on:
push:
branches: [main]
pull_request:
branches: [main]
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
steps:
- uses: actions/checkout@v6
- name: Setup rustfmt and clippy
uses: dtolnay/rust-toolchain@v1
with:
toolchain: stable
components: rustfmt, clippy
- name: Cache cargo build
uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true
workspaces: |
. -> target
- name: Build crate
run: cargo build --verbose
- name: Format Check
run: cargo fmt --check
- name: "Clippy Check"
run: cargo clippy --all-targets --verbose -- -D warnings
- name: "Clippy Check: --no-default-features"
run: cargo clippy --all-targets --verbose --no-default-features -- -D warnings
- name: "Clippy Check: --no-default-features --features serde"
run: cargo clippy --all-targets --verbose --no-default-features --features serde -- -D warnings
- name: "Clippy Check: --no-default-features --features scraper"
run: cargo clippy --all-targets --verbose --no-default-features --features scraper -- -D warnings
- name: Test crate
run: cargo test --verbose --all-features