Properly get the commit range for cache

This commit is contained in:
Mingshen Sun 2019-07-18 13:09:10 -07:00
parent 1ec26a0eea
commit a628a9b4da
No known key found for this signature in database
GPG key ID: 1F86BA2052FED3B4

View file

@ -14,8 +14,16 @@ install:
- pod --version
before_script:
- pod install
- git diff --quiet "$TRAVIS_COMMIT_RANGE" -- ; GIT_DIFF_EXIT_CODE=$?
- |
if [ ! $(git diff --name-only master..."$TRAVIS_COMMIT" | grep "Cartfile.resolved") ] && [ -d "Carthage/Build" ]; then
if [ "$GIT_DIFF_EXIT_CODE" -gt 1 ] ; then
git remote set-branches --add origin master
git fetch
TRAVIS_COMMIT_RANGE=origin/master...
fi
- echo $TRAVIS_COMMIT_RANGE
- |
if [ ! $(git diff --name-only "$TRAVIS_COMMIT_RANGE" | grep "Cartfile.resolved") ] && [ -d "Carthage/Build" ]; then
echo "Use cached carthage dependencies."
ls -ld Carthage/Build/iOS/*framework
else
@ -23,7 +31,7 @@ before_script:
travis_wait 45 carthage bootstrap --platform iOS
fi
- |
if [ ! $(git diff --name-only master..."$TRAVIS_COMMIT" | grep -E "gopenpgp_build.sh|gopenpgpwrapper.go") ] && [ -d "go/dist/Gopenpgpwrapper.framework" ]; then
if [ ! $(git diff --name-only "$TRAVIS_COMMIT_RANGE" | grep -E "gopenpgp_build.sh|gopenpgpwrapper.go") ] && [ -d "go/dist/Gopenpgpwrapper.framework" ]; then
echo "Use cached go dependencies."
ls -ld go/dist/*framework
else