Skip to content

Commit 7cfc730

Browse files
committed
make the docs build failures print a nicer message
1 parent 36ddb00 commit 7cfc730

1 file changed

Lines changed: 25 additions & 3 deletions

File tree

.circleci/scripts/python_doc_push_script.sh

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,26 @@ fi
4242

4343
echo "install_path: $install_path version: $version"
4444

45+
build_docs () {
46+
set +e
47+
set -o pipefail
48+
make $1 2>&1 | tee /tmp/docs_build.txt
49+
code=$?
50+
if [ $code -ne 0 ]; then
51+
set +x
52+
echo =========================
53+
grep "WARNING:" /tmp/docs_build.txt
54+
echo =========================
55+
echo Docs build failed. If the failure is not clear, scan back in the log
56+
echo for any WARNINGS or for the line "build finished with problems"
57+
echo "(tried to echo the WARNINGS above the ==== line)"
58+
echo =========================
59+
fi
60+
set -ex
61+
return $code
62+
}
63+
64+
4565
git clone https://github.com/pytorch/pytorch.github.io -b $branch
4666
pushd pytorch.github.io
4767

@@ -57,7 +77,8 @@ pushd docs
5777
# Build the docs
5878
pip -q install -r requirements.txt
5979
if [ "$is_master_doc" = true ]; then
60-
make html
80+
build_docs html
81+
[ $? -eq 0 ] || exit $?
6182
make coverage
6283
# Now we have the coverage report, we need to make sure it is empty.
6384
# Count the number of lines in the file and turn that number into a variable
@@ -78,8 +99,9 @@ if [ "$is_master_doc" = true ]; then
7899
exit 1
79100
fi
80101
else
81-
# Don't fail the build on coverage problems
82-
make html-stable
102+
# skip coverage, format for stable or tags
103+
build_docs html-stable
104+
[ $? -eq 0 ] || exit $?
83105
fi
84106

85107
# Move them into the docs repo

0 commit comments

Comments
 (0)