name: Rust

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

env:
  CARGO_TERM_COLOR: always

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
    - run: rustup update --no-self-update 1.75
    - run: rustup component add rustfmt clippy --toolchain 1.75
    - run: rustup default 1.75
    - run: rustc --version
    - uses: actions/checkout@v4
    - run: cargo fmt -- --check
    - run: cargo build
    - run: cargo clippy -- -Dwarnings
    - run: cargo test
