name: Test Runner

on:
  push:
    branches:
      - main
      - dev
  pull_request:
    branches:
      - main
      - dev

jobs:
  test:
    name: Execute tests
    runs-on: ubuntu-latest
    strategy:
      matrix:
        python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]

    steps:
      - uses: actions/checkout@v2
      - name: Set up Python ${{ matrix.python-version }}
        uses: actions/setup-python@main
        with:
          python-version: ${{ matrix.python-version }}

      - name: Run mypy
        if: matrix.python-version == '3.12'
        run: |
          pip install .
          pip install -e .[dev]
          mypy stac_validator/

      - name: Run pre-commit
        if: matrix.python-version == 3.12
        run: |
          pre-commit install
          pre-commit autoupdate
          pre-commit run --all-files

      - name: Run tox
        run: |
          pip install tox
          tox -e py
