name: CI

on:
  push:
    branches: ["**"]
  pull_request:

permissions:
  contents: read

jobs:
  test:
    name: Rust checks
    runs-on: ubuntu-latest

    steps:
      - name: Checkout
        uses: actions/checkout@v4

      - name: Setup Rust
        uses: dtolnay/rust-toolchain@stable
        with:
          toolchain: "stable"
          components: rustfmt, clippy

      - name: Cache
        uses: Swatinem/rust-cache@v2

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

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

      - name: Tests
        run: cargo test --all-targets --all-features --locked
