name: Test

on: [push, pull_request, workflow_dispatch]

env:
  FORCE_COLOR: 1

jobs:
  test:
    runs-on: ${{ matrix.os }}
    strategy:
      fail-fast: false
      matrix:
        python-version: ["pypy3.9", "3.9", "3.10", "3.11", "3.12", "3.13"]
        os: [windows-latest, macos-latest, ubuntu-latest]

    steps:
      - uses: actions/checkout@v5

      - name: Set up Python ${{ matrix.python-version }}
        uses: actions/setup-python@v6
        with:
          python-version: ${{ matrix.python-version }}
          allow-prereleases: true
          cache: pip
          cache-dependency-path: pyproject.toml

      - name: Install dependencies
        run: |
          python -m pip install -e .[test]

      - name: Lint
        run: |
          ruff format --check sphinxcontrib
          ruff check sphinxcontrib
  
      - name: Test
        run: |
          pytest
