name: test
on:
  push:
  pull_request:
  workflow_dispatch:
  schedule:
    - cron: '0 0 * * 2'
jobs:
  linter:
    uses: ./.github/workflows/linter.yml
  coverage:
    uses: ./.github/workflows/coverage.yml
  docs:
    uses: ./.github/workflows/docs.yml
  frozen-version:
    runs-on: ubuntu-24.04
    steps:
    - uses: actions/checkout@v6
      with:
        fetch-depth: 0
    - uses: actions/setup-python@v6
      with:
        python-version: "3.x"
    - name: Run frozen version test
      run: bash mpmath/tests/test_version_frozen.sh
  tests:
    needs:
      - linter
      - coverage
      - frozen-version
    runs-on: ubuntu-24.04
    strategy:
      fail-fast: false
      matrix:
        python-version: [3.9, '3.10', 3.11, 3.12, 3.13, 3.14, 3.13t, 3.14t]
        nogmpy: [false]
        purepy: [false]
        include:
          - python-version: "3.x"
            nogmpy: true
          - python-version: "3.x"
            purepy: true
          - python-version: pypy3.11
            purepy: true
    env:
      PYTEST_ADDOPTS: -n auto
    steps:
    - uses: actions/checkout@v6
      with:
        fetch-depth: 0
    - name: Set up Python ${{ matrix.python-version }}
      uses: actions/setup-python@v6
      with:
        python-version: ${{ matrix.python-version }}
        allow-prereleases: true
    - name: Install dependencies
      run: |
        pip install --upgrade setuptools pip
        pip install --upgrade .[develop,gmpy2,gmp,ci]
    - run: pip uninstall -y gmpy2
      if: matrix.nogmpy
    - run: pip uninstall -y gmpy2 python-gmp
      if: matrix.purepy
    - run: pytest
