name: Test docs

on:
  push:
    branches: [ master ]
    paths: 'doc/**'
  pull_request:
    branches: [ master ]
    paths: 'doc/**'

jobs:
  testdocs:
    name: "Docs build test"
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        os: [ubuntu-22.04]
        python-version: ["3.10"]
    steps:
      - name: Set up cmake
        uses: jwlawson/actions-setup-cmake@v2.0.0
        with:
          cmake-version: ${{ matrix.config.cmake }}
      - name: Set up Python
        uses: actions/setup-python@v5
        with:
          python-version: ${{ matrix.python-version }}
      - name: Update pip and setup venv
        run: python -m pip install --upgrade pip && python -m venv ~/env && . ~/env/bin/activate && echo "PATH=$PATH" >> $GITHUB_ENV
      - name: Clone w/ submodules
        uses: actions/checkout@v4
        with:
          submodules: recursive
      - name: Install Python packages
        run: python -m pip install -r doc/requirements.txt -U
      - name: Build Arbor Docs
        run: |
          mkdir build
          cd build
          cmake .. -DARB_WITH_PYTHON=ON -DARB_BUILD_PYTHON_STUBS=OFF  -DPython3_EXECUTABLE=`which python`
          make html
