24
# job if we encounter the same tree again and can provide a useful info
25
# message.
26
save_good_tree () {
27
- echo "$(git rev-parse $TRAVIS_COMMIT^{tree}) $TRAVIS_COMMIT $TRAVIS_JOB_NUMBER $TRAVIS_JOB_ID" >>"$good_trees_file"
27
+ echo "$(git rev-parse $CI_COMMIT^{tree}) $CI_COMMIT $CI_JOB_NUMBER $CI_JOB_ID" >>"$good_trees_file"
28
# limit the file size
29
tail -1000 "$good_trees_file" >"$good_trees_file".tmp
30
mv "$good_trees_file".tmp "$good_trees_file"
34
# successfully before (e.g. because the branch got rebased, changing only
35
# the commit messages).
36
skip_good_tree () {
37
- if ! good_tree_info="$(grep "^$(git rev-parse $TRAVIS_COMMIT^{tree}) " "$good_trees_file")"
37
+ if ! good_tree_info="$(grep "^$(git rev-parse $CI_COMMIT^{tree}) " "$good_trees_file")"
38
then
39
# Haven't seen this tree yet, or no cached good trees file yet.
40
# Continue the build job.
44
echo "$good_tree_info" | {
45
read tree prev_good_commit prev_good_job_number prev_good_job_id
46
47
- if test "$TRAVIS_JOB_ID" = "$prev_good_job_id"
47
+ if test "$CI_JOB_ID" = "$prev_good_job_id"
48
then
49
cat <<-EOF
50
- $(tput setaf 2)Skipping build job for commit $TRAVIS_COMMIT.$(tput sgr0)
50
+ $(tput setaf 2)Skipping build job for commit $CI_COMMIT.$(tput sgr0)
51
This commit has already been built and tested successfully by this build job.
52
To force a re-build delete the branch's cache and then hit 'Restart job'.
53
EOF
54
else
55
cat <<-EOF
56
- $(tput setaf 2)Skipping build job for commit $TRAVIS_COMMIT.$(tput sgr0)
56
+ $(tput setaf 2)Skipping build job for commit $CI_COMMIT.$(tput sgr0)
57
This commit's tree has already been built and tested successfully in build job $prev_good_job_number for commit $prev_good_commit.
58
- The log of that build job is available at https://travis-ci.org/$TRAVIS_REPO_SLUG/jobs/$prev_good_job_id
58
+ The log of that build job is available at $(url_for_job_id $prev_good_job_id)
59
To force a re-build delete the branch's cache and then hit 'Restart job'.
60
EOF
61
fi
80
# and installing dependencies.
81
set -ex
82
83
-# When building a PR, TRAVIS_BRANCH refers to the *target* branch. Not what we
84
-# want here. We want the source branch instead.
85
-CI_BRANCH="${TRAVIS_PULL_REQUEST_BRANCH:-$TRAVIS_BRANCH}"
83
+if test true = "$TRAVIS"
84
+then
85
+ CI_TYPE=travis
86
+ # When building a PR, TRAVIS_BRANCH refers to the *target* branch. Not
87
+ # what we want here. We want the source branch instead.
88
+ CI_BRANCH="${TRAVIS_PULL_REQUEST_BRANCH:-$TRAVIS_BRANCH}"
89
+ CI_COMMIT="$TRAVIS_COMMIT"
90
+ CI_JOB_ID="$TRAVIS_JOB_ID"
91
+ CI_JOB_NUMBER="$TRAVIS_JOB_NUMBER"
92
+ CI_OS_NAME="$TRAVIS_OS_NAME"
93
+ CI_REPO_SLUG="$TRAVIS_REPO_SLUG"
94
+
95
+ cache_dir="$HOME/travis-cache"
96
+
97
+ url_for_job_id () {
98
+ echo "https://travis-ci.org/$CI_REPO_SLUG/jobs/$1"
99
+ }
100
+
101
+ BREW_INSTALL_PACKAGES="git-lfs gettext"
102
+ export GIT_PROVE_OPTS="--timer --jobs 3 --state=failed,slow,save"
103
+ export GIT_TEST_OPTS="--verbose-log -x --immediate"
104
+else
105
+ echo "Could not identify CI type" >&2
106
+ exit 1
107
+fi
108
87
-cache_dir="$HOME/travis-cache"
109
good_trees_file="$cache_dir/good-trees"
110
111
mkdir -p "$cache_dir"
115
116
if test -z "$jobname"
117
then
97
- jobname="$TRAVIS_OS_NAME-$CC"
118
+ jobname="$CI_OS_NAME-$CC"
119
fi
120
121
export DEVELOPER=1
122
export DEFAULT_TEST_TARGET=prove
102
-export GIT_PROVE_OPTS="--timer --jobs 3 --state=failed,slow,save"
103
-export GIT_TEST_OPTS="--verbose-log -x --immediate"
123
export GIT_TEST_CLONE_2GB=YesPlease
124
if [ "$jobname" = linux-gcc ]; then
125
export CC=gcc-8