name: Continuous Integration

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

env:
  CARGO_TERM_COLOR: always

jobs:
  lint-and-test:
    name: Lint and Test
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - name: Install Rust Toolchain
        uses: dtolnay/rust-toolchain@stable
        with:
          components: rustfmt, clippy

      - name: Cache Dependencies
        uses: Swatinem/rust-cache@v2

      - name: Check Formatting
        run: cargo fmt --all --check

      - name: Run Clippy
        run: cargo clippy -- -D warnings

      - name: Run Tests
        run: cargo test --verbose
