8000 [MRG + 1] CI make html-noplot when doc/ and examples/ not modified by jnothman · Pull Request #7923 · scikit-learn/scikit-learn · GitHub
[go: up one dir, main page]

Skip to content

[MRG + 1] CI make html-noplot when doc/ and examples/ not modified #7923

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 6 commits into from
Nov 29, 2016

Conversation

jnothman
Copy link
Member

Fixes #7815. By default, Circle CI will run make html-noplot, with make html when doc/ or examples/ is touched.

I've also merged check_build_doc into build_doc.sh, but this can be reverted.

This is untested!

Copy link
Member
@lesteve lesteve left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have you tested with a [doc build] commit to make sure that the html-noplot is kicked off?

@@ -2,18 +2,74 @@
set -x
set -e

# Introspect the commit to know whether or not we should skip building the
# Inspect the commit to know whether or not we should skip building the
# documentation: a pull request that does not change any file in doc/ or
# examples/ folder should be skipped unless the "[doc: build]" is found the
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment should say [doc build] and not [doc: build]

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also I believe the information in the check_build_doc.py docstring is a bit more complete, that would be a good idea to move it here.

filenames=$(git diff --name-only $git_range)
if [ -z "$filenames" ]
then
echo QUICK BUILD: failed to get changed filenames for $git_range
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just curious, when can that happen, empty commit?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Empty commit; or git error.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not that crucial but I believe a git error will stop the script since you have set -e at the beginning of the script.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

true

echo "$filenames"
}

touch ~/log.txt # the "test" segment needs this file
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can remove this since the test is now a dummy echo command and not cat log.txt | grep Traceback

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks.

@jnothman
Copy link
Member Author

Thanks for the comments. Updated.

echo QUICK BUILD: failed to get changed filenames for $git_range
return
fi
if echo "$filenames" | grep -q -e ^examples/ -e ^doc/
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I got tripped up by this one a few times: since you have set -e a grep without a match will have an exit code 1 and stop the script.

I have to say I don't know what is the best way to handle this so I used things like this in flake8_diff.sh:

echo $filenames | grep bla || echo no_match

Copy link
Member Author
@jnothman jnothman Nov 23, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

surely that's not what happens. set -e doesn't affect test in an if context; and it doesn't affect pipes...??

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah you are right, there is no problem within the if context.

echo QUICK BUILD: failed to inspect commit $CIRCLE_SHA1
return
fi
if [[ "$commit_msg" =~ '[doc skip]' ]]
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't actually get why this works. Why is the RHS not treated as a character class?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, I think the RHS is treated as a character class so you need to escape the square brackets:

if [[ "d" =~ '[doc skip]' ]]; then echo yes; else echo no; fi # outputs yes

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not getting yes output for that on two different OSes. Maybe this is why it should be written in Python

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh God. It's Bash string madness again. Apparently with the ' it's processed as an exact match...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not getting yes output for that on two different OSes. Maybe this is why it should be written in Python

I was using a zsh shell, naively assuming that the behaviour would be the same. As you said in bash, 'a' =~ [abcd] matches but not 'a' =~ '[abcd]'.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed for clarity

@lesteve
Copy link
Member
lesteve commented Nov 23, 2016

LGTM, the Travis failure is unrelated: Error: HTTPError: 530 Server Error: : http://repo.continuum.io/pkgs/free/linux-64/python-2.7.12-1.tar.bz2.

@lesteve lesteve changed the title [MRG] CI make html-noplot when doc/ and examples/ not modified [MRG + 1] CI make html-noplot when doc/ and examples/ not modified Nov 23, 2016
@jnothman
Copy link
Member Author

Note that skip just worked

@lesteve
Copy link
Member
lesteve commented Nov 23, 2016

Note that skip just worked

Great, thanks for testing it.

echo QUICK BUILD: no changed filenames for $git_range
return
fi
if echo "$filenames" | grep -q -e ^examples/ -e ^doc/
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I might be a bit slow. why do we need a full build for changes to doc?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, historically we have. I don't mind much either way. Narrative docs tend to include images from examples, although most changes to docs don't change that, except where examples is also being modified.

@amueller
Copy link
Member

LGTM apart from comment. I only checked the logic, not the syntax, I can't read shell well enough...

@jnothman
Copy link
Member Author

Will merge. Happy to change so that doc/ yields QUICK if no examples/ modified

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0