name: Test the documentation build

on: [pull_request, workflow_dispatch]

jobs:
  docs:
    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v4
    - uses: actions/setup-python@v5
      with:
        python-version: '3.11'
        cache: 'pip'
        cache-dependency-path: 'docs/requirements.txt'
    - run: |
        python -m pip install -r docs/requirements.txt
        python -m pip install .
    - run: |
        python -m sphinx -b html -d docs/build/doctrees docs/source docs/build/html
    - uses: actions/upload-artifact@v4
      with:
        name: documentation
        path: |
          docs/build/
          !docs/build/doctrees/
