Merge branch 'sg/travis-fixes' into maint
[git/git.git] / ci / lib-travisci.sh
CommitLineData
657343a6
LS
1# Library of functions shared by all CI scripts
2
09f5e974
LS
3skip_branch_tip_with_tag () {
4 # Sometimes, a branch is pushed at the same time the tag that points
5 # at the same commit as the tip of the branch is pushed, and building
6 # both at the same time is a waste.
7 #
8 # Travis gives a tagname e.g. v2.14.0 in $TRAVIS_BRANCH when
9 # the build is triggered by a push to a tag. Let's see if
10 # $TRAVIS_BRANCH is exactly at a tag, and if so, if it is
11 # different from $TRAVIS_BRANCH. That way, we can tell if
12 # we are building the tip of a branch that is tagged and
13 # we can skip the build because we won't be skipping a build
14 # of a tag.
15
16 if TAG=$(git describe --exact-match "$TRAVIS_BRANCH" 2>/dev/null) &&
8376eb4a 17 test "$TAG" != "$TRAVIS_BRANCH"
09f5e974
LS
18 then
19 echo "Tip of $TRAVIS_BRANCH is exactly at $TAG"
20 exit 0
21 fi
22}
23
657343a6
LS
24# Set 'exit on error' for all CI scripts to let the caller know that
25# something went wrong
26set -e
09f5e974
LS
27
28skip_branch_tip_with_tag
83d1efe5
SG
29
30case "${TRAVIS_OS_NAME:-linux}" in
31linux)
32 P4_PATH="$(pwd)/custom/p4"
33 GIT_LFS_PATH="$(pwd)/custom/git-lfs"
34 export PATH="$GIT_LFS_PATH:$P4_PATH:$PATH"
35 ;;
36esac