name: Checks

on:
  pull_request:
    branches:
      - main
      - "*"
  push:
    branches:
      - main

jobs:
  lint:
    name: Formatting
    runs-on: ubuntu-latest
    steps:
      - name: Checkout code
        uses: actions/checkout@v4
        with: 
          fetch-depth: 1

      - name: install format tools
        run: pip install -r .github/requirements/requirements-lint.txt

      - name: Run Format Checks
        run: make format-check RUN_GLOBAL=1
  
  check-deps:
    name: Check dependencies
    runs-on: ubuntu-latest
    steps:
      - name: Checkout code
        uses: actions/checkout@v4
        with:
          fetch-depth: 1

      - name: Set up Python
        uses: actions/setup-python@v5
        with:
          python-version: '3.11'

      - name: set up uv
        run: curl -LsSf https://astral.sh/uv/install.sh | sh

      - name: check dependencies
        run: make dep-check
  
  test:
    name: Test and Lint
    runs-on: ubuntu-latest
    # needs: [lint, check-deps] # for conditionally running this job
    strategy:
      matrix:
        versions:
          - python: '3.8'
          - python: '3.9'
          - python: '3.10'
          - python: '3.11'
          - python: '3.12'
          - python: '3.13'
    steps:
      - name: Checkout code
        uses: actions/checkout@v4
        with: 
          fetch-depth: 1

      - name: Set up python
        uses: actions/setup-python@v5
        with:
          python-version: ${{ matrix.versions.python }}

      - name: set up uv
        run: curl -LsSf https://astral.sh/uv/install.sh | sh

      - name: install
        run: make setup
      
      - name: tests
        run: make test

      - name: check typing
        run: make typing