diff --git a/.travis.yml b/.travis.yml index 3a4cd20c0..b26a5417a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,4 +8,4 @@ sudo: required services: - docker -script: make ci +script: hack/ci-check.sh diff --git a/hack/ci-check.sh b/hack/ci-check.sh new file mode 100755 index 000000000..aa3b2997e --- /dev/null +++ b/hack/ci-check.sh @@ -0,0 +1,17 @@ +#!/usr/bin/env bash + +# If we're doing push build, as opposed to a PR, always run make ci +if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then + make ci + # Exit script early, returning make ci's error + exit $? +fi + +# Only run `make ci` if files outside of the site directory changed in the branch +# In a PR build, $TRAVIS_BRANCH is the destination branch. +if [[ $(git diff --name-only $TRAVIS_BRANCH | grep --invert-match site/) ]]; then + make ci +else + echo "Skipping make ci since nothing outside of site directory changed." + exit 0 +fi