name: CI

on:
  push:
    branches: ["master", "main"]
  pull_request:

jobs:
  test:
    name: Test
    runs-on: ubuntu-24.04
    steps:
      - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2

      - name: Install Rust toolchain
        uses: actions-rust-lang/setup-rust-toolchain@150fca883cd4034361b621bd4e6a9d34e5143606 # v1.15.4
        with:
          components: rustfmt, clippy

      - name: Install cargo-next
        uses: taiki-e/install-action@42721ded7ddc3cd90f687527e8602066e4e1ff3a # v2.69.2
        with:
          tool: nextest

      - name: Check formatting
        run: cargo fmt --check

      - name: Clippy (strict)
        run: >
          cargo clippy --all-targets

      - name: Tests
        run: cargo nextest run

