From 6ba2d23e0922c47c227d520765501d5ca33132df Mon Sep 17 00:00:00 2001 From: jasquat Date: Mon, 26 Jun 2023 11:33:27 -0400 Subject: [PATCH] added build command for docs and created github action w/ burnettk --- .github/workflows/docs.yml | 42 ++++++++++++++++++++++++++++++++++++++ docs/bin/build | 27 ++++++++++++++++++++++++ 2 files changed, 69 insertions(+) create mode 100644 .github/workflows/docs.yml create mode 100755 docs/bin/build diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml new file mode 100644 index 000000000..461534450 --- /dev/null +++ b/.github/workflows/docs.yml @@ -0,0 +1,42 @@ +name: Docs + +on: + - push + - pull_request + +defaults: + run: + working-directory: docs + +jobs: + build: + name: build-docs + runs-on: ubuntu-latest + steps: + - name: Check out the repository + uses: actions/checkout@v3.3.0 + + - name: Set up Python + uses: actions/setup-python@v4.6.1 + with: + python-version: 3.11 + + - name: Upgrade pip + run: | + pip install --constraint=.github/workflows/constraints.txt pip + pip --version + + - name: Upgrade pip in virtual environments + shell: python + run: | + import os + import pip + + with open(os.environ["GITHUB_ENV"], mode="a") as io: + print(f"VIRTUALENV_PIP={pip.__version__}", file=io) + - name: Pip Install + run: | + pip install -r requirements.txt + - name: Build + run: | + ./bin/build --ci diff --git a/docs/bin/build b/docs/bin/build new file mode 100755 index 000000000..c8fa07819 --- /dev/null +++ b/docs/bin/build @@ -0,0 +1,27 @@ +#!/usr/bin/env bash + +function error_handler() { + >&2 echo "Exited with BAD EXIT CODE '${2}' in ${0} script at line: ${1}." + exit "$2" +} +trap 'error_handler ${LINENO} $?' ERR +set -o errtrace -o errexit -o nounset -o pipefail + +run_ci="false" +if grep -qE -- "--ci\>" <<<"$@" ; then + run_ci="true" +fi + +rm -rf _build/html + +sphinx_command="sphinx-autobuild" +if [[ "$run_ci" == "true" ]]; then + sphinx_command="sphinx-build" +fi + +#>> sphinx-build --help 2>&1 | grep -E '^ +\-[aWn]\>' +# -a write all files (default: only write new and changed +# -j N build in parallel with N processes where possible +# -n nit-picky mode, warn about all missing references +# -W turn warnings into errors +"$sphinx_command" . _build/html -W -a -n -j auto