From 5d1a0a37fe37348930915ffed4d523f424636a19 Mon Sep 17 00:00:00 2001 From: lsetiawan Date: Thu, 11 Mar 2021 09:52:10 -0800 Subject: [PATCH 01/10] Adding extra docs requirements and tweak conf --- doc/source/conf.py | 25 +++++++++++++++++++++++++ requirements-docs.txt | 3 +++ 2 files changed, 28 insertions(+) diff --git a/doc/source/conf.py b/doc/source/conf.py index 46886f59e..cb376f7c9 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -10,8 +10,10 @@ # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. # +import contextlib import os import sys +from pkg_resources import DistributionNotFound, get_distribution sys.path.insert(0, os.path.abspath("../..")) sys.path.insert(0, os.path.abspath("../sphinxext")) @@ -29,6 +31,29 @@ # -- General configuration --------------------------------------------------- +@contextlib.contextmanager +def chdir(directory): + curdir = os.curdir + try: + os.chdir(directory) + yield + finally: + os.chdir(curdir) + + +try: + dist = get_distribution(project) +except DistributionNotFound: + # The project is not installed in readthedocs environment (requires LDAP + # bindings). Read the version with setuptools_scm. + import setuptools_scm + + with chdir("../.."): + release = setuptools_scm.get_version() +else: + release = dist.version +version = ".".join(release.split(".")[:2]) + # Add any Sphinx extension module names here, as strings. They can be # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom # ones. diff --git a/requirements-docs.txt b/requirements-docs.txt index d2f785927..d512f963a 100644 --- a/requirements-docs.txt +++ b/requirements-docs.txt @@ -4,3 +4,6 @@ numpydoc pybtex pygithub sphinxcontrib-bibtex +setuptools_scm +recommonmark +sphinx_rtd_theme From 3b9ab003a45e00cb80830df83ece01a98fe5aef9 Mon Sep 17 00:00:00 2001 From: lsetiawan Date: Thu, 11 Mar 2021 09:53:51 -0800 Subject: [PATCH 02/10] Move code to project information section --- doc/source/conf.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/source/conf.py b/doc/source/conf.py index cb376f7c9..c1c0bcb65 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -29,8 +29,6 @@ year = datetime.date.today().year copyright = "2019-{}, The icepyx Developers".format(year) -# -- General configuration --------------------------------------------------- - @contextlib.contextmanager def chdir(directory): curdir = os.curdir @@ -54,6 +52,8 @@ def chdir(directory): release = dist.version version = ".".join(release.split(".")[:2]) +# -- General configuration --------------------------------------------------- + # Add any Sphinx extension module names here, as strings. They can be # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom # ones. From 2022505303ec2ad6fc8b4e37b5f4a3c3e298c16a Mon Sep 17 00:00:00 2001 From: lsetiawan Date: Thu, 11 Mar 2021 12:05:13 -0800 Subject: [PATCH 03/10] Remove unecessary imports --- doc/source/conf.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/doc/source/conf.py b/doc/source/conf.py index c1c0bcb65..7097c49a9 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -19,9 +19,6 @@ sys.path.insert(0, os.path.abspath("../sphinxext")) import datetime -import icepyx -import recommonmark - # -- Project information ----------------------------------------------------- From d85cc0b19345dd3a238635e06a5c1fa8815c817d Mon Sep 17 00:00:00 2001 From: lsetiawan Date: Thu, 11 Mar 2021 12:05:37 -0800 Subject: [PATCH 04/10] Add doc build workflow --- .github/workflows/doc.yml | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) 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..5f4173231 --- /dev/null +++ b/.github/workflows/doc.yml @@ -0,0 +1,36 @@ +name: Documentation Build + +on: + push: + paths: + - "doc/**" + pull_request: + paths: + - "doc/**" + +jobs: + build: + # We want to run on external PRs, but not on our own internal PRs as they'll be run + # by the push to the branch. Without this if check, checks are duplicated since + # internal PRs match both the push and pull_request events. + if: + github.event_name == 'push' || github.event.pull_request.head.repo.full_name != + github.repository + + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - name: Set up Python 3.7 + uses: actions/setup-python@v2 + with: + python-version: 3.7 + + - name: Install dependencies + run: | + python -m pip install --upgrade pip setuptools wheel + python -m pip install -r "requirements.txt" + python -m pip install -r "requirements-docs.txt" + python -m pip install -e "." + - name: Build documentation + run: sphinx-build -a -b html -W doc/source/ doc/build/ \ No newline at end of file From cd26650437774b8a4ef712b876080050a183b750 Mon Sep 17 00:00:00 2001 From: lsetiawan Date: Thu, 11 Mar 2021 12:09:41 -0800 Subject: [PATCH 05/10] Change build to use make --- .github/workflows/doc.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/doc.yml b/.github/workflows/doc.yml index 5f4173231..b2444b16c 100644 --- a/.github/workflows/doc.yml +++ b/.github/workflows/doc.yml @@ -33,4 +33,4 @@ jobs: python -m pip install -r "requirements-docs.txt" python -m pip install -e "." - name: Build documentation - run: sphinx-build -a -b html -W doc/source/ doc/build/ \ No newline at end of file + run: make --directory=doc html \ No newline at end of file From 80eb8734ffafc380738ce22b509f331ff337b556 Mon Sep 17 00:00:00 2001 From: lsetiawan Date: Thu, 11 Mar 2021 12:11:42 -0800 Subject: [PATCH 06/10] Include changes to doc workflow file --- .github/workflows/doc.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/doc.yml b/.github/workflows/doc.yml index b2444b16c..4631754f1 100644 --- a/.github/workflows/doc.yml +++ b/.github/workflows/doc.yml @@ -4,9 +4,11 @@ on: push: paths: - "doc/**" + - "**/doc.yaml" pull_request: paths: - "doc/**" + - - "**/doc.yaml" jobs: build: From a4f01b62b924e81f4938f90e20a9dc4271aafc7a Mon Sep 17 00:00:00 2001 From: lsetiawan Date: Thu, 11 Mar 2021 12:13:21 -0800 Subject: [PATCH 07/10] Ooops fix typo --- .github/workflows/doc.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/doc.yml b/.github/workflows/doc.yml index 4631754f1..becea074a 100644 --- a/.github/workflows/doc.yml +++ b/.github/workflows/doc.yml @@ -8,7 +8,7 @@ on: pull_request: paths: - "doc/**" - - - "**/doc.yaml" + - "**/doc.yaml" jobs: build: From 8380d2db46dbfb0b20b8469c19144d250d110e5d Mon Sep 17 00:00:00 2001 From: lsetiawan Date: Thu, 11 Mar 2021 12:15:08 -0800 Subject: [PATCH 08/10] Last attempt ... should be yml not yaml --- .github/workflows/doc.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/doc.yml b/.github/workflows/doc.yml index becea074a..633f40b0a 100644 --- a/.github/workflows/doc.yml +++ b/.github/workflows/doc.yml @@ -4,11 +4,11 @@ on: push: paths: - "doc/**" - - "**/doc.yaml" + - "**/doc.yml" pull_request: paths: - "doc/**" - - "**/doc.yaml" + - "**/doc.yml" jobs: build: From c0dfe19afccdb910ee94741906fc52ae7d5aca0f Mon Sep 17 00:00:00 2001 From: lsetiawan Date: Thu, 11 Mar 2021 12:20:23 -0800 Subject: [PATCH 09/10] Add pandoc and watch for requirements-docs.txt --- .github/workflows/doc.yml | 2 ++ requirements-docs.txt | 1 + 2 files changed, 3 insertions(+) diff --git a/.github/workflows/doc.yml b/.github/workflows/doc.yml index 633f40b0a..efcdcbe1e 100644 --- a/.github/workflows/doc.yml +++ b/.github/workflows/doc.yml @@ -5,10 +5,12 @@ on: paths: - "doc/**" - "**/doc.yml" + - "requirements-docs.txt" pull_request: paths: - "doc/**" - "**/doc.yml" + - "requirements-docs.txt" jobs: build: diff --git a/requirements-docs.txt b/requirements-docs.txt index d512f963a..ab4d7e637 100644 --- a/requirements-docs.txt +++ b/requirements-docs.txt @@ -1,6 +1,7 @@ gitpython nbsphinx numpydoc +pandoc pybtex pygithub sphinxcontrib-bibtex From d827547cdaacfd42c03213b69aea1fab45e94fec Mon Sep 17 00:00:00 2001 From: lsetiawan Date: Thu, 11 Mar 2021 12:48:05 -0800 Subject: [PATCH 10/10] Be more explicit and remove req install in workflow --- .github/workflows/doc.yml | 1 - readthedocs.yml | 3 +++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/doc.yml b/.github/workflows/doc.yml index efcdcbe1e..017480b5d 100644 --- a/.github/workflows/doc.yml +++ b/.github/workflows/doc.yml @@ -33,7 +33,6 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip setuptools wheel - python -m pip install -r "requirements.txt" python -m pip install -r "requirements-docs.txt" python -m pip install -e "." - name: Build documentation diff --git a/readthedocs.yml b/readthedocs.yml index b969696f8..827bf74de 100644 --- a/readthedocs.yml +++ b/readthedocs.yml @@ -22,3 +22,6 @@ python: install: - requirements: requirements-docs.txt - requirements: requirements.txt + - method: pip + path: . + system_packages: true