forked from plone/plone.restapi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test-no-sphinx-warnings.in
45 lines (37 loc) · 1.11 KB
/
test-no-sphinx-warnings.in
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/bin/bash
#
# CI test that should fail if there are warnings or even errors when building
# the Sphinx docs.
if [ "$PLONE_VERSION" = "5.2.x" ]; then
echo "Skipping checks for sphinx warnings for 5.2.x"
exit 0
fi
set -euo pipefail
BUILD_LOG="sphinx_build.log"
function red {
RED=$(tput setaf 1)
RESET=$(tput sgr0)
echo "$RED $1 $RESET"
}
bin/sphinxbuilder 2>&1 | tee $BUILD_LOG
BUILD_RETCODE=$?
! grep -q 'WARNING: ' $BUILD_LOG
WARNINGS=$?
# Fail the build if either
# - exit code is 1
# - or there are WARNINGs in Sphinx build output
if [[ $WARNINGS = 1 || $BUILD_RETCODE = 1 ]]; then
red "ERROR: There have been warnings or errors when building Sphinx docs!"
red ""
red "This probably means these have been introduced by your changes."
red "Please take the time to check the output of the Sphinx build and"
red "address these warnings."
red ""
red "You should see the Sphinx build output just above, or you can run"
red "bin/sphinxbuilder"
red "locally to build the documentation (and then open docs/html/index.html"
red "to view it)."
exit 1
else
exit 0
fi