travis-ci: print the "tip of branch is exactly at tag" message in color
[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 18 then
495ea6cd 19 echo "$(tput setaf 2)Tip of $TRAVIS_BRANCH is exactly at $TAG$(tput sgr0)"
09f5e974
LS
20 exit 0
21 fi
22}
23
657343a6 24# Set 'exit on error' for all CI scripts to let the caller know that
a8b8b6b8
SG
25# something went wrong.
26# Set tracing executed commands, primarily setting environment variables
27# and installing dependencies.
4f263666 28set -ex
09f5e974
LS
29
30skip_branch_tip_with_tag
83d1efe5 31
bf427a94
SG
32if test -z "$jobname"
33then
34 jobname="$TRAVIS_OS_NAME-$CC"
35fi
36
e3371e92
SG
37export DEVELOPER=1
38export DEFAULT_TEST_TARGET=prove
39export GIT_PROVE_OPTS="--timer --jobs 3 --state=failed,slow,save"
40export GIT_TEST_OPTS="--verbose-log"
41export GIT_TEST_CLONE_2GB=YesPlease
42
bf427a94
SG
43case "$jobname" in
44linux-clang|linux-gcc)
a1157b76
SG
45 export GIT_TEST_HTTPD=YesPlease
46
e3371e92
SG
47 # The Linux build installs the defined dependency versions below.
48 # The OS X build installs the latest available versions. Keep that
49 # in mind when you encounter a broken OS X build!
50 export LINUX_P4_VERSION="16.2"
51 export LINUX_GIT_LFS_VERSION="1.5.2"
52
83d1efe5
SG
53 P4_PATH="$(pwd)/custom/p4"
54 GIT_LFS_PATH="$(pwd)/custom/git-lfs"
55 export PATH="$GIT_LFS_PATH:$P4_PATH:$PATH"
56 ;;
e3371e92
SG
57osx-clang|osx-gcc)
58 # t9810 occasionally fails on Travis CI OS X
59 # t9816 occasionally fails with "TAP out of sequence errors" on
60 # Travis CI OS X
61 export GIT_SKIP_TESTS="t9810 t9816"
62 ;;
63GETTEXT_POISON)
64 export GETTEXT_POISON=YesPlease
65 ;;
83d1efe5 66esac