Skip to content

[MRG+1] CircleCI: run only modified examples in CircleCI #10407

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 10 commits into from
Jan 15, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
21 changes: 15 additions & 6 deletions build_tools/circle/build_doc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,13 @@ get_build_type() {
echo QUICK BUILD: no changed filenames for $git_range
return
fi
if echo "$filenames" | grep -q -e ^examples/
changed_examples=$(echo "$filenames" | grep -e ^examples/)
if [[ -n "$changed_examples" ]]
then
echo BUILD: detected examples/ filename modified in $git_range: $(echo "$filenames" | grep -e ^examples/ | head -n1)
echo BUILD: detected examples/ filename modified in $git_range: $changed_examples
pattern=$(echo "$changed_examples" | paste -sd '|')
# pattern for examples to run is the last line of output
echo "$pattern"
return
fi
echo QUICK BUILD: no examples/ filename modified in $git_range:
Expand All @@ -75,12 +79,17 @@ fi
if [[ "$CIRCLE_BRANCH" =~ ^master$|^[0-9]+\.[0-9]+\.X$ && -z "$CI_PULL_REQUEST" ]]
then
# PDF linked into HTML
MAKE_TARGET="dist LATEXMKOPTS=-halt-on-error"
make_args="dist LATEXMKOPTS=-halt-on-error"
elif [[ "$build_type" =~ ^QUICK ]]
then
MAKE_TARGET=html-noplot
make_args=html-noplot
elif [[ "$build_type" =~ ^'BUILD: detected examples' ]]
then
# pattern for examples to run is the last line of output
pattern=$(echo "$build_type" | tail -n 1)
make_args="html EXAMPLES_PATTERN=$pattern"
else
MAKE_TARGET=html
make_args=html
fi

# Installing required system packages to support the rendering of math
Expand Down Expand Up @@ -124,7 +133,7 @@ then
fi

# The pipefail is requested to propagate exit code
set -o pipefail && cd doc && make $MAKE_TARGET 2>&1 | tee ~/log.txt
set -o pipefail && cd doc && make $make_args 2>&1 | tee ~/log.txt

cd -
set +o pipefail
Expand Down
7 changes: 6 additions & 1 deletion doc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,16 @@ SPHINXOPTS =
SPHINXBUILD ?= sphinx-build
PAPER =
BUILDDIR = _build
ifneq ($(EXAMPLES_PATTERN),)
EXAMPLES_PATTERN_OPTS := -D sphinx_gallery_conf.filename_pattern="$(EXAMPLES_PATTERN)"
endif

# Internal variables.
PAPEROPT_a4 = -D latex_paper_size=a4
PAPEROPT_letter = -D latex_paper_size=letter
ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS)\
$(EXAMPLES_PATTERN_OPTS) .


.PHONY: help clean html dirhtml pickle json latex latexpdf changes linkcheck doctest optipng

Expand Down
14 changes: 8 additions & 6 deletions doc/developers/contributing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -444,15 +444,17 @@ to the documentation, e.g.::

pip install --editable ..

To generate the full web site, including the example gallery (this might take a
while)::
To generate the full web site, including the example gallery::

make html

Or, if you'd rather quickly generate the documentation without the example
gallery::

make html-noplot
Generating the example gallery will run all our examples which takes a
while. To save some time, you can use:
- ``make html-noplot``: this will generate the documentation without the
example gallery. This is useful when changing a docstring for example.
- ``EXAMPLES_PATTERN=your_regex_goes_here make html``: only the examples
matching ``your_regex_goes_here`` will be run. This is particularly
useful if you are modifying a few examples.

That should create all the documentation in the ``_build/html/stable`` directory.

Expand Down