From 85d23ce8700af0df0c90e47f7d97f0624bad93c8 Mon Sep 17 00:00:00 2001 From: Raghu Simha Date: Mon, 29 Jan 2018 19:14:58 -0500 Subject: [PATCH] Skip testing for PR builds and non-lockfile push builds on greenkeeper branches (#13025) --- build-system/pr-check.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/build-system/pr-check.js b/build-system/pr-check.js index 30f28d88f0a69..3c7b2220e8668 100644 --- a/build-system/pr-check.js +++ b/build-system/pr-check.js @@ -410,6 +410,24 @@ function main() { colors.cyan(process.env.BUILD_SHARD), '\n'); + // Eliminate unnecessary testing on greenkeeper branches by running tests only + // on the push build that contains the lockfile update. + const isGreenkeeperPushBuild = + ((process.env.TRAVIS_EVENT_TYPE == 'push') && + (process.env.TRAVIS_BRANCH.indexOf('greenkeeper/') != -1)); + const isGreenkeeperPrBuild = + ((process.env.TRAVIS_EVENT_TYPE == 'pull_request') && + (process.env.TRAVIS_PULL_REQUEST_BRANCH.indexOf('greenkeeper/') != -1)); + if (isGreenkeeperPrBuild || + (isGreenkeeperPushBuild && + process.env.TRAVIS_COMMIT_MESSAGE.indexOf('update lockfile') == -1)) { + console.log(fileLogPrefix, + 'Skipping unnecessary testing on greenkeeper branches. ' + + 'Tests will only be run for the push build with the lockfile update.'); + stopTimer('pr-check.js', startTime); + return 0; + } + // If $TRAVIS_PULL_REQUEST_SHA is empty then it is a push build and not a PR. if (!process.env.TRAVIS_PULL_REQUEST_SHA) { console.log(fileLogPrefix, 'Running all commands on push build.');