name: CI

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

env:
  CARGO_TERM_COLOR: always

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions-rs/toolchain@v1
        with:
          toolchain: nightly
          components: rustfmt, clippy
      - name: Run fmt
        run: cargo +nightly fmt --check
      - name: Run clippy
        run: cargo clippy --all-targets
      - name: Rust docs
        run: cargo doc
      - name: Deny
        uses: EmbarkStudios/cargo-deny-action@v2
      - name: Unit tests
        run: cargo test

