Skip to content

Commit

Permalink
travis: make conditional test coverage analysis work again
Browse files Browse the repository at this point in the history
  • Loading branch information
kortschak committed Jul 22, 2019
1 parent b16c96a commit 4cb73be
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
7 changes: 7 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,13 @@ matrix:
- go: master

before_install:
# Make sure we have the origin master to compare HEADs and
# save the sha for comparison in test-coverage.sh.
# It is necessary to do this here since the rigmarole for
# Windows loses the link to the real origin master.
- git fetch --depth=1 origin master
- export ORIGIN_MASTER=$(git ls-remote origin master | cut -f1)

# This garbage is necessary because on windows, Travis
# helpfully sets core.autocrlf to true.
#
Expand Down
3 changes: 2 additions & 1 deletion .travis/script.d/test-coverage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@ if [[ "${TRAVIS_SECURE_ENV_VARS}" != true ]]; then
exit 0
fi

ORIGIN_MASTER="$(git ls-remote origin master | cut -f1)"
CURRENT="$(git rev-parse HEAD)"
if [[ ${ORIGIN_MASTER} != ${CURRENT} ]]; then
echo "skipping coverage - not merged into master"
echo origin/master is ${ORIGIN_MASTER}
echo current HEAD is ${CURRENT}
exit 0
fi

Expand Down

0 comments on commit 4cb73be

Please sign in to comment.