[infra] Make travis_build presubmit clean (#3334)

This commit is contained in:
jonathanmetzman 2020-02-05 09:10:05 -08:00 committed by GitHub
parent a324584da1
commit 27409e0fbc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 4 deletions

View File

@ -20,6 +20,7 @@ from __future__ import print_function
import os import os
import re import re
import sys
import subprocess import subprocess
import yaml import yaml
@ -104,8 +105,8 @@ def build_project(project):
variables (TRAVIS_SANITIZER, TRAVIS_ENGINE, and TRAVIS_ARCHITECTURE).""" variables (TRAVIS_SANITIZER, TRAVIS_ENGINE, and TRAVIS_ARCHITECTURE)."""
root = get_oss_fuzz_root() root = get_oss_fuzz_root()
project_yaml_path = os.path.join(root, 'projects', project, 'project.yaml') project_yaml_path = os.path.join(root, 'projects', project, 'project.yaml')
with open(project_yaml_path) as fp: with open(project_yaml_path) as file_handle:
project_yaml = yaml.safe_load(fp) project_yaml = yaml.safe_load(file_handle)
if project_yaml.get('disabled', False): if project_yaml.get('disabled', False):
print('Project {0} is disabled, skipping build.'.format(project)) print('Project {0} is disabled, skipping build.'.format(project))
@ -129,6 +130,7 @@ def build_project(project):
def main(): def main():
"""Build modified projects on travis."""
projects = get_modified_buildable_projects() projects = get_modified_buildable_projects()
failed_projects = [] failed_projects = []
for project in projects: for project in projects:
@ -139,8 +141,10 @@ def main():
if failed_projects: if failed_projects:
print('Failed projects:', ' '.join(failed_projects)) print('Failed projects:', ' '.join(failed_projects))
exit(1) return 1
return 0
if __name__ == '__main__': if __name__ == '__main__':
main() sys.exit(main())