Skip to content

Commit 065847f

Browse files
committed
docs: add build_docs.sh script, installing debian packages through apt
Replace the `jenskins.sh` script using pip with `make_docs.sh` script expected to run on Ubuntu. For apt install set non-interactive env variable. Update CI to run on `ubuntu-24.04` instead of `ubuntu-latest`. Remove the files `jenkins.sh` and `requirements.txt`
1 parent ae9ec1a commit 065847f

4 files changed

Lines changed: 105 additions & 50 deletions

File tree

.github/workflows/ci-docs.yml

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ on:
1010
jobs:
1111

1212
docs:
13-
runs-on: ubuntu-latest
13+
runs-on: ubuntu-24.04
1414

1515
steps:
1616

@@ -19,17 +19,10 @@ jobs:
1919
with:
2020
submodules: true
2121

22-
- name: Set up Python
23-
uses: actions/setup-python@v5.1.0
24-
with:
25-
python-version: 3.8
26-
2722
- name: Install dependencies
2823
run: |
29-
python -m pip install --upgrade pip
30-
pip install virtualenv
24+
docs/build_docs.sh --install-deps --skip-build
3125
32-
- name: Run test script
26+
- name: Build docs
3327
run: |
34-
cd docs
35-
./jenkins.sh
28+
docs/build_docs.sh

docs/build_docs.sh

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
#!/bin/bash
2+
set -e
3+
4+
verbose=false
5+
install_deps=false
6+
build_docs=true
7+
8+
function print_synopsis {
9+
echo "$0 [options] "
10+
echo " -h, --help print this help message and exit."
11+
echo " -v, --verbose print each executed command."
12+
echo " -i, --install-deps install dependencies before building."
13+
echo " --skip-build skip building and spellchecking docs."
14+
echo " Useful to just install dependencies."
15+
}
16+
17+
function wrong_dir() {
18+
echo "Please run script from 'docs' directory"
19+
exit 1
20+
}
21+
22+
# https://stackoverflow.com/a/14203146
23+
# Use -gt 1 to consume two arguments per pass in the loop (e.g. each
24+
# argument has a corresponding value to go with it).
25+
# Use -gt 0 to consume one or more arguments per pass in the loop (e.g.
26+
# some arguments don't have a corresponding value to go with it such
27+
# as in the --default example).
28+
# note: if this is set to -gt 0 the /etc/hosts part is not recognized ( may be a bug )
29+
while [[ $# -gt 0 ]]
30+
do
31+
key="$1"
32+
33+
case $key in
34+
-h|--help)
35+
print_synopsis
36+
exit 0
37+
;;
38+
-v|--verbose)
39+
verbose=true
40+
;;
41+
-i|--install-deps)
42+
install_deps=true
43+
;;
44+
--skip-build)
45+
build_docs=false
46+
;;
47+
-*)
48+
# unknown option
49+
echo "error: unknown option '$key'"
50+
echo ""
51+
print_synopsis
52+
exit 1
53+
;;
54+
*)
55+
# no free arguments allowed
56+
echo "error: no free arguments allowed: '$key'"
57+
echo ""
58+
print_synopsis
59+
exit 1
60+
;;
61+
esac
62+
shift # past argument or value
63+
done
64+
65+
if [ "$verbose" = true ]; then
66+
set -x
67+
fi
68+
69+
if [ "$install_deps" = true ]; then
70+
echo "### Update apt cache ###"
71+
sudo apt-get update -qq
72+
echo "### install sphinx packages ###"
73+
echo " - pyhton3-sphinx - base package"
74+
echo " - python3-sphinx-rtd-theme - nice read-the-docs theme"
75+
echo " - python3-sphinxcontrib.spelling - spellcheck sphinx files"
76+
#echo " - texlive-latex-extra - latex support to render pdf and also math in html"
77+
#echo " - dvipng - convert math formulas to pngs for html output"
78+
#echo " - graphviz - support for dot, creating flowcharts and other graphs"
79+
echo " - python3-matplotlib - support for matplotlib plots"
80+
echo " - python3-myst-parser - support for markdown files"
81+
sudo DEBIAN_FRONTEND=noninteractive apt-get -yq install --no-install-recommends \
82+
python3-sphinx python3-sphinx-rtd-theme python3-sphinxcontrib.spelling python3-matplotlib python3-myst-parser
83+
fi
84+
85+
# determine build and install directory
86+
SCRIPT_DIR=$(dirname "$0")
87+
SCRIPT_DIR_ABS=$(realpath "${SCRIPT_DIR}")
88+
89+
if [ "$build_docs" = true ]; then
90+
cd "${SCRIPT_DIR_ABS}"
91+
echo "### remove old build directories ###"
92+
rm -rf _build _static _spelling
93+
echo "### create _static dir ###"
94+
mkdir _static
95+
96+
echo "### run sphinx-build ###"
97+
sphinx-build -v -W . _build
98+
echo "### run sphinx spell checking ###"
99+
sphinx-build -b spelling . _spelling
100+
echo "### done! ###"
101+
fi

docs/jenkins.sh

Lines changed: 0 additions & 34 deletions
This file was deleted.

docs/requirements.txt

Lines changed: 0 additions & 5 deletions
This file was deleted.

0 commit comments

Comments
 (0)