1
0
Fork 1
mirror of https://gitlab.postmarketos.org/postmarketOS/pmbootstrap.git synced 2025-07-12 19:09:56 +03:00
pmbootstrap/.ci/docs.sh
Newbyte e5dfbd9293
CI: Skip removing files that start with test in docs check
Tests were moved out of the pmb directory into their own test directory,
so no need to try to exclude them when they shouldn't be there anyway.
If test "documentation" appears in the docs with this, there's a test
that is where it shouldn't be and a separate bug.

Part-of: https://gitlab.postmarketos.org/postmarketOS/pmbootstrap/-/merge_requests/2619
2025-07-06 21:26:19 +02:00

39 lines
997 B
Bash
Executable file

#!/bin/sh -e
# Description: create documentation with sphinx
# Artifacts: public/
# https://postmarketos.org/pmb-ci
# Install sphinx + extensions when running in CI
if [ "$(id -u)" = 0 ]; then
set -x
apk -q add \
py3-myst-parser \
py3-sphinx_rtd_theme \
py3-sphinxcontrib-autoprogram \
py3-sphinxcontrib-jquery
exec su "${TESTUSER:-build}" -c "sh -e $0"
fi
# Sanity check docs that all modules are documented.
# Ignore all packages and files named test*
fail=0
modules="$(find pmb/ -name "*.py" | grep -v '/__init__.py' | grep -v '/conftest.py' | sort | sed 's|\.py$||' | sed 's|/|.|g')"
for module in $modules; do
if ! grep -q "automodule:: $module" docs/api/*.rst; then
echo "Undocumented module: $module"
fail=1
fi
done
if [ "$fail" -eq 1 ]; then
echo "ERROR: Found undocumented modules!"
echo "ERROR: Please add this module to the correct .rst file in docs/api/"
exit 1
fi
sphinx-build \
--fail-on-warning \
docs \
public \
# -E -a -v -T