name: CI

on:
  push:
    branches: [main]
  pull_request:

jobs:
  ci:
    name: Test, Lint, Format
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - uses: dtolnay/rust-toolchain@stable
        with:
          components: clippy, rustfmt

      - uses: Swatinem/rust-cache@v2

      - name: Format check
        run: cargo fmt --check

      - name: Clippy
        run: cargo clippy --all-targets --all-features -- -D warnings

      - name: Test (default features)
        run: cargo test

      - name: Test (all features)
        run: cargo test --all-features
