name: Rust

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

env:
  CARGO_TERM_COLOR: always

jobs:
  QA:
    name: Quality Assurance

    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v4
      - name: Setup nightly toolchain
        run: rustup component add --toolchain nightly-x86_64-unknown-linux-gnu rustfmt
      - name: Check formatting
        run: cargo +nightly fmt --check
      - name: Lint with clippy
        run: cargo clippy --all-features -- -A clippy::multiple_crate_versions -D warnings
      - name: Run tests
        run: cargo test --all-features --verbose
      - name: Build
        run: cargo build --all-features --verbose --release