---
name: Tests
on:
  push:
    # This should disable running the workflow on tags, according to the
    # on.<push|pull_request>.<branches|tags> GitHub Actions docs.
    branches:
      - "*"
  pull_request:

jobs:

  linux-tests:
    runs-on: ${{ matrix.os }}
    strategy:
      fail-fast: false
      matrix:
        python-version:
          - "3.8"
          - "3.9"
          - "3.10"
          - "3.11"
          - "3.12"
          - "3.13"
          - "3.13t"
          - "3.14"
          - "3.14t"
          - "pypy-3.8"
          - "pypy-3.9"
          - "pypy-3.10"
        os:
          - ubuntu-24.04

    steps:
      - name: Checkout repos
        uses: actions/checkout@v4

      - name: Set up Python
        uses: actions/setup-python@v5
        with:
          python-version: ${{matrix.python-version}}
          allow-prereleases: true
          architecture: x64

      - name: Install Tox
        run: pip install tox

      - name: Run tests
        run: tox -e ${{matrix.python-version}} -- -vrsx --color=yes


  windows-tests:
    runs-on: windows-latest
    strategy:
      fail-fast: false
      matrix:
        python-version:
          - 3.8
          - 3.9
          - "3.10"
          - "3.11"
          - "3.12"
          - "3.13"
          - "3.13t"
          - "3.14"
          - "3.14t"
        architecture: ['x64', 'x86']

    steps:
      - name: Checkout repos
        uses: actions/checkout@v4

      - name: Set up Python ${{matrix.python-version}}
        uses: actions/setup-python@v5
        with:
          python-version: ${{matrix.python-version}}
          allow-prereleases: true
          architecture: ${{matrix.architecture}}

      - name: Install Tox
        run: pip install tox

      - name: Run tests
        run: tox -e ${{matrix.python-version}} -- -vrsx --color=yes


  macos-tests:
    runs-on: ${{ matrix.os }}
    strategy:
      fail-fast: false
      matrix:
        python-version:
          - "3.11"
          - "3.12"
          - "3.13"
          - "3.13t"
          - "3.14"
          - "3.14t"
        os:
          - macos-latest
        include:
          - python-version: 3.8
            os: macos-13
          - python-version: 3.9
            os: macos-13
          - python-version: "3.10"
            os: macos-13

    steps:
      - name: Checkout repos
        uses: actions/checkout@v4

      - name: Set up Python ${{matrix.python-version}}
        uses: actions/setup-python@v5
        with:
          python-version: ${{matrix.python-version}}
          allow-prereleases: true

      - name: Install Tox
        run: pip install tox

      - name: Run tests
        run: tox -e ${{matrix.python-version}} -- -vrsx --color=yes


  macos-native-python-test:
    runs-on: macos-latest

    steps:
      - name: Checkout repos
        uses: actions/checkout@v4

      - name: Install Tox
        run: xcrun python3 -m pip install tox

      - name: Run tests
        run: |
          export XCODE_PYTHON=`xcrun python3 -c "import sys;print(sys.executable)"`
          $XCODE_PYTHON -c "import sys; print(sys.version)"
          $XCODE_PYTHON -m tox -e xcode -- -vrsx --color=yes
