From f63f5255446d3fbf8f71f8a31fe03cf1f91bc7f9 Mon Sep 17 00:00:00 2001 From: Mark Dickinson Date: Wed, 22 Mar 2023 16:28:17 +0000 Subject: [PATCH 1/6] Add documentation build workflow --- .github/workflows/doc-requirements.txt | 3 +++ .github/workflows/test-doc-build.yml | 19 +++++++++++++++++++ 2 files changed, 22 insertions(+) create mode 100644 .github/workflows/doc-requirements.txt create mode 100644 .github/workflows/test-doc-build.yml diff --git a/.github/workflows/doc-requirements.txt b/.github/workflows/doc-requirements.txt new file mode 100644 index 000000000..3eee61b9f --- /dev/null +++ b/.github/workflows/doc-requirements.txt @@ -0,0 +1,3 @@ +enthought-sphinx-theme +sphinx +sphinx-copybutton diff --git a/.github/workflows/test-doc-build.yml b/.github/workflows/test-doc-build.yml new file mode 100644 index 000000000..2c5e8dd88 --- /dev/null +++ b/.github/workflows/test-doc-build.yml @@ -0,0 +1,19 @@ +name: Test the documentation build + +on: [pull_request, workflow_dispatch] + +jobs: + docs: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 + with: + python-version: '3.11' + cache: 'pip' + cache-dependency-path: '.github/workflows/doc-requirements.txt' + - run: python -m pip install -r .github/workflows/doc-requirements.txt + - run: | + python -m sphinx.ext.apidoc --separate --no-toc -o docs/source/api -t docs/source/api/templates envisage */tests + python -m sphinx -b html docs/source docs/build From 0b4f9c7257304ad27293e371b49aa96a10a06092 Mon Sep 17 00:00:00 2001 From: Mark Dickinson Date: Wed, 22 Mar 2023 16:34:24 +0000 Subject: [PATCH 2/6] Fix configuration --- docs/source/conf.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/source/conf.py b/docs/source/conf.py index 6e50918af..049e75e70 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -18,7 +18,8 @@ # All configuration values have a default value; values that are commented out # serve to show the default value. -import envisage +import importlib.metadata + import enthought_sphinx_theme # If your extensions are in another directory, add it here. If the directory @@ -57,7 +58,7 @@ # The default replacements for |version| and |release|, also used in various # other places throughout the built documents. -version = release = envisage.__version__ +version = release = importlib.metadata.version("envisage") # There are two options for replacing |today|: either, you set today to some # non-false value, then it is used: From 3bf541f05afe0c8dc27970ae5441e068aa44cfa4 Mon Sep 17 00:00:00 2001 From: Mark Dickinson Date: Wed, 22 Mar 2023 16:35:50 +0000 Subject: [PATCH 3/6] Also build the local package --- .github/workflows/test-doc-build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test-doc-build.yml b/.github/workflows/test-doc-build.yml index 2c5e8dd88..85413c2c6 100644 --- a/.github/workflows/test-doc-build.yml +++ b/.github/workflows/test-doc-build.yml @@ -14,6 +14,7 @@ jobs: cache: 'pip' cache-dependency-path: '.github/workflows/doc-requirements.txt' - run: python -m pip install -r .github/workflows/doc-requirements.txt + - run: python -m pip install . - run: | python -m sphinx.ext.apidoc --separate --no-toc -o docs/source/api -t docs/source/api/templates envisage */tests python -m sphinx -b html docs/source docs/build From 31b2c8cd716eb0286843fddce04a1f7d533e5336 Mon Sep 17 00:00:00 2001 From: Mark Dickinson Date: Thu, 23 Mar 2023 14:14:41 +0000 Subject: [PATCH 4/6] Move doctrees out of build dir, upload artifact --- .github/workflows/test-doc-build.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test-doc-build.yml b/.github/workflows/test-doc-build.yml index 85413c2c6..ac2d84cba 100644 --- a/.github/workflows/test-doc-build.yml +++ b/.github/workflows/test-doc-build.yml @@ -17,4 +17,8 @@ jobs: - run: python -m pip install . - run: | python -m sphinx.ext.apidoc --separate --no-toc -o docs/source/api -t docs/source/api/templates envisage */tests - python -m sphinx -b html docs/source docs/build + python -m sphinx -b html -d docs/build/doctrees docs/source docs/build/html + - uses: actions/upload-artifact@v3 + with: + name: documentation + path: docs/build/html/ From c27d25e2b0b8539473c80cf4ebbaf6849ec8fcb6 Mon Sep 17 00:00:00 2001 From: Mark Dickinson Date: Thu, 23 Mar 2023 14:22:38 +0000 Subject: [PATCH 5/6] Try removing the slash to see if this gives us the containing html directory --- .github/workflows/test-doc-build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-doc-build.yml b/.github/workflows/test-doc-build.yml index ac2d84cba..7a16eb89f 100644 --- a/.github/workflows/test-doc-build.yml +++ b/.github/workflows/test-doc-build.yml @@ -21,4 +21,4 @@ jobs: - uses: actions/upload-artifact@v3 with: name: documentation - path: docs/build/html/ + path: docs/build/html From ed3f3d982bf955d73f37eb659a303bad820ddf91 Mon Sep 17 00:00:00 2001 From: Mark Dickinson Date: Thu, 23 Mar 2023 14:32:13 +0000 Subject: [PATCH 6/6] Sneaky solution to making sure we get the enclosing html directory --- .github/workflows/test-doc-build.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test-doc-build.yml b/.github/workflows/test-doc-build.yml index 7a16eb89f..da2303cee 100644 --- a/.github/workflows/test-doc-build.yml +++ b/.github/workflows/test-doc-build.yml @@ -21,4 +21,6 @@ jobs: - uses: actions/upload-artifact@v3 with: name: documentation - path: docs/build/html + path: | + docs/build/ + !docs/build/doctrees/