From 7513edcf9edcceb1540489e7ac7b4aa1069cdeec Mon Sep 17 00:00:00 2001 From: Noah Oblath Date: Thu, 29 Jul 2021 16:12:23 -0700 Subject: [PATCH 01/14] Adding a GHA workflow --- .github/workflows/publish.yaml | 68 ++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 .github/workflows/publish.yaml diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml new file mode 100644 index 0000000..0d2ba41 --- /dev/null +++ b/.github/workflows/publish.yaml @@ -0,0 +1,68 @@ +name: Publish + +on: + push: + branches: [ main, develop ] + tags: ['v*.*.*'] + + pull_request: + types: [opened, synchronize, reopened, ready_for_review] + + workflow_dispatch: + +jobs: + + docs: + runs-on: ubuntu-20.04 + # This job only runs for pushed tags + #if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') + needs: [build_and_push] + steps: + - name: Checkout the repo + uses: actions/checkout@v2 + with: + submodules: recursive + - name: Install dependencies + run: | + sudo apt-get update + DEBIAN_FRONTEND=noninteractive sudo apt-get install -y \ + tree \ + doxygen \ + python3-sphinx \ + graphviz + - name: Output location + run: | + export OUTPUT_LOCATION="unknown" + echo "Github ref: $GITHUB_REF" + if [[ $GITHUB_REF == refs/heads/develop ]]; then + echo "Branch is develop" + export OUTPUT_LOCATION=develop + elif [[ $GITHUB_REF == refs/heads/main ]]; then + echo "Branch is main" + export OUTPUT_LOCATION=main + elif [[ $GITHUB_REF == refs/heads/* ]]; then + suffix=${GITHUB_REF#"refs/heads/"} + suffix=$(echo $suffix | tr '/' '-') + echo "Branch is $GITHUB_REF; directory will be $suffix" + export OUTPUT_LOCATION=branches/$suffix + elif [[ $GITHUB_REF == refs/tags/* ]]; then + suffx=${GITHUB_REF#"refs/tags/"} + echo "Tag is $GITHUB_REF; directory will be $suffix" + export OUTPUT_LOCATION=tags/$suffix + fi + echo "Output location: $OUTPUT_LOCATION" + # Persist the output location in future steps + echo "OUTPUT_LOCATION=$OUTPUT_LOCATION" >> $GITHUB_ENV + - name: Build docs + run: | + cd documentation + make html + ls ./build/html + mv ./build/html /tmp/build.html + - name: Deploy + uses: JamesIves/github-pages-deploy-action@4 + with: + branch: gh-pages # The branch the action should deploy to. + folder: /tmp/build.html # The folder the action should deploy. + target-folder: ${{ env.OUTPUT_LOCATION }} + dry-run: false From c4f2d039bc8bd99ae951fc9d30a42ee4d9f86c1e Mon Sep 17 00:00:00 2001 From: Noah Oblath Date: Thu, 29 Jul 2021 16:13:53 -0700 Subject: [PATCH 02/14] Remove job dependency --- .github/workflows/publish.yaml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index 0d2ba41..c2711af 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -13,15 +13,18 @@ on: jobs: docs: + runs-on: ubuntu-20.04 # This job only runs for pushed tags #if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') - needs: [build_and_push] + steps: + - name: Checkout the repo uses: actions/checkout@v2 with: submodules: recursive + - name: Install dependencies run: | sudo apt-get update @@ -30,6 +33,7 @@ jobs: doxygen \ python3-sphinx \ graphviz + - name: Output location run: | export OUTPUT_LOCATION="unknown" @@ -53,12 +57,14 @@ jobs: echo "Output location: $OUTPUT_LOCATION" # Persist the output location in future steps echo "OUTPUT_LOCATION=$OUTPUT_LOCATION" >> $GITHUB_ENV + - name: Build docs run: | cd documentation make html ls ./build/html mv ./build/html /tmp/build.html + - name: Deploy uses: JamesIves/github-pages-deploy-action@4 with: From c279fc69d668e21b793050b0bf6f85ba8df724fb Mon Sep 17 00:00:00 2001 From: Noah Oblath Date: Thu, 29 Jul 2021 16:16:58 -0700 Subject: [PATCH 03/14] Fix the version --- .github/workflows/publish.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index c2711af..730c57c 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -13,7 +13,7 @@ on: jobs: docs: - + runs-on: ubuntu-20.04 # This job only runs for pushed tags #if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') @@ -66,7 +66,7 @@ jobs: mv ./build/html /tmp/build.html - name: Deploy - uses: JamesIves/github-pages-deploy-action@4 + uses: JamesIves/github-pages-deploy-action@4.1.4 with: branch: gh-pages # The branch the action should deploy to. folder: /tmp/build.html # The folder the action should deploy. From 000a0467b5a2cd4ca9c226b085ec8bdca6cea013 Mon Sep 17 00:00:00 2001 From: Noah Oblath Date: Thu, 29 Jul 2021 16:20:07 -0700 Subject: [PATCH 04/14] Don't need to cd --- .github/workflows/publish.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index 730c57c..05cbd8a 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -60,7 +60,6 @@ jobs: - name: Build docs run: | - cd documentation make html ls ./build/html mv ./build/html /tmp/build.html From cadcffdbf59e49b26c35d91ae353b69a7fb97ed5 Mon Sep 17 00:00:00 2001 From: Noah Oblath Date: Thu, 29 Jul 2021 16:48:38 -0700 Subject: [PATCH 05/14] Fixing a bug with the tag output location. Adding PR output location. --- .github/workflows/publish.yaml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index 05cbd8a..6642752 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -50,9 +50,13 @@ jobs: echo "Branch is $GITHUB_REF; directory will be $suffix" export OUTPUT_LOCATION=branches/$suffix elif [[ $GITHUB_REF == refs/tags/* ]]; then - suffx=${GITHUB_REF#"refs/tags/"} + suffix=${GITHUB_REF#"refs/tags/"} echo "Tag is $GITHUB_REF; directory will be $suffix" export OUTPUT_LOCATION=tags/$suffix + elif [[ $GITHUB_REF == refs/pull/* ]]; then + suffix=${GITHUB_HEAD_REF#"refs/heads/"} + echo "Branch is $$GITHUB_HEAD_REF; directory will be $suffix" + export OUTPUT_LOCATION=branches/$suffix fi echo "Output location: $OUTPUT_LOCATION" # Persist the output location in future steps From 5a448f8f967ae324f01cf9d8e11832f164949cf3 Mon Sep 17 00:00:00 2001 From: Noah Oblath Date: Thu, 29 Jul 2021 16:55:41 -0700 Subject: [PATCH 06/14] Fix double $ --- .github/workflows/publish.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index 6642752..2f96469 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -55,7 +55,7 @@ jobs: export OUTPUT_LOCATION=tags/$suffix elif [[ $GITHUB_REF == refs/pull/* ]]; then suffix=${GITHUB_HEAD_REF#"refs/heads/"} - echo "Branch is $$GITHUB_HEAD_REF; directory will be $suffix" + echo "Branch is $GITHUB_HEAD_REF; directory will be $suffix" export OUTPUT_LOCATION=branches/$suffix fi echo "Output location: $OUTPUT_LOCATION" From 35ea8b3a269de31ba3b2f324cda18332e0f9d4c0 Mon Sep 17 00:00:00 2001 From: Noah Oblath Date: Thu, 29 Jul 2021 16:55:56 -0700 Subject: [PATCH 07/14] Initial addition of sphinx-multiversion --- .github/workflows/publish.yaml | 1 + Makefile | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index 2f96469..6556d1a 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -33,6 +33,7 @@ jobs: doxygen \ python3-sphinx \ graphviz + pip install sphinx-multiversion - name: Output location run: | diff --git a/Makefile b/Makefile index 4ab8d13..3bea589 100644 --- a/Makefile +++ b/Makefile @@ -3,7 +3,7 @@ # You can set these variables from the command line. SPHINXOPTS = --color -SPHINXBUILD = sphinx-build +SPHINXBUILD = sphinx-multiversion SOURCEDIR = source BUILDDIR = build From 80ce7f0a26f7eaa2917cfaa837a279c45819c2d5 Mon Sep 17 00:00:00 2001 From: Noah Oblath Date: Thu, 29 Jul 2021 17:37:04 -0700 Subject: [PATCH 08/14] Attempt to use sphinx-multiversion --- .github/workflows/publish.yaml | 10 ++++++---- source/_templates/versioning.html | 8 ++++++++ source/conf.py | 7 ++++++- 3 files changed, 20 insertions(+), 5 deletions(-) create mode 100644 source/_templates/versioning.html diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index 6556d1a..67450d4 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -65,14 +65,16 @@ jobs: - name: Build docs run: | - make html - ls ./build/html + sphinx-multiversion -M html source build --color mv ./build/html /tmp/build.html +# make html +# ls ./build/html +# mv ./build/html /tmp/build.html - name: Deploy uses: JamesIves/github-pages-deploy-action@4.1.4 with: - branch: gh-pages # The branch the action should deploy to. + branch: gh-pages-test # The branch the action should deploy to. folder: /tmp/build.html # The folder the action should deploy. - target-folder: ${{ env.OUTPUT_LOCATION }} +# target-folder: ${{ env.OUTPUT_LOCATION }} dry-run: false diff --git a/source/_templates/versioning.html b/source/_templates/versioning.html new file mode 100644 index 0000000..7c5ab14 --- /dev/null +++ b/source/_templates/versioning.html @@ -0,0 +1,8 @@ +{% if versions %} +

