name: test

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

env:
  CARGO_TERM_COLOR: always

jobs:
  build:

    runs-on: ubuntu-latest

    steps:
      - name: Checkout code
        uses: actions/checkout@v5
      - name: Install Rust (stable + clippy + rustfmt)
        uses: dtolnay/rust-toolchain@stable
        with:
          components: clippy
        #, rustfmt
        #- name: Check formatting
        #  run: cargo fmt --all --check

      - name: Run Clippy (warnings allowed, otherwise add "-- -D warnings")
        run: cargo clippy --all-targets --all-features
      #1 thread otherwise delete files needs before tests end (safer for CI/CD)
      - name: Tests
        run: cargo test --verbose -- --test-threads=1

