name: CI

on:
  push:
  workflow_dispatch:

jobs:
  lint:
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        os: [ubuntu-latest]
    steps:
      - uses: actions/checkout@v4
      - name: Install Nix
        uses: cachix/install-nix-action@02a151ada4993995686f9ed4f1be7cfbb229e56f

      - name: Restore binary cache
        uses: asa1984/infra/.github/actions/binary-cache@44165003348ea3578a66f8c879bfaf23a3c7cc18
        with:
          package: .#ci


      - run: nix profile install .#ci

      - uses: Swatinem/rust-cache@v2

      - run: cargo clippy --all-features -- -D warnings
      - name: Spell Check Repo
        run: typos .
  test:
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        os: [ubuntu-latest]
    steps:
      - uses: actions/checkout@v4
      - name: Install Nix
        uses: cachix/install-nix-action@02a151ada4993995686f9ed4f1be7cfbb229e56f

      - name: Restore binary cache
        uses: asa1984/infra/.github/actions/binary-cache@44165003348ea3578a66f8c879bfaf23a3c7cc18
        with:
          package: .#ci

      - run: nix profile install .#ci

      - uses: Swatinem/rust-cache@v2

      - run: cargo nextest run
      - run: cargo test --doc
