name: python-versions-test

on:
  push:
    branches:
      - master
  pull_request:
    branches:
      - master

permissions:
  contents: read

jobs:
  build:
    runs-on: ubuntu-latest

    strategy:
      fail-fast: false
      matrix:
        python-version: [ "3.12", "3.13" ]

    steps:
      - uses: actions/checkout@v4
      - name: Set up Python ${{ matrix.python-version }}
        uses: actions/setup-python@v5
        with:
          python-version: ${{ matrix.python-version }}
      - name: Install dependencies
        run: |
          python -m pip install --upgrade pip
          pip install uv flake8
          uv pip install -r pyproject.toml --system --all-extras
          
      - name: Lint with flake8
        # Stop the build if there are Python syntax errors or undefined names
        run: flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics

      - name: Tests
        # Only run tests that do NOT run simulations
        run: ls tests/test*.py | grep -v "test_sim*.*" | xargs -n 1 python -m unittest
