name: Python tests

on: [push, pull_request]

jobs:
  test:

    runs-on: ubuntu-latest
    strategy:
      fail-fast: false
      matrix:
        python:
          - { VERSION: "3.9", TOXENV: "py39",ALLOW_FAILURE: false }
          - { VERSION: "3.10", TOXENV: "py310",ALLOW_FAILURE: false }
          - { VERSION: "3.11", TOXENV: "py311,pep8,pre-commit", ALLOW_FAILURE: false }
          - { VERSION: "3.12", TOXENV: "py312",ALLOW_FAILURE: false }
          - { VERSION: "3.13", TOXENV: "py313",ALLOW_FAILURE: false }
          - { VERSION: "pypy3.10", TOXENV: "pypy", ALLOW_FAILURE: false }

    steps:
      - name: Check out the repository
        uses: actions/checkout@v4.0.0
      - name: Setup Python
        uses: actions/setup-python@v4.7.0
        with:
          python-version: ${{ matrix.PYTHON.VERSION }}
          allow-prereleases: true
      - name: Upgrade pip
        run: |
          pip install -U pip
          pip --version
      - name: Install Tox
        run: |
          pip install -U tox
          tox --version
      - name: Run Tox
        run: tox
        env:
          TOXENV: ${{ matrix.PYTHON.TOXENV }}
