|
4 | 4 | # Rebuild Sphinx docs from scratch and check generated files match those checked |
5 | 5 | # in |
6 | 6 |
|
7 | | -set -eux -o pipefail |
| 7 | +set -euo pipefail |
| 8 | + |
| 9 | +THIS_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" |
| 10 | +PROJECT_ROOT_DIR=${THIS_DIR}/../.. |
| 11 | +DOCS_DIR=${PROJECT_ROOT_DIR}/docs |
| 12 | +VENV_DIR=${HOME}/venv |
| 13 | + |
| 14 | +cd "${PROJECT_ROOT_DIR}" |
8 | 15 |
|
9 | 16 | sudo apt-get install texlive-latex-extra dvipng |
10 | | -python -m venv "${HOME}/venv" |
11 | | -source "${HOME}/venv/bin/activate" |
12 | | -python -VV |
13 | | -python -m site |
14 | | -python -m pip install -U pip |
15 | | -echo installing pip packages |
16 | | -python -m pip install -r docs/docs_requirements.txt |
17 | | -python -m pip install -e . |
| 17 | +PYTHON=${VENV_DIR}/bin/python |
| 18 | +echo Installing pip packages for docs |
| 19 | +${PYTHON} -m pip install -r "${DOCS_DIR}/docs_requirements.txt" |
18 | 20 | ######################################################################################## |
19 | | -cd "${GITHUB_WORKSPACE}/docs" |
20 | 21 | echo Creating autodocs |
21 | | -python ./create_all_autodocs.py --make --destroy_first |
22 | | -cd "${GITHUB_WORKSPACE}" |
| 22 | +${PYTHON} "${DOCS_DIR}/create_all_autodocs.py" --make --destroy_first |
23 | 23 | echo Checking if files generated by create_all_autodocs need to be checked in |
24 | 24 | git diff |
25 | 25 | git update-index --refresh |
26 | 26 | git diff-index --quiet HEAD -- |
27 | 27 | test -z "$(git ls-files --exclude-standard --others)" |
28 | | -cd docs |
29 | 28 | echo Rebuilding docs |
30 | | -python ./rebuild_docs.py --warnings_as_errors |
| 29 | + |
| 30 | +# Have to be in the virtualenv for sphinx-build to be picked up. |
| 31 | +source "${VENV_DIR}"/bin/activate |
| 32 | +python "${DOCS_DIR}/rebuild_docs.py" --warnings_as_errors |
31 | 33 | echo Checking if files generated by rebuild_docs need to be checked in |
32 | 34 | git diff |
33 | 35 | git update-index --refresh |
|
0 commit comments