{{ _('Versions') }}

+ +{% endif %} diff --git a/source/conf.py b/source/conf.py index e5b7710..9f5d1b4 100644 --- a/source/conf.py +++ b/source/conf.py @@ -40,6 +40,7 @@ # ones. extensions = [ 'sphinx.ext.githubpages', + 'sphinx_multiversion' ] # Add any paths that contain templates here, relative to this directory. @@ -101,7 +102,11 @@ # default: ``['localtoc.html', 'relations.html', 'sourcelink.html', # 'searchbox.html']``. # -# html_sidebars = {} +html_sidebars = { + '**': [ + 'versioning.html', + ], +} html_logo = 'DL3Logo.png' html_favicon = 'DL3Logo.ico' From 33c21713dba9e519aaf5abd3ca4ab444c983de99 Mon Sep 17 00:00:00 2001 From: Noah Oblath Date: Thu, 29 Jul 2021 17:50:39 -0700 Subject: [PATCH 09/14] Debug attempt --- .github/workflows/publish.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index 67450d4..5c725b3 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -65,7 +65,7 @@ jobs: - name: Build docs run: | - sphinx-multiversion -M html source build --color + sphinx-multiversion --color source build mv ./build/html /tmp/build.html # make html # ls ./build/html From 6ccf134791511756cf9108f194ffe52cfd23ff29 Mon Sep 17 00:00:00 2001 From: Noah Oblath Date: Thu, 29 Jul 2021 17:58:07 -0700 Subject: [PATCH 10/14] Add tag, branch, and remote whitelists for sphinx multiversion --- source/conf.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/source/conf.py b/source/conf.py index 9f5d1b4..84dde3c 100644 --- a/source/conf.py +++ b/source/conf.py @@ -70,6 +70,11 @@ # The name of the Pygments (syntax highlighting) style to use. pygments_style = None +# -- Sphinx-Multiversion configuration --------------------------------------- + +smv_tag_whitelist = r'^v\d+\.\d+\.\d+$' # Include tags like "v2.1.0" +smv_branch_whitelist = r'^.*$' # Include all branches +smv_remote_whitelist = r'^(origin)$' # Use branches from origin and upstream # -- Options for HTML output ------------------------------------------------- From a1d554d8284e61d5c7640df34847090a7e4c0324 Mon Sep 17 00:00:00 2001 From: Noah Oblath Date: Thu, 29 Jul 2021 18:37:35 -0700 Subject: [PATCH 11/14] After a bunch of debugging --- source/_templates/versioning.html | 10 ++++++++-- source/conf.py | 10 ++++++++-- source/index.rst | 5 ----- 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/source/_templates/versioning.html b/source/_templates/versioning.html index 7c5ab14..6f08447 100644 --- a/source/_templates/versioning.html +++ b/source/_templates/versioning.html @@ -1,7 +1,13 @@ {% if versions %} -

{{ _('Versions') }}

+

{{ _('Branches') }}

    - {%- for item in versions %} + {%- for item in versions.branches %} +
  • {{ item.name }}
  • + {%- endfor %} +
+

{{ _('Tags') }}

+ diff --git a/source/conf.py b/source/conf.py index 84dde3c..3bf2413 100644 --- a/source/conf.py +++ b/source/conf.py @@ -73,8 +73,10 @@ # -- Sphinx-Multiversion configuration --------------------------------------- smv_tag_whitelist = r'^v\d+\.\d+\.\d+$' # Include tags like "v2.1.0" -smv_branch_whitelist = r'^.*$' # Include all branches -smv_remote_whitelist = r'^(origin)$' # Use branches from origin and upstream +#smv_tag_whitelist = r'^.*$' # Include all tags +#smv_branch_whitelist = r'^(?!master).*$' # Include all branches +smv_branch_whitelist = r'^(main|develop)$' +smv_remote_whitelist = r'^(origin)$' # Use branches from origin # -- Options for HTML output ------------------------------------------------- @@ -109,6 +111,10 @@ # html_sidebars = { '**': [ + 'globaltoc.html', + 'relations.html', + 'sourcelink.html', + 'searchbox.html', 'versioning.html', ], } diff --git a/source/index.rst b/source/index.rst index 3eff321..81a99c0 100644 --- a/source/index.rst +++ b/source/index.rst @@ -14,11 +14,6 @@ Welcome to Dripline Controls Guide's documentation! logging-data process-management security - - -.. toctree:: - :hidden: - command-line-tools Indices and tables From b210324fc0d0d54b99cb59506f1231dea8d93726 Mon Sep 17 00:00:00 2001 From: Noah Oblath Date: Thu, 29 Jul 2021 18:40:04 -0700 Subject: [PATCH 12/14] Fetch before sphinx? --- .github/workflows/publish.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index 5c725b3..18f12d2 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -65,6 +65,7 @@ jobs: - name: Build docs run: | + git fetch -a sphinx-multiversion --color source build mv ./build/html /tmp/build.html # make html From 82b17e2c8082ce5e0c1ca5e99497ea4d2c5a3823 Mon Sep 17 00:00:00 2001 From: Noah Oblath Date: Thu, 29 Jul 2021 18:42:40 -0700 Subject: [PATCH 13/14] Fix directory --- .github/workflows/publish.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index 18f12d2..16a52e0 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -67,7 +67,7 @@ jobs: run: | git fetch -a sphinx-multiversion --color source build - mv ./build/html /tmp/build.html + mv ./build /tmp/build.html # make html # ls ./build/html # mv ./build/html /tmp/build.html From 33294409885f90747a177fe136f50784098ab8f2 Mon Sep 17 00:00:00 2001 From: Noah Oblath Date: Fri, 24 Sep 2021 10:05:20 -0700 Subject: [PATCH 14/14] Interim commit --- .github/workflows/publish.yaml | 3 --- source/conf.py | 2 +- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index 16a52e0..7340e74 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -68,9 +68,6 @@ jobs: git fetch -a sphinx-multiversion --color source build mv ./build /tmp/build.html -# make html -# ls ./build/html -# mv ./build/html /tmp/build.html - name: Deploy uses: JamesIves/github-pages-deploy-action@4.1.4 diff --git a/source/conf.py b/source/conf.py index 3bf2413..3b97287 100644 --- a/source/conf.py +++ b/source/conf.py @@ -40,7 +40,7 @@ # ones. extensions = [ 'sphinx.ext.githubpages', - 'sphinx_multiversion' + 'sphinx_multiversion', ] # Add any paths that contain templates here, relative to this directory.