Files
zulip/tools/test-documentation
Tim Abbott 57c78da915 test-documentation: Build docs in parallel.
We already do this by default in tools/build-docs, but since we
migrated test-documentation to not run that directly (to disable
collapsing), we need to add the recent parallelism fix here too.

It saves about 5-10s when running this test suite for me, which is
good, but definitely leaves me feeling like there could be more
improvement.
2017-11-17 11:06:56 -08:00

43 lines
1.1 KiB
Bash
Executable File

#!/usr/bin/env bash
set -e
case $1 in
-h|--help)
echo "--help, -h show this help message and exit"
echo "--loglevel=LEVEL, -L LEVEL log level (default: ERROR)"
exit 0
;;
-L|--loglevel)
loglevel="$1 $2"
;;
esac
cd "$(dirname "$0")"/../docs
rm -rf _build
# collapse_navigation is set to False in conf.py to improve sidebar navigation for users.
# However, we must change its value to True before we begin testing links.
# Otherwise, sphinx would generate a large number of links we don't need to test.
# The crawler would take a very long time to finish and TravisCI would fail as a result.
sphinx-build -j8 -b html -d _build/doctrees -D html_theme_options.collapse_navigation=True . _build/html
cd ../tools/documentation_crawler
echo -en "\033[0;94m"
echo "Testing links in documentation..."
echo -en "\033[0m"
set +e
scrapy crawl_with_status documentation_crawler $loglevel
result=$?
if [ "$result" = 1 ]; then
echo -en "\033[0;91m"
echo "Failed!"
echo -en "\033[0m"
exit 1
else
echo -en "\033[0;92m"
echo "Passed!"
echo -en "\033[0m"
exit 0
fi