diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index 5e4c41b6..01d19f66 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -47,7 +47,7 @@ jobs: - name: Generate and test API docs run: | - make apidocs html + make html env: SPHINXOPTS: "-n -v -W --keep-going" working-directory: ./docs diff --git a/docs/Makefile b/docs/Makefile index a7f0019c..d0c3cbf1 100644 --- a/docs/Makefile +++ b/docs/Makefile @@ -14,11 +14,6 @@ help: .PHONY: help Makefile - -apidocs: - git clean -fdx "$(SOURCEDIR)/ref" - sphinx-apidoc --ext-autodoc --ext-intersphinx --separate --implicit-namespaces --no-toc -o "$(SOURCEDIR)/ref" ../crate - # Catch-all target: route all unknown targets to Sphinx using the new # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). %: Makefile diff --git a/docs/source/crate_operator_ext.py b/docs/source/crate_operator_ext.py index 041db085..9300b1b6 100644 --- a/docs/source/crate_operator_ext.py +++ b/docs/source/crate_operator_ext.py @@ -14,6 +14,8 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . +import pathlib + from docutils.nodes import Element from sphinx.addnodes import pending_xref from sphinx.application import Sphinx @@ -21,6 +23,22 @@ from sphinx.errors import NoUri +def run_apidoc(_): + from sphinx.ext import apidoc + + argv = [ + "--ext-autodoc", + "--ext-intersphinx", + "--separate", + "--implicit-namespaces", + "--no-toc", + "-o", + str(pathlib.Path(__file__).parent / "ref"), + str(pathlib.Path(__file__).parent.parent.parent / "crate"), + ] + apidoc.main(argv) + + def missing_reference( app: Sphinx, env: BuildEnvironment, node: pending_xref, contnode: Element ) -> Element: @@ -49,4 +67,5 @@ def missing_reference( def setup(app): + app.connect("builder-inited", run_apidoc) app.connect("missing-reference", missing_reference)