forked from ElektraInitiative/libelektra
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
387 lines (371 loc) · 10.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
language: cpp
dist: xenial
osx_image: xcode10.1
cache:
directories:
$HOME/.m2
$HOME/.cabal
$HOME/elektra-cabal-sandbox
$HOME/Library/Caches/Homebrew
# don't cache our own libraries generated in the build
# so they always get rebuilt properly and to avoid init issues
# we ignore the result as some or all might not exist on build
# errors, in that case unregister would fail
before_cache:
- rm -rf $HOME/.cabal/logs
- cd $HOME/elektra-cabal-sandbox
- cabal sandbox hc-pkg unregister spectranslator > /dev/null; true
- cabal sandbox hc-pkg unregister specelektra > /dev/null; true
- cabal sandbox hc-pkg unregister libfa > /dev/null; true
- cabal sandbox hc-pkg unregister libelektra-haskell > /dev/null; true
- rm -rf .cabal-sandbox/logs
- rm -f .cabal-sandbox/world
- rm -f .cabal-sandbox/add-source-timestamps
#
# Define the build matrix
#
matrix:
include:
# ASAN: Enable AddressSanitizer
- os: linux
name: 🐧 GCC ASAN
compiler: gcc
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- g++-8
env:
- ENABLE_ASAN=ON
- CC_COMPILER=gcc-8
- CXX_COMPILER=g++-8
# Build less stuff so the build does not hit the timeout limit that often
- TOOLS=kdb
- BINDINGS=cpp
- "PLUGINS='\
ALL;\
-augeas;\
-base64;\
-blockresolver;\
-boolean;\
-c;\
-cachefilter;\
-camel;\
-ccode;\
-conditionals;\
-constants;\
-counter;\
-cpptemplate;\
-crypto_botan;\
-crypto_gcrypt;\
-crypto_openssl;\
-csvstorage;\
-curlget;\
-date;\
-dbus;\
-dbusrecv;\
-desktop;\
-dini;\
-directoryvalue;\
-doc;\
-dpkg;\
-enum;\
-error;\
-fcrypt;\
-file;\
-filecheck;\
-gitresolver;\
-glob;\
-gpgme;\
-hexcode;\
-hexnumber;\
-hidden;\
-hosts;\
-iconv;\
-ini;\
-internalnotification;\
-ipaddr;\
-iterate;\
-keytometa;\
-line;\
-lineendings;\
-logchange;\
-mathcheck;\
-mini;\
-mmapstorage;\
-mmapstorage_crc;\
-mozprefs;\
-multifile;\
-network;\
-ni;\
-noresolver;\
-null;\
-passwd;\
-path;\
-process;\
-profile;\
-range;\
-regexstore;\
-rename;\
-required;\
-semlock;\
-shell;\
-simplespeclang;\
-struct;\
-sync;\
-syslog;\
-tcl;\
-template;\
-timeofday;\
-tracer;\
-type;\
-uname;\
-validation;\
-wresolver;\
-xmltool;\
-yajl;\
-yambi;\
-yamlcpp;\
-yamlsmith;\
-yanlr;\
-zeromqrecv;\
-zeromqsend;\
'"
script:
- ninja
- ninja run_nocheckshell
- os: linux
# The DBus library on Ubuntu Xenial Xerus seems to leak memory
# See: https://travis-ci.org/sanssecours/elektra/jobs/457428713
dist: trusty
name: 🐧 Clang ASAN
compiler: clang
addons:
apt:
sources:
- llvm-toolchain-trusty-7
- ubuntu-toolchain-r-test
packages:
- clang-7
env:
- ENABLE_ASAN=ON
- CC_COMPILER=clang-7
- CXX_COMPILER=clang++-7
script:
- ninja
- ninja run_all
# FULL: Build full version of Elektra (BUILD_FULL=ON)
- os: linux
name: 🐧 FULL
compiler: gcc
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- g++-8
env:
- BUILD_FULL=ON
- BUILD_SHARED=OFF
- CC_COMPILER=gcc-8
- CXX_COMPILER=g++-8
script:
- ninja
- output="$(ninja install 2>&1)" || printf '%s' "$output"
- ninja run_all
- kdb-full run_all
- os: osx
name: 🍏 GCC
# Translating the `syslog` plugin with GCC on macOS 10.13 does not work, since GCC is unable to compile `sys/syslog.h`.
osx_image: xcode9.2
compiler: gcc
env:
# Unfortunately the tests for the Xerces plugin fail: https://travis-ci.org/ElektraInitiative/libelektra/jobs/483331657#L3740
- PLUGINS='ALL;-xerces'
# HASKELL: Only build Haskell binding and plugin
- os: osx
name: 🍏 Haskell
compiler: clang
env:
- HASKELL=ON
# Use a minimal configuration for the haskell bindings to give it enough time to compile dependencies
- PLUGINS='resolver_fm_hpu_b;dump;dini;list;spec;haskell;typechecker;ini;sync;error;base64;regexdispatcher'
- BINDINGS=haskell
- TOOLS=kdb
- os: linux
name: 🐧 GCC
compiler: gcc
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- g++-8
env:
- CC_COMPILER=gcc-8
- CXX_COMPILER=g++-8
- os: linux
name: 🐧 Clang
compiler: clang
addons:
apt:
sources:
- llvm-toolchain-xenial-7
packages:
- clang-7
- clang-format-7
env:
- CC_COMPILER=clang-7
- CXX_COMPILER=clang++-7
before_install:
- |
if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
brew update
brew install ninja
fi
- |
if [[ "$TRAVIS_OS_NAME" == "osx" && "$HASKELL" != "ON" ]]; then
rvm install 2.5.1
rvm use 2.5.1
gem install test-unit --no-document
if [[ "$CC" == "gcc" ]]; then
brew install gcc
brew link --overwrite gcc
gcc_version_major=$(brew info gcc | head -n1 | sed -E 's/[^0-9]*([0-9]+)\..*/\1/')
export CC="gcc-$gcc_version_major"
export CXX="g++-$gcc_version_major"
else
# Use latest version of LLVM to translate the code
brew install llvm
export CC=/usr/local/opt/llvm/bin/clang CXX=/usr/local/opt/llvm/bin/clang++
# Linking Botan, ANTLR’s C++ runtime, and yaml-cpp using `gcc` fails on macOS
brew install antlr
brew install antlr4-cpp-runtime
brew install botan
brew install yaml-cpp
# Unfortunately Xerces 3.2 causes multiple problems if we translate Elektra with GCC on macOS
brew install xerces-c
# OCLint complains about unknown compiler warning options, if we use GCC as compiler.
brew cask install oclint
fi
brew install bison
brew install dbus
brew install discount
brew install gpgme
brew install libgcrypt
brew install libgit2
brew install libuv
brew install libev
brew install lua
brew install openssl
brew install pegtl
brew install python@2; brew link --overwrite python@2
brew install python || brew upgrade python
brew install qt
brew install swig
brew install yajl
brew install zeromq
pip2 install cheetah # Required by kdb-gen
# start D-Bus session bus
brew services start dbus
fi
- |
if [[ "$TRAVIS_OS_NAME" == "osx" && "$HASKELL" == "ON" ]] ; then
brew install augeas
# 8.4 is currently not supported by hint which we use
brew install ghc@8.2
brew link ghc@8.2 --force
brew install cabal-install
cabal update
# avoid reinstalls if we already have them cached
PATH=$PATH:"$HOME/.cabal/bin"
which happy || cabal install happy
which alex || cabal install alex
which c2hs || cabal install c2hs
export HASKELL_SHARED_SANDBOX=$HOME/elektra-cabal-sandbox
mkdir -p $HASKELL_SHARED_SANDBOX
cd $HASKELL_SHARED_SANDBOX
cabal sandbox init
# there is some strange cache bug where it complains that one of our own library's
# directory doesn't exist though it gets properly unregistered. Apparently ignoring
# that works anyway.
cabal install --avoid-reinstalls \
'base >=4.9 && <4.12' \
'binary >=0.8 && <0.9' \
'containers >=0.5 && <0.6' \
'directory >=1.2 && <1.4' \
'exceptions -any' \
'haskell-src-exts-any' \
'hint >=0.7.0 && <0.8.0' \
'hspec -any' \
'megaparsec -any' \
'pretty -any' \
'process >=1.4 && <1.7' \
'QuickCheck-any' \
'simple-logger -any' \
'temporary -any' \
'text -any' \
|| true
fi
- |
if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
[[ -n "$CC_COMPILER" ]] && export CC="$CC_COMPILER"
[[ -n "$CXX_COMPILER" ]] && export CXX="$CXX_COMPILER"
sudo apt-get -qq update
sudo apt-get install ninja-build
sudo apt-get install devscripts # contains `checkbashisms`
sudo apt-get install libboost-all-dev
sudo apt-get install libyaml-cpp-dev
sudo apt-get install libuv-dev
sudo apt-get install libdbus-1-dev
sudo apt-get install libev-dev
sudo apt-get install libzmq3-dev
sudo apt-get install libxerces-c-dev
sudo apt-get install moreutils # contains `sponge` required by `reformat-cmake`
sudo pip install cmake-format==0.4.5 pyyaml
git clone --branch 2.7.1 --depth 1 https://github.com/taocpp/PEGTL.git && sudo cp -R PEGTL/include/tao /usr/local/include
mkdir -p "$HOME/bin" && cd "$HOME/bin" && \
curl -L "https://github.com/mvdan/sh/releases/download/v2.6.3/shfmt_v2.6.3_linux_amd64" -o shfmt && \
chmod u+x shfmt && export PATH=$PATH:"$HOME/bin"
fi
#
# Source is checked out in $TRAVIS_BUILD_DIR
# Build directory will be TRAVIS_BUILD_DIR/../build
#
before_script:
- |
cd $TRAVIS_BUILD_DIR
if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
CMAKE_OPT+=(-DCMAKE_INSTALL_PREFIX="$PWD/install")
export PATH=$PATH:"$PWD/install/bin"
fi
SYSTEM_DIR="$PWD/kdbsystem"
mkdir build && cd build
CMAKE_OPT+=(
-GNinja
-DPLUGINS="${PLUGINS:-ALL}"
-DBINDINGS="${BINDINGS:-ALL}"
-DTOOLS="${TOOLS:-ALL}"
-DBUILD_FULL="${BUILD_FULL:-OFF}"
-DBUILD_SHARED="${BUILD_SHARED:-ON}"
-DENABLE_ASAN="${ENABLE_ASAN:-OFF}"
-DCOMMON_FLAGS="${COMMON_FLAGS:--Werror}"
-DENABLE_DEBUG=ON
-DINSTALL_SYSTEM_FILES=OFF
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON
-DKDB_DB_SYSTEM="$SYSTEM_DIR"
-DKDB_DEFAULT_STORAGE="${KDB_DEFAULT_STORAGE:-dump}"
-DKDB_DB_FILE="${KDB_DB_FILE:-default.ecf}"
-DKDB_DB_INIT="${KDB_DB_INIT:-elektra.ecf}"
$TRAVIS_BUILD_DIR
)
- |
printf '—— CMake Config ——\n'
for option in "${CMAKE_OPT[@]}"; do printf '%s\n' "$option"; done
- cmake ${CMAKE_OPT[@]}
script:
- ninja
- output="$(ninja install 2>&1)" || printf '%s' "$output"
- ninja run_all
- kdb run_all