diff --git a/travis/setup_conda.sh b/travis/setup_conda.sh index 08889c0..4b6dac6 100755 --- a/travis/setup_conda.sh +++ b/travis/setup_conda.sh @@ -7,8 +7,24 @@ # # The present script was added later. +if [[ $DEBUG == True ]]; then + set -x +fi + +# First check: if the build should be run at all based on the event type + +if [[ ! -z $EVENT_TYPE ]]; then + for event in $EVENT_TYPE; do + if [[ $TRAVIS_EVENT_TYPE = $event ]]; then + allow_to_build=True + fi + done + if [[ $allow_to_build != True ]]; then + travis_terminate 0 + fi +fi -# We first check if any of the custom tags are used to skip the build +# Second check: if any of the custom tags are used to skip the build TR_SKIP="\[(skip travis|travis skip)\]" DOCS_ONLY="\[docs only|build docs\]" @@ -16,11 +32,11 @@ DOCS_ONLY="\[docs only|build docs\]" # Skip build if the commit message contains [skip travis] or [travis skip] # Remove workaround once travis has this feature natively # https://github.com/travis-ci/travis-ci/issues/5032 -if [[ ! -z $(echo $TRAVIS_COMMIT_MESSAGE | grep -E $TR_SKIP) ]]; then +if [[ ! -z $(echo $TRAVIS_COMMIT_MESSAGE | grep -E "$TR_SKIP") ]]; then echo "Travis was requested to be skipped by the commit message, exiting." travis_terminate 0 -elif [[ ! -z $(echo $TRAVIS_COMMIT_MESSAGE | grep -E $DOCS_ONLY) ]]; then - if [[ $SETUP_CMD != *build_docs* ]] || [[ $SETUP_CMD != *build_sphinx* ]]; then +elif [[ ! -z $(echo $TRAVIS_COMMIT_MESSAGE | grep -E "$DOCS_ONLY") ]]; then + if [[ $SETUP_CMD != *build_docs* ]] && [[ $SETUP_CMD != *build_sphinx* ]]; then echo "Only docs build was requested by the commit message, exiting." travis_terminate 0 fi diff --git a/travis/setup_dependencies_common.sh b/travis/setup_dependencies_common.sh index bce033d..24fa9a4 100755 --- a/travis/setup_dependencies_common.sh +++ b/travis/setup_dependencies_common.sh @@ -4,18 +4,6 @@ hash -r set -e -if [[ ! -z $EVENT_TYPE ]]; then - for event in $EVENT_TYPE; do - if [[ $TRAVIS_EVENT_TYPE = $event ]]; then - allow_to_build=True - fi - done -fi - -if [[ $allow_to_build != True ]]; then - travis_terminate 0 -fi - # We need to do this before updating conda, as $CONDA_CHANNELS may be a # conda environment variable for some Miniconda versions, too that needs to # be space separated. @@ -429,7 +417,7 @@ fi # cache before starting the tests/docs build. See details in # https://github.com/matplotlib/matplotlib/issues/5836 -if [[ $SETUP_CMD == build_sphinx* ]] || [[ $SETUP_CMD == build_docs* ]]; then +if [[ $SETUP_CMD == *build_sphinx* ]] || [[ $SETUP_CMD == *build_docs* ]]; then python -c "import matplotlib.pyplot" fi