name: CI

on:
  pull_request:
  merge_group:
  workflow_dispatch:
  workflow_call:
  push:
    branches:
      - main

jobs:
  ci:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v6
      - uses: dtolnay/rust-toolchain@stable
      - name: Cache .cargo and target
        uses: actions/cache@v4
        with:
          path: |
            ~/.cargo
            ./target
          key: cargo-${{ runner.os }}
      - run: cargo update
      - run: cargo fmt --all --check
      - run: cargo clippy --all-targets --all-features -- -D warnings
      - run: cargo rustdoc --all-features -- -D warnings
      - run: cargo build
      - run: cargo test --features=std
