name: Python tests

on:
  push:
  pull_request:
  schedule:
    - cron: '3 15 * * SUN'

permissions: {}

jobs:
  test:
    name: test with ${{ matrix.env }} on ${{ matrix.os }}
    runs-on: ${{ matrix.os }}
    strategy:
      fail-fast: false
      matrix:
        env: ["3.10", 3.11, 3.12, 3.13, 3.14]
        os: [ubuntu-latest, ubuntu-24.04-arm, macos-latest, windows-latest]
    steps:
      - uses: actions/checkout@v5
        with:
          submodules: true
          persist-credentials: false
      - name: Install the latest version of uv
        uses: astral-sh/setup-uv@3259c6206f993105e3a61b142c2d97bf4b9ef83d # 7.1.0
      - name: Install tox
        run: uv tool install --python-preference only-managed --python 3.14 tox --with tox-uv --with tox-gh
      - name: Install Python
        if: matrix.env != '3.14'
        run: uv python install --python-preference only-managed ${{ matrix.env }}
      - name: Setup test suite
        run: tox run -vv --notest --skip-missing-interpreters false
        env:
          MAXMINDDB_REQUIRE_EXTENSION: 1
          TOX_GH_MAJOR_MINOR: ${{ matrix.env }}
      - name: Run test suite
        run: tox run --skip-pkg-install
        env:
          MAXMINDDB_REQUIRE_EXTENSION: 1
          MM_FORCE_EXT_TESTS: 1
          TOX_GH_MAJOR_MINOR: ${{ matrix.env }}
