Skip to content
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

Skip unit tests for PRs containing only integration test changes #9771

Merged
merged 1 commit into from Jun 7, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
20 changes: 18 additions & 2 deletions build-system/pr-check.js
Expand Up @@ -147,13 +147,23 @@ function isValidatorFile(filePath) {
}

/**
* Determines if the given file is a markdown file containing documentation.
* @param {string} filePath
* @return {boolean}
*/
function isDocFile(filePath) {
return path.extname(filePath) == '.md';
}

/**
* Determines if the given file is an integration test.
* @param {string} filePath
* @return {boolean}
*/
function isIntegrationTest(filePath) {
if (filePath.startsWith('test/integration/')) return true;
Copy link
Member

Choose a reason for hiding this comment

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

no need for if statement just do:

return filePath.startsWith('test/integration/');

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Coming up in a different PR.

}

/**
* Determines if the given file contains flag configurations, by comparing it
* against the well-known json config filenames for prod and canary.
Expand All @@ -178,6 +188,7 @@ function determineBuildTargets(filePaths) {
'VALIDATOR_WEBUI',
'VALIDATOR',
'RUNTIME',
'INTEGRATION_TEST',
'DOCS',
'FLAG_CONFIG']);
}
Expand All @@ -194,6 +205,8 @@ function determineBuildTargets(filePaths) {
targetSet.add('DOCS');
} else if (isFlagConfig(p)) {
targetSet.add('FLAG_CONFIG');
} else if (isIntegrationTest(p)) {
targetSet.add('INTEGRATION_TEST');
} else {
targetSet.add('RUNTIME');
}
Expand Down Expand Up @@ -354,7 +367,7 @@ function main(argv) {
command.testDocumentLinks(files);
}

if (buildTargets.has('RUNTIME')) {
if (buildTargets.has('RUNTIME') || buildTargets.has('INTEGRATION_TEST')) {
command.cleanBuild();
command.buildRuntime();
// Ideally, we'd run presubmit tests after `gulp dist`, as some checks run
Expand All @@ -364,7 +377,10 @@ function main(argv) {
command.runPresubmitTests();
command.runLintChecks();
command.runDepAndTypeChecks();
command.runUnitTests();
// Skip unit tests if the PR only contains changes to integration tests.
if (buildTargets.has('RUNTIME')) {
command.runUnitTests();
}
}
if (buildTargets.has('VALIDATOR_WEBUI')) {
command.buildValidatorWebUI();
Expand Down