From a181b4336421605509b95baf9c0d628ce0443672 Mon Sep 17 00:00:00 2001 From: jonathanmetzman <31354670+jonathanmetzman@users.noreply.github.com> Date: Mon, 13 May 2019 13:04:23 -0700 Subject: [PATCH] [travis] Add requirements file for travis and fix diff command (#2406) --- .travis.yml | 2 +- infra/travis/requirements.txt | 1 + infra/travis/travis_build.py | 6 ++++-- 3 files changed, 6 insertions(+), 3 deletions(-) create mode 100644 infra/travis/requirements.txt mode change 100644 => 100755 infra/travis/travis_build.py diff --git a/.travis.yml b/.travis.yml index 0b079ffd4..d1083ce25 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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 diff --git a/infra/travis/requirements.txt b/infra/travis/requirements.txt new file mode 100644 index 000000000..37917bb24 --- /dev/null +++ b/infra/travis/requirements.txt @@ -0,0 +1 @@ +PyYAML==5.1 diff --git a/infra/travis/travis_build.py b/infra/travis/travis_build.py old mode 100644 new mode 100755 index 60f4ab409..13c03ac88 --- a/infra/travis/travis_build.py +++ b/infra/travis/travis_build.py @@ -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.*)/.*\n' return set(re.findall(projects_regex, output))