name: Test Django Simple Captcha

on: [push, pull_request]

jobs:
  build:

    runs-on: ubuntu-latest
    strategy:
      max-parallel: 4
      matrix:
        python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]

    steps:
     - uses: actions/checkout@v4
     - name: Set up Python ${{ matrix.python-version }}
       uses: actions/setup-python@v5
       with:
         python-version: ${{ matrix.python-version }}
     - name: Install dependencies
       run: |
         sudo apt-get install gettext
         python -m pip install --upgrade pip wheel
         pip install tox tox-gh-actions
     - name: Test with tox
       run: tox

  windows:
    runs-on: windows-latest
    strategy:
      matrix:
        python-version:
          - '3.12'
    steps:
      - name: Checkout
        uses: actions/checkout@v4
      - name: Set up Python
        uses: actions/setup-python@v5
        with:
          python-version: ${{ matrix.python-version }}
      - name: Install and upgrade packaging tools
        run: python -m pip install --upgrade pip setuptools wheel
      - run: python -m pip install tox tox-gh-actions
      - name: Run tests
        run: tox

  docs:
    runs-on: ubuntu-latest
    strategy:
      max-parallel: 4
      matrix:
        python-version:
          - '3.12'
    steps:
      - name: Checkout
        uses: actions/checkout@v4
      - name: Set up Python
        uses: actions/setup-python@v5
        with:
          python-version: ${{ matrix.python-version }}
      - name: Install and upgrade packaging tools
        run: python -m pip install --upgrade pip setuptools wheel
      - run: python -m pip install tox tox-gh-actions
      - name: Run tests
        run: tox -e docs

  coverage:
    runs-on: ubuntu-latest
    strategy:
      max-parallel: 4
      matrix:
        python-version:
          - '3.12'
    steps:
      - name: Checkout
        uses: actions/checkout@v4
      - name: Set up Python
        uses: actions/setup-python@v5
        with:
          python-version: ${{ matrix.python-version }}
      - name: Install audio dependencies
        run: sudo apt-get install sox flite
      - name: Install and upgrade packaging tools
        run: python -m pip install --upgrade pip setuptools wheel
      - run: python -m pip install tox tox-gh-actions
      - name: Run tests
        run: tox -e coverage
        env:
          CAPTCHA_FLITE_PATH: '/usr/bin/flite'
          CAPTCHA_SOX_PATH: '/usr/bin/sox'

  gettext:
    runs-on: ubuntu-latest
    strategy:
      max-parallel: 4
      matrix:
        python-version:
          - '3.12'
    steps:
      - name: Checkout
        uses: actions/checkout@v4
      - name: Set up Python
        uses: actions/setup-python@v5
        with:
          python-version: ${{ matrix.python-version }}
      - name: Install dependencies
        run: sudo apt-get install gettext
      - name: Install and upgrade packaging tools
        run: python -m pip install --upgrade pip setuptools wheel
      - run: python -m pip install tox tox-gh-actions
      - name: Run tests
        run: tox -e gettext

  flake8:
    runs-on: ubuntu-latest
    strategy:
      max-parallel: 4
      matrix:
        python-version:
          - '3.12'
    steps:
      - name: Checkout
        uses: actions/checkout@v4
      - name: Set up Python
        uses: actions/setup-python@v5
        with:
          python-version: ${{ matrix.python-version }}
      - name: Install and upgrade packaging tools
        run: python -m pip install --upgrade pip setuptools wheel
      - run: python -m pip install tox tox-gh-actions
      - name: Run tests
        run: tox -e flake8
