From c365c2aa874c02b82cea89b9c9c2b8bb9d4a5083 Mon Sep 17 00:00:00 2001 From: Tianqi Chen Date: Thu, 21 May 2020 18:37:58 -0700 Subject: [PATCH] [CI] Add log check to the sphinx gallery docs (#5643) * [CI] Add log check to the sphinx gallery docs This PR add log check to sphinx gallery tutorials to prevent the case when sphinx failed to capture the error in tutorials. * Fix the status --- tests/scripts/task_python_docs.sh | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/tests/scripts/task_python_docs.sh b/tests/scripts/task_python_docs.sh index eaa705d..be2d792 100755 --- a/tests/scripts/task_python_docs.sh +++ b/tests/scripts/task_python_docs.sh @@ -20,6 +20,13 @@ set -e set -u source tests/scripts/setup-pytest-env.sh + +cleanup() +{ + rm -rf /tmp/$$.log.txt +} +trap cleanup 0 + # cleanup old states rm -rf docs/_build mkdir -p docs/_build/html @@ -36,7 +43,12 @@ find . -type f -path "*.pyc" | xargs rm -f make cython3 cd docs -PYTHONPATH=`pwd`/../python make html +PYTHONPATH=`pwd`/../python make html 2>/tmp/$$.log.txt +if grep -E "failed to execute" < /tmp/$$.log.txt; then + echo "Some of sphinx-gallery item example failed to execute." + cat /tmp/$$.log.txt + exit 1 +fi cd .. # C++ doc -- 2.7.4