name: CI

on:
  push:
    branches: [ main ]
  pull_request:
    branches: [ main ]

env:
  CARGO_TERM_COLOR: always

jobs:
  clippy:
    name: Clippy
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Install Rust
        uses: dtolnay/rust-toolchain@stable
        with:
          components: clippy
      - name: Rust Cache
        uses: Swatinem/rust-cache@v2
        with:
          key: ${{ github.job }}
      - name: Run Clippy
        run: cargo clippy --no-deps --all-features --tests --benches --examples -- -D clippy::all -D clippy::pedantic -D clippy::nursery

  test:
    name: Tests
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Install Rust
        uses: dtolnay/rust-toolchain@stable
      - name: Rust Cache
        uses: Swatinem/rust-cache@v2
        with:
          key: ${{ github.job }}
      - name: Run Tests
        run: cargo test --release