Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[MRG] Enables CircleCI to fail when sphinx warns #15633

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 24 commits into from
Nov 19, 2019
Merged
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
a642e32
Make circleCI exit with error if sphinx warnings are generated.
cmarmo Oct 23, 2019
5ed1c9c
Merge branch 'master' into cierroronwarning
cmarmo Oct 24, 2019
96cf750
Fix unsafe exit.
cmarmo Oct 24, 2019
c19c4e3
[doc build] Fix unsafe exit.
cmarmo Oct 24, 2019
4d07039
Look for example images in modified files.
cmarmo Nov 6, 2019
0196e9e
Fix for no images in modified files.
cmarmo Nov 6, 2019
0a0cf5f
Merge branch 'master' into cierroronwarning
cmarmo Nov 6, 2019
c6735d9
Exclude build_doc.sh
cmarmo Nov 6, 2019
455f500
Merge branch 'master' into cierroronwarning
cmarmo Nov 6, 2019
6ac8be2
Merge branch 'master' into cierroronwarning
cmarmo Nov 8, 2019
5c0bafc
Merge branch 'cierroronwarning' of https://github.com/cmarmo/scikit-l…
cmarmo Nov 8, 2019
7e664e0
Merge branch 'master' into cierroronwarning
cmarmo Nov 12, 2019
a2f3255
Generalized implementation. Fix concatenation issues.
cmarmo Nov 12, 2019
0749882
Merge branch 'master' into cierroronwarning
cmarmo Nov 14, 2019
bc08415
Address comments
cmarmo Nov 14, 2019
f91903e
Add comments.
cmarmo Nov 14, 2019
d533bcb
Merge branch 'master' into cierroronwarning
cmarmo Nov 15, 2019
2fef5e7
Implement @thomasjpfan solution
cmarmo Nov 15, 2019
fa3ca3f
CLN Uses warnings directly
thomasjpfan Nov 15, 2019
8924e17
TST Introduces error
thomasjpfan Nov 15, 2019
f6de0a0
TST Fixes error
thomasjpfan Nov 15, 2019
df8adca
STY Changes
thomasjpfan Nov 15, 2019
4b0d27e
Merge remote-tracking branch 'upstream/master' into pr/15355
thomasjpfan Nov 16, 2019
5be4023
ENH Also grep for thumb pngs
thomasjpfan Nov 16, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions build_tools/circle/build_doc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,44 @@ get_build_type() {
return
fi
changed_examples=$(echo "$filenames" | grep -E "^examples/(.*/)*plot_")

# The following is used to extract the list of filenames of example python
# files that sphinx-gallery needs to run to generate png files used as
# figures or images in the .rst files from the documentation.
# If the contributor changes a .rst file in a PR we need to run all
# the examples mentioned in that file to get sphinx build the
# documentation without generating spurious warnings related to missing
# png files.

if [[ -n "$filenames" ]]
then
# get rst files
rst_files="$(echo "$filenames" | grep -E "rst$")"

# get lines with figure or images
img_fig_lines="$(echo "$rst_files" | xargs grep -shE "(figure|image)::")"

# get only auto_examples
auto_example_files="$(echo "$img_fig_lines" | grep auto_examples | awk -F "/" '{print $NF}')"

# remove "sphx_glr_" from path and accept replace _(\d\d\d|thumb).png with .py
scripts_names="$(echo "$auto_example_files" | sed 's/sphx_glr_//' | sed -e 's/_([[:digit:]][[:digit:]][[:digit:]]|thumb).png/.py/')"

# get unique values
examples_in_rst="$(echo "$scripts_names" | uniq )"
fi

# executed only if there are examples in the modified rst files
if [[ -n "$examples_in_rst" ]]
then
if [[ -n "$changed_examples" ]]
then
changed_examples="$changed_examples|$examples_in_rst"
else
changed_examples="$examples_in_rst"
fi
fi

if [[ -n "$changed_examples" ]]
then
echo BUILD: detected examples/ filename modified in $git_range: $changed_examples
Expand Down Expand Up @@ -204,5 +242,12 @@ then
echo "$warnings" | sed 's/\/home\/circleci\/project\//<li>/g'
echo '</ul></body></html>'
) > 'doc/_build/html/stable/_changed.html'

if [ "$warnings" != "/home/circleci/project/ no warnings" ]
then
echo "Sphinx generated warnings when building the documentation related to files modified in this PR."
echo "Please check doc/_build/html/stable/_changed.html"
exit 1
fi
fi