Skip to content

Commit

Permalink
Skip testing for PR builds and non-lockfile push builds on greenkeepe…
Browse files Browse the repository at this point in the history
…r branches (ampproject#13025)
  • Loading branch information
rsimha authored and gzgogo committed Feb 14, 2018
1 parent 7e3850f commit 85d23ce
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions build-system/pr-check.js
Expand Up @@ -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.');
Expand Down

0 comments on commit 85d23ce

Please sign in to comment.