name: PR

on:
  pull_request:
    branches: ["main"]

env:
  CARGO_TERM_COLOR: always

jobs:
  build:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v3

      # Install Just to run CI scripts
      - uses: extractions/setup-just@v2

      # Install Rust with clippy/rustfmt
      - uses: actions-rust-lang/setup-rust-toolchain@v1
        with:
          components: clippy, rustfmt

      # Install Shear to find unused dependencies
      - uses: cargo-bins/cargo-binstall@main
      - run: cargo binstall --no-confirm --force cargo-shear

      # Make sure u guys don't write bad code
      - run: just check
      - run: just test
