[travis] Add requirements file for travis and fix diff command (#2406)

This commit is contained in:
jonathanmetzman 2019-05-13 13:04:23 -07:00 committed by GitHub
parent 8017ffc384
commit a181b43364
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 3 deletions

View File

@ -8,6 +8,6 @@ before_install:
- git fetch origin +refs/heads/$TRAVIS_BRANCH
install:
- pip install -r infra/gcb/requirements.txt
- pip install -r infra/travis/requirements.txt
script: ./infra/travis/travis_build.py

View File

@ -0,0 +1 @@
PyYAML==5.1

6
infra/travis/travis_build.py Normal file → Executable file
View File

@ -30,8 +30,10 @@ DEFAULT_SANITIZERS = ['address', 'undefined']
def get_modified_projects():
"""Get a list of all the projects modified in this commit."""
output = subprocess.check_output(['git', 'diff', 'origin/master',
'--name-status'])
master_head_sha = subprocess.check_output(
['git', 'merge-base', 'HEAD', 'FETCH_HEAD']).decode().strip()
output = subprocess.check_output(
['git', 'diff', '--name-only', 'HEAD', master_head_sha]).decode()
projects_regex = '.*projects/(?P<name>.*)/.*\n'
return set(re.findall(projects_regex, output))