From 08385c0179e77cb01a9df1011c63f615f676b663 Mon Sep 17 00:00:00 2001 From: jlaehne Date: Thu, 21 Dec 2023 22:40:03 +0100 Subject: [PATCH] add doc workflow --- .github/workflows/doc.yml | 54 +++++++++++++++++++++++++++++++++++++++ doc/conf.py | 2 +- setup.py | 4 +-- 3 files changed, 57 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/doc.yml diff --git a/.github/workflows/doc.yml b/.github/workflows/doc.yml new file mode 100644 index 000000000..9801077b1 --- /dev/null +++ b/.github/workflows/doc.yml @@ -0,0 +1,54 @@ +name: Documentation + +on: [push, pull_request] + +jobs: + build: +name: Build documentation + +jobs: + build: + # This build is to make PR comments for the sphinx warning and check if + # web links are not broken + name: Documentation: Check links and make PR comments + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - uses: actions/setup-python@v5 + name: Install Python + with: + python-version: '3.11' + + - name: Install build docs + shell: bash -l {0} + run: | + pip install .'doc' + +# - name: Run doctest +# shell: bash -l {0} +# run: | +# cd ./doc +# pytest --doctest-modules --doctest-glob="*.rst" -n 2 -v + + # Add sphinx warnings as PR comments + - uses: sphinx-doc/sphinx-problem-matcher@master + + - name: Build documentation + shell: bash -l {0} + run: | + cd ./doc + make SPHINXOPTS="-W --keep-going" html + + - uses: actions/upload-artifact@v4 + with: + path: ./doc/_build/html/ + name: doc_html + + - name: Check links + shell: bash -l {0} + run: | + cd ./doc + make linkcheck diff --git a/doc/conf.py b/doc/conf.py index 1e2134b3e..d4ca83000 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -27,7 +27,7 @@ "sphinx.ext.mathjax", "sphinx.ext.graphviz", "sphinx.ext.autosummary", - "sphinx_toggleprompt", + "sphinx_copybutton", ] intersphinx_mapping = { diff --git a/setup.py b/setup.py index f75372e56..2d8933e38 100644 --- a/setup.py +++ b/setup.py @@ -60,10 +60,10 @@ extras_require={ "tests": ["pytest>=5.0"], "coverage": ["pytest-cov", "codecov"], - "build-doc": [ + "doc": [ "sphinx>=4.3.0", "sphinx_rtd_theme>=0.5.1", - "sphinx-toggleprompt", + "sphinx-copybutton", ], }, package_data={