diff --git a/.github/workflows/test_docs_build.yml b/.github/workflows/test_docs_build.yml new file mode 100644 index 0000000000..65a4a8ab49 --- /dev/null +++ b/.github/workflows/test_docs_build.yml @@ -0,0 +1,49 @@ +name: Documentation + +on: + workflow_dispatch: + pull_request: + +env: + PYBAMM_DISABLE_TELEMETRY: "true" + FORCE_COLOR: 3 + PYBAMM_IDAKLU_EXPR_CASADI: OFF + PYBAMM_IDAKLU_EXPR_IREE: OFF + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +jobs: + docs: + runs-on: ubuntu-latest + steps: + + - name: Check out repository + uses: actions/checkout@v4 + + - name: Install Linux system dependencies + uses: awalsh128/cache-apt-pkgs-action@a6c3917cc929dd0345bfb2d3feaf9101823370ad # v1.4.2 + with: + packages: graphviz pandoc + execute_install_scripts: true + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: "3.11" + cache: 'pip' + + - name: Install PyBaMM with [docs,dev,all] + run: | + python -m pip install --upgrade pip + pip install -e .[docs,dev,all] + + - name: Run doctests + run: python -m pytest --doctest-plus src + + - name: Build docs (HTML) + run: sphinx-build -b html -W --keep-going -d docs/_build/.doctrees docs docs/_build + + - name: Run Sphinx linkcheck + run: sphinx-build -b linkcheck -d docs/_build/.doctrees docs docs/_build diff --git a/.github/workflows/test_on_push.yml b/.github/workflows/test_on_push.yml index 3443279414..ccbc5a13e3 100644 --- a/.github/workflows/test_on_push.yml +++ b/.github/workflows/test_on_push.yml @@ -130,50 +130,7 @@ jobs: - name: Run integration tests for ${{ matrix.os }} with Python ${{ matrix.python-version }} run: python -m nox -s integration - # Skips IDAKLU module compilation for speedups, which is already tested in other jobs. - run_doctests: - runs-on: ubuntu-latest - strategy: - fail-fast: false - name: Doctests (ubuntu-latest / Python 3.11) - - steps: - - name: Check out PyBaMM repository - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - with: - fetch-depth: 0 - - - name: Install Linux system dependencies - uses: awalsh128/cache-apt-pkgs-action@a6c3917cc929dd0345bfb2d3feaf9101823370ad # v1.4.2 - with: - packages: graphviz pandoc - execute_install_scripts: true - - # dot -c is for registering graphviz fonts and plugins - - name: Install TeXLive for Linux - run: | - sudo apt-get update - sudo dot -c - sudo apt-get install texlive-latex-extra dvipng - - - name: Set up Python - id: setup-python - uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0 - with: - python-version: 3.11 - cache: 'pip' - - - name: Set up uv - run: python -m pip install uv - - - name: Install nox - run: python -m uv pip install nox[uv] - - - name: Install docs dependencies and run doctests for GNU/Linux - run: python -m nox -s doctests - - name: Check if the documentation can be built for GNU/Linux - run: python -m nox -s docs run_example_tests: runs-on: ubuntu-latest