forked from percona/percona-server
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
417 lines (397 loc) · 16.9 KB
/
.travis.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
# Ubuntu 18.04
dist: bionic
sudo: required
language: cpp
cache:
ccache: true
timeout: 600
directories:
- $TRAVIS_BUILD_DIR/deps # cache Boost libraries
env:
global:
- PARENT_BRANCH=8.0
- CCACHE_DIR=$HOME/.ccache
- CCACHE_COMPRESS=1
- CCACHE_COMPRESSLEVEL=9
- CCACHE_MAXSIZE=500Mi
- CCACHE_CPP2=1
matrix:
include:
# Common
- env: COMMAND=clang-test
script:
- curl -sSL "http://apt.llvm.org/llvm-snapshot.gpg.key" | sudo -E apt-key add -;
- echo "deb http://apt.llvm.org/$TRAVIS_DIST/ llvm-toolchain-$TRAVIS_DIST-10 main" | sudo tee -a /etc/apt/sources.list > /dev/null;
- sudo -E apt-get -yq update >> ~/apt-get-update.log 2>&1;
- sudo -E apt-get -yq --no-install-suggests --no-install-recommends install diffstat clang-format-10 || travis_terminate 1
- git diff -U0 --no-color HEAD^1 *.c *.cc *.cpp *.h *.hpp *.i *.ic *.ih | clang-format-diff-10 -style=file -p1 >_GIT_DIFF
- '[ ! -s _GIT_DIFF ] && { echo The last git commit is clang-formatted; travis_terminate 0; } || { diffstat _GIT_DIFF; echo; cat _GIT_DIFF; travis_terminate 1; }'
# Configurations for developers' forks and after merging a pull request for percona/percona-server
# 12
- if: repo != percona/percona-server OR repo = percona/percona-server AND type IN (push, cron)
env: BUILD=Debug
compiler: clang
os: osx
osx_image: xcode12
# 11
- if: repo != percona/percona-server OR repo = percona/percona-server AND type IN (push, cron)
env: VERSION=12 BUILD=Debug INVERTED=ON
compiler: clang
# 10
- if: repo != percona/percona-server OR repo = percona/percona-server AND type IN (push, cron)
env: VERSION=12 BUILD=RelWithDebInfo
compiler: clang
# 9
- if: repo != percona/percona-server OR repo = percona/percona-server AND type IN (push, cron)
env: VERSION=10 BUILD=Debug
compiler: clang
# 8
- if: repo != percona/percona-server OR repo = percona/percona-server AND type IN (push, cron)
env: VERSION=8 BUILD=Debug
compiler: clang
# 7
- if: repo != percona/percona-server OR repo = percona/percona-server AND type IN (push, cron)
env: VERSION=6.0 BUILD=Debug
compiler: clang
# 6
- if: repo != percona/percona-server OR repo = percona/percona-server AND type IN (push, cron)
env: VERSION=4.0 BUILD=Debug
compiler: clang
# 5
- if: repo != percona/percona-server OR repo = percona/percona-server AND type IN (push, cron)
env: VERSION=11 BUILD=Debug
compiler: gcc
# 4
- if: repo != percona/percona-server OR repo = percona/percona-server AND type IN (push, cron)
env: VERSION=10 BUILD=Debug
compiler: gcc
# 3
- if: repo != percona/percona-server OR repo = percona/percona-server AND type IN (push, cron)
env: VERSION=8 BUILD=Debug
compiler: gcc
# 2
- if: repo != percona/percona-server OR repo = percona/percona-server AND type IN (push, cron)
env: VERSION=6 BUILD=Debug
compiler: gcc
# 1
- if: repo != percona/percona-server OR repo = percona/percona-server AND type IN (push, cron)
env: VERSION=5 BUILD=Debug
compiler: gcc
# Configurations for a pull request and after merging for percona/percona-server
# 12
- if: branch =~ fullci OR repo = percona/percona-server AND type IN (push, cron)
env: BUILD=RelWithDebInfo
compiler: clang
os: osx
osx_image: xcode12
# 11
- if: branch =~ fullci OR repo = percona/percona-server AND type IN (push, pull_request, cron)
env: VERSION=12 BUILD=RelWithDebInfo INVERTED=ON
compiler: clang
# 10
- if: branch =~ fullci OR repo = percona/percona-server AND type IN (push, pull_request, cron)
env: VERSION=12 BUILD=Debug
compiler: clang
# 9
- if: branch =~ fullci OR repo = percona/percona-server AND type IN (push, cron)
env: VERSION=10 BUILD=RelWithDebInfo
compiler: clang
# 8
- if: branch =~ fullci OR repo = percona/percona-server AND type IN (push, cron)
env: VERSION=8 BUILD=RelWithDebInfo
compiler: clang
# 7
- if: branch =~ fullci OR repo = percona/percona-server AND type IN (push, cron)
env: VERSION=6.0 BUILD=RelWithDebInfo
compiler: clang
# 6
- if: branch =~ fullci OR repo = percona/percona-server AND type IN (push, pull_request, cron)
env: VERSION=4.0 BUILD=RelWithDebInfo
compiler: clang
# 5
- if: branch =~ fullci OR repo = percona/percona-server AND type IN (push, pull_request, cron)
env: VERSION=11 BUILD=RelWithDebInfo
compiler: gcc
# 4
- if: branch =~ fullci OR repo = percona/percona-server AND type IN (push, cron)
env: VERSION=10 BUILD=RelWithDebInfo
compiler: gcc
# 3
- if: branch =~ fullci OR repo = percona/percona-server AND type IN (push, cron)
env: VERSION=8 BUILD=RelWithDebInfo
compiler: gcc
# 2
- if: branch =~ fullci OR repo = percona/percona-server AND type IN (push, cron)
env: VERSION=6 BUILD=RelWithDebInfo
compiler: gcc
# 1
- if: branch =~ fullci OR repo = percona/percona-server AND type IN (push, pull_request, cron)
env: VERSION=5 BUILD=RelWithDebInfo
compiler: gcc
# Configurations to be run after merging a pull request for percona/percona-server
# 27
- if: branch =~ extraci OR repo = percona/percona-server AND type IN (push, cron)
env: VERSION=11 BUILD=RelWithDebInfo INVERTED=ON
compiler: clang
# 26
- if: branch =~ extraci OR repo = percona/percona-server AND type IN (push, cron)
env: VERSION=11 BUILD=RelWithDebInfo
compiler: clang
# 25
- if: branch =~ extraci OR repo = percona/percona-server AND type IN (push, cron)
env: VERSION=11 BUILD=Debug
compiler: clang
# 24
- if: branch =~ extraci OR repo = percona/percona-server AND type IN (push, cron)
env: VERSION=10 BUILD=RelWithDebInfo INVERTED=ON
compiler: clang
# 23
- if: branch =~ extraci OR repo = percona/percona-server AND type IN (push, cron)
env: VERSION=9 BUILD=RelWithDebInfo INVERTED=ON
compiler: clang
# 22
- if: branch =~ extraci OR repo = percona/percona-server AND type IN (push, cron)
env: VERSION=9 BUILD=RelWithDebInfo
compiler: clang
# 21
- if: branch =~ extraci OR repo = percona/percona-server AND type IN (push, cron)
env: VERSION=9 BUILD=Debug
compiler: clang
# 20
- if: branch =~ extraci OR repo = percona/percona-server AND type IN (push, cron)
env: VERSION=8 BUILD=RelWithDebInfo INVERTED=ON
compiler: clang
# 19
- if: branch =~ extraci OR repo = percona/percona-server AND type IN (push, cron)
env: VERSION=7 BUILD=RelWithDebInfo INVERTED=ON
compiler: clang
# 18
- if: branch =~ extraci OR repo = percona/percona-server AND type IN (push, cron)
env: VERSION=7 BUILD=RelWithDebInfo
compiler: clang
# 17
- if: branch =~ extraci OR repo = percona/percona-server AND type IN (push, cron)
env: VERSION=7 BUILD=Debug
compiler: clang
# 16
- if: branch =~ extraci OR repo = percona/percona-server AND type IN (push, cron)
env: VERSION=6.0 BUILD=RelWithDebInfo INVERTED=ON
compiler: clang
# 15
- if: branch =~ extraci OR repo = percona/percona-server AND type IN (push, cron)
env: VERSION=5.0 BUILD=RelWithDebInfo INVERTED=ON
compiler: clang
# 14
- if: branch =~ extraci OR repo = percona/percona-server AND type IN (push, cron)
env: VERSION=5.0 BUILD=RelWithDebInfo
compiler: clang
# 13
- if: branch =~ extraci OR repo = percona/percona-server AND type IN (push, cron)
env: VERSION=5.0 BUILD=Debug
compiler: clang
# 12
- if: branch =~ extraci OR repo = percona/percona-server AND type IN (push, cron)
env: VERSION=4.0 BUILD=RelWithDebInfo INVERTED=ON
compiler: clang
# 11
- if: branch =~ extraci OR repo = percona/percona-server AND type IN (push, cron)
env: VERSION=11 BUILD=RelWithDebInfo INVERTED=ON
compiler: gcc
# 10
- if: branch =~ extraci OR repo = percona/percona-server AND type IN (push, cron)
env: VERSION=10 BUILD=RelWithDebInfo INVERTED=ON
compiler: gcc
# 9
- if: branch =~ extraci OR repo = percona/percona-server AND type IN (push, cron)
env: VERSION=9 BUILD=RelWithDebInfo
compiler: gcc
# 8
- if: branch =~ extraci OR repo = percona/percona-server AND type IN (push, cron)
env: VERSION=9 BUILD=Debug
compiler: gcc
# 7
- if: branch =~ extraci OR repo = percona/percona-server AND type IN (push, cron)
env: VERSION=8 BUILD=RelWithDebInfo INVERTED=ON
compiler: gcc
# 6
- if: branch =~ extraci OR repo = percona/percona-server AND type IN (push, cron)
env: VERSION=7 BUILD=RelWithDebInfo
compiler: gcc
# 5
- if: branch =~ extraci OR repo = percona/percona-server AND type IN (push, cron)
env: VERSION=7 BUILD=Debug
compiler: gcc
# 2
- if: branch =~ extraci OR repo = percona/percona-server AND type IN (push, cron)
env: VERSION=6 BUILD=RelWithDebInfo INVERTED=ON
compiler: gcc
# 1
- if: branch =~ extraci OR repo = percona/percona-server AND type IN (push, cron)
env: VERSION=5 BUILD=RelWithDebInfo INVERTED=ON
compiler: gcc
script:
- INIT_TIME=$SECONDS;
JOB_NUMBER=$(echo $TRAVIS_JOB_NUMBER | sed -e 's:[0-9][0-9]*\.\(.*\):\1:');
echo --- Initialization time $INIT_TIME seconds;
echo --- JOB_NUMBER=$JOB_NUMBER TRAVIS_COMMIT=$TRAVIS_COMMIT TRAVIS_COMMIT_RANGE=$TRAVIS_COMMIT_RANGE TRAVIS_REPO_SLUG=$TRAVIS_REPO_SLUG TRAVIS_BRANCH=$TRAVIS_BRANCH TRAVIS_EVENT_TYPE=$TRAVIS_EVENT_TYPE TRAVIS_PULL_REQUEST=$TRAVIS_PULL_REQUEST TRAVIS_PULL_REQUEST_BRANCH=$TRAVIS_PULL_REQUEST_BRANCH
- echo --- Perform all Travis jobs or only jobs that are included in ENV_VAR_JOB_NUMBERS list if it is defined;
JOB_NUMBERS="1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52";
if [[ "$ENV_VAR_JOB_NUMBERS" != "" ]]; then
JOB_NUMBERS=$ENV_VAR_JOB_NUMBERS;
fi;
JOB_ARRAY=(${JOB_NUMBERS// / });
if [[ ! " ${JOB_ARRAY[@]} " =~ " ${JOB_NUMBER} " ]]; then
echo --- Finishing as job ${JOB_NUMBER} is not on a list = $JOB_NUMBERS;
travis_terminate 0;
fi;
# For pull requests and feature branches replace TRAVIS_COMMIT_RANGE with the range from the root to the tip of the branch
# For the trunk use the commit number of last successful build if exists
- if [[ "$TRAVIS_EVENT_TYPE" == "pull_request" ]] || [[ "$TRAVIS_REPO_SLUG" != "percona/percona-server" ]]; then
if [[ "$TRAVIS_EVENT_TYPE" == "pull_request" ]]; then TRAVIS_COMMIT=$TRAVIS_COMMIT^2; fi;
git fetch https://github.com/percona/percona-server.git $PARENT_BRANCH:master_repo_$PARENT_BRANCH;
PARENT_COMMIT=$(git rev-list --first-parent --topo-order $TRAVIS_COMMIT ^master_repo_$PARENT_BRANCH | tail -1);
TRAVIS_COMMIT_RANGE=$PARENT_COMMIT^..$TRAVIS_COMMIT;
else
if [ -s "$CCACHE_DIR/last_commit.txt" ]; then
TRAVIS_COMMIT_RANGE=$(cat $CCACHE_DIR/last_commit.txt)..$TRAVIS_COMMIT;
else
TRAVIS_COMMIT_RANGE="Force testing of this commit";
fi;
fi;
if MODIFIED_FILES=$(git diff --name-only $TRAVIS_COMMIT_RANGE 2>/dev/null); then
echo -e "--- Modified files in $TRAVIS_COMMIT_RANGE:\n$MODIFIED_FILES";
if echo "$MODIFIED_FILES" | grep -qvE '^(doc|build-ps|mysql-test|packaging|policy|scripts|support-files)/'; then
echo "--- Code changes were found";
else
echo "--- There are no code changes, stopping build process.";
travis_terminate 0;
fi;
else
echo "--- Can't prepare MODIFIED_FILES for $TRAVIS_COMMIT_RANGE";
fi;
- echo --- Configure required LLVM and Ubuntu Toolchain repositories;
if [[ "$TRAVIS_OS_NAME" == "linux" ]] && [[ "$CC" == "clang" ]]; then
PACKAGES="llvm-$VERSION-dev $PACKAGES";
curl -sSL "http://apt.llvm.org/llvm-snapshot.gpg.key" | sudo -E apt-key add -;
if [[ "$CC-$VERSION" != "clang-4.0" ]]; then
echo "deb http://apt.llvm.org/$TRAVIS_DIST/ llvm-toolchain-$TRAVIS_DIST-$VERSION main" | sudo tee -a /etc/apt/sources.list > /dev/null;
fi;
fi;
if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
sudo -E apt-add-repository -y "ppa:ubuntu-toolchain-r/test";
fi;
- echo --- Update list of packages and download dependencies;
if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
TIMEOUT_CMD=timeout;
CC=$CC-$VERSION;
CXX=$CXX-$VERSION;
if [[ "$CC" == "clang-$VERSION" ]]; then
PACKAGES="$CC $PACKAGES";
else
PACKAGES="$CXX $PACKAGES";
fi;
sudo -E apt-get -yq update >> ~/apt-get-update.log 2>&1;
sudo -E apt-get -yq --allow-unauthenticated --no-install-suggests --no-install-recommends install $PACKAGES cmake cmake-curses-gui bison libncurses5-dev libaio-dev libmecab-dev libnuma-dev liblzma-dev libssl-dev || travis_terminate 1;
if [[ "$INVERTED" != "ON" ]]; then
sudo -E apt-get -yq --allow-unauthenticated --no-install-suggests --no-install-recommends install libeditline-dev liblz4-dev libre2-dev protobuf-compiler libprotobuf-dev libprotoc-dev libicu-dev || travis_terminate 1;
fi;
sudo ln -s $(which ccache) /usr/lib/ccache/$CC;
sudo ln -s $(which ccache) /usr/lib/ccache/$CXX || echo;
else
TIMEOUT_CMD=gtimeout;
curl -LO https://raw.githubusercontent.com/GiovanniBussi/macports-ci/master/macports-ci;
source ./macports-ci install;
yes | sudo port install ccache;
fi;
UPDATE_TIME=$(($SECONDS - $INIT_TIME));
echo --- Packages updated in $UPDATE_TIME seconds. Initialization time $INIT_TIME seconds.
- mkdir bin; cd bin;
- $CC -v
- $CXX -v
- CCACHE_BIN=$(which ccache)
- echo ccache=$CCACHE_BIN
- ccache --version
- ccache -p
ccache --zero-stats;
- echo --- Set cmake parameters;
COMPILE_OPT+=(
-DCMAKE_C_FLAGS_DEBUG=-g1
-DCMAKE_CXX_FLAGS_DEBUG=-g1
'-DCMAKE_C_FLAGS_RELWITHDEBINFO=-O2 -g1 -DNDEBUG'
'-DCMAKE_CXX_FLAGS_RELWITHDEBINFO=-O2 -g1 -DNDEBUG'
);
CMAKE_OPT="
-DCMAKE_BUILD_TYPE=$BUILD
-DBUILD_CONFIG=mysql_release
-DREPRODUCIBLE_BUILD=OFF
-DENABLE_DOWNLOADS=1
-DDOWNLOAD_BOOST=1
-DWITH_BOOST=../deps
-DCMAKE_C_COMPILER_LAUNCHER=$CCACHE_BIN
-DCMAKE_CXX_COMPILER_LAUNCHER=$CCACHE_BIN
-DWITH_KEYRING_VAULT=ON
-DWITH_KEYRING_VAULT_TEST=ON
-DWITHOUT_TOKUDB=ON
-DWITH_ROCKSDB=OFF
-DWITH_PAM=ON
";
if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
CMAKE_OPT+="
-DMYSQL_MAINTAINER_MODE=OFF
-DWITH_SYSTEM_LIBS=ON
-DWITH_ICU=/usr/local/opt/icu4c
-DWITH_RAPIDJSON=bundled
-DWITH_LZ4=bundled
";
else
CMAKE_OPT+="
-DMYSQL_MAINTAINER_MODE=ON
-DWITH_CURL=system
-DWITH_MECAB=system
-DWITH_RAPIDJSON=bundled
-DWITH_SSL=system
-DWITH_LIBEVENT=bundled
";
if [[ "$INVERTED" != "ON" ]]; then
CMAKE_OPT+="
-DWITH_READLINE=system
-DWITH_ICU=system
-DWITH_LZ4=system
-DWITH_PROTOBUF=system
-DWITH_ZLIB=system
-DWITH_NUMA=ON
";
else
CMAKE_OPT+="
-DWITH_EDITLINE=bundled
-DWITH_ICU=bundled
-DWITH_LZ4=bundled
-DWITH_PROTOBUF=bundled
-DWITH_ZLIB=bundled
-DWITH_NUMA=OFF
-DWITH_ARCHIVE_STORAGE_ENGINE=OFF
-DWITH_BLACKHOLE_STORAGE_ENGINE=OFF
-DWITH_EXAMPLE_STORAGE_ENGINE=ON
-DWITH_FEDERATED_STORAGE_ENGINE=OFF
-DWITHOUT_PERFSCHEMA_STORAGE_ENGINE=ON
-DWITH_INNODB_MEMCACHED=ON
";
fi;
fi;
- echo --- Perform Debug or RelWithDebInfo compilation;
echo --- CMAKE_OPT=\"$CMAKE_OPT\";
echo --- COMPILE_OPT=\"${COMPILE_OPT[@]}\";
echo --- ENV_VAR_CMAKE_OPT=\"$ENV_VAR_CMAKE_OPT\";
cmake .. $CMAKE_OPT $ENV_VAR_CMAKE_OPT "${COMPILE_OPT[@]}";
- CMAKE_TIME=$(($SECONDS - $INIT_TIME - $UPDATE_TIME));
if [[ "$TRAVIS_REPO_SLUG" == "percona/percona-server" ]]; then
TIMEOUT_TIME=$((176 * 60 - $SECONDS));
else
TIMEOUT_TIME=$((46 * 60 - $SECONDS));
fi;
echo --- Timeout $TIMEOUT_TIME seconds. CMake took $CMAKE_TIME seconds. Packages updated in $UPDATE_TIME seconds. Initialization time $INIT_TIME seconds.;
$TIMEOUT_CMD $TIMEOUT_TIME make -j2;
if [[ "$?" == "0" ]]; then echo $TRAVIS_COMMIT > $CCACHE_DIR/last_commit.txt; else false; fi;
- ccache --show-stats;
BUILD_TIME=$(($SECONDS - $INIT_TIME - $UPDATE_TIME - $CMAKE_TIME));
echo --- Total time $SECONDS seconds. Build time $BUILD_TIME/$TIMEOUT_TIME seconds. CMake took $CMAKE_TIME seconds. Packages updated in $UPDATE_TIME seconds. Initialization time $INIT_TIME seconds.