Skip to content

Commit 7da3888

Browse files
committed
Merge branch 'docs_run_on_ubuntu_24.04'
2 parents ae9ec1a + ad1f13e commit 7da3888

5 files changed

Lines changed: 113 additions & 56 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/conf.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,9 @@
3232
# Add any Sphinx extension module names here, as strings. They can be
3333
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
3434
# ones.
35-
extensions = []
35+
extensions = [
36+
"myst_parser",
37+
]
3638

3739
if not on_rtd:
3840
extensions.append('sphinxcontrib.spelling')
@@ -45,7 +47,7 @@
4547
# The suffix(es) of source filenames.
4648
# You can specify multiple suffix as a list of string:
4749
# source_suffix = ['.rst', '.md']
48-
source_suffix = '.rst'
50+
source_suffix = ['.rst', '.md']
4951

5052
# The encoding of source files.
5153
#source_encoding = 'utf-8-sig'
@@ -63,16 +65,16 @@
6365
# built documents.
6466
#
6567
# The short X.Y version.
66-
version = '0.23'
68+
version = '0.26'
6769
# The full version, including alpha/beta/rc tags.
68-
release = '0.23'
70+
release = '0.26'
6971

7072
# The language for content autogenerated by Sphinx. Refer to documentation
7173
# for a list of supported languages.
7274
#
7375
# This is also used if you do content translation via gettext catalogs.
7476
# Usually you set "language" from the command line for these cases.
75-
language = None
77+
language = "en"
7678

7779
# There are two options for replacing |today|: either, you set today to some
7880
# non-false value, then it is used:
@@ -82,7 +84,7 @@
8284

8385
# List of patterns, relative to source directory, that match files and
8486
# directories to ignore when looking for source files.
85-
exclude_patterns = ['_build', '_venv', 'rtfd-css', 'packages/pkg/foo.rst']
87+
exclude_patterns = ['_build', '_venv', 'rtfd-css', 'packages/pkg/foo.rst', 'old-wiki']
8688

8789
# The reST default role (used for this markup: `text`) to use for all
8890
# documents.

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)