name: Tests

on:
  push:
    branches:
      - master
  pull_request:

jobs:
  build:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        name: [
          "py310",
          "py311",
          "py312",
          "py313",
          "py314",
        ]
        include:
          - name: py310
            python-version: "3.10"
            tox_env: py310
          - name: py311
            python-version: "3.11"
            tox_env: py311
          - name: py312
            python-version: "3.12"
            tox_env: py312
          - name: py313
            python-version: "3.13"
            tox_env: py313
          - name: py314
            python-version: "3.14"
            tox_env: py314
    steps:
      - name: Checkout
        uses: actions/checkout@v2
      - name: Setup Python ${{ matrix.python-version }}
        uses: actions/setup-python@v2
        with:
          python-version: ${{ matrix.python-version }}
      - name: Before Install
        run: |
          python --version
          uname -a
          lsb_release -a
      - name: Install
        env:
          TOXENV: ${{ matrix.tox_env }}
        run: |
          pip install tox-gh-actions codecov coveralls
          pip --version
          tox --version
      - name: Script
        run: |
          tox run -v
      - name: After Failure
        if: ${{ failure() }}
        run: |
          more .tox/log/* | cat
          more .tox/*/log/* | cat
      - name: Upload to Codecov
        run: |
          tox -e uploadcodecov
        env:
          CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
