-
Notifications
You must be signed in to change notification settings - Fork 123
/
.travis.yml
212 lines (193 loc) · 6.78 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
language: cpp
cache:
directories:
$HOME/.m2
$HOME/.cabal
$HOME/Library/Haskell
$TRAVIS_BUILD_DIR/../build/.cabal-sandbox
#
# Define the build matrix
#
matrix:
include:
# FAST: Do not install any dependencies
- os: osx
osx_image: xcode9.3beta
compiler: clang
env: [ FAST=ON ]
# ASAN: Enable AddressSanitizer
- os: osx
osx_image: xcode9.3beta
compiler: clang
env: [ ASAN=ON ]
- os: linux
compiler: gcc
addons:
apt:
sources: [ ubuntu-toolchain-r-test ]
packages: [ g++-7 ]
env: [ ASAN=ON ]
- os: linux
compiler: clang
env: [ ASAN=ON ]
# FULL: Build full version of Elektra (BUILD_FULL=ON)
- os: linux
compiler: gcc
env: [ FULL=ON ]
- os: osx
# 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
- os: osx
osx_image: xcode9.3beta
compiler: clang
# HASKELL: Only build Haskell binding and plugin
- os: osx
osx_image: xcode9.3beta
compiler: clang
env: [ HASKELL=ON ]
- os: linux
compiler: gcc
apt:
sources: [ llvm-toolchain-trusty-6.0, ubuntu-toolchain-r-test]
packages: [ clang-format-6.0 ]
- os: linux
compiler: clang
addons:
apt:
sources: [ llvm-toolchain-trusty-5.0 ]
packages: [ clang-format-5.0 ]
before_install:
- |
if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
brew update
brew install ninja
fi
- |
if [[ "$TRAVIS_OS_NAME" == "osx" && "$FAST" != "ON" && "$HASKELL" != "ON" ]]; then
rvm install 2.3.1
rvm use 2.3.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 the Homebrew versions of Botan and yaml-cpp using `gcc` fails on macOS
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
fi
brew install augeas
brew install clang-format
brew install checkbashisms
brew install dbus
brew install discount
brew install libgcrypt
brew install libgit2
brew install libuv
brew install lua
brew install openssl
export PKG_CONFIG_PATH=/usr/local/opt/openssl/lib/pkgconfig
brew install python@2; brew link --overwrite python@2
brew install python || brew upgrade python
# Since Qt 5.10.1 GCC is unable to compile the Qt-GUI under macOS printing the following error message:
# 'init_priority' attribute is not supported on this platform
brew install qt@5.5
brew install swig
brew install yajl
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 cabal-install
cabal update
# avoid reinstalls if we already have them cached
# disable everything that slows down compilation times of the dependencies to have reasonable travis build times
PATH=$PATH:"$HOME/.cabal/bin"
which happy || cabal install happy
which alex || cabal install alex
which c2hs || cabal install c2hs
fi
- |
if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
[[ $ASAN == ON && $CC == gcc ]] && export CC=gcc-7 CXX=g++-7
sudo apt-get -qq update
sudo apt-get install ninja-build
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 libxerces-c-dev
fi
#
# Source is checked out in $TRAVIS_BUILD_DIR
# Build directory will be TRAVIS_BUILD_DIR/../build
#
before_script:
- cd $TRAVIS_BUILD_DIR/..
- >
[[ "$TRAVIS_OS_NAME" == "linux" ]] && INSTALL_DIR="$PWD/install" || INSTALL_DIR="/usr/local"
- SYSTEM_DIR="$PWD/kdbsystem"
# gets created due to sandbox caching automatically
- cd build
- >
[[ $ASAN == ON ]] && CMAKE_OPT=(-DENABLE_ASAN=ON) || CMAKE_OPT=()
- if [[ $FULL == ON ]]; then CMAKE_OPT+=(-DBUILD_FULL=ON); fi
- |
if [[ "$TRAVIS_OS_NAME" == "linux" && "$CC" == "clang" || "$TRAVIS_OS_NAME" == "osx" ]]; then
CMAKE_OPT+=("-DCOMMON_FLAGS=-Werror")
fi
# use a minimal configuration for the haskell bindings to give it enough time to compile dependencies
- |
if [[ $HASKELL == ON ]]; then
bindings="haskell"
plugins="resolver_fm_hpu_b;dump;list;spec"
tools="kdb"
fi
- |
if [[ "$TRAVIS_OS_NAME" == "osx" && "$FAST" != "ON" && "$HASKELL" != "ON" ]]; then
python2_ver=$(python2 -c 'import sys; print(".".join(map(str, sys.version_info[:2])))') && \
CMAKE_OPT+=("-DPYTHON2_INCLUDE_DIR:PATH=$(python2-config --prefix)/include/python${python2_ver}") && \
CMAKE_OPT+=("-DPYTHON2_LIBRARY:FILEPATH=$(python2-config --prefix)/lib/libpython${python2_ver}.dylib") && \
python3_ver=$(python3 -c 'import sys; print(".".join(map(str, sys.version_info[:2])))') && \
CMAKE_OPT+=("-DPYTHON_INCLUDE_DIR:PATH=$(python3-config --prefix)/include/python${python3_ver}m") && \
CMAKE_OPT+=("-DPYTHON_LIBRARY:FILEPATH=$(python3-config --prefix)/lib/libpython${python3_ver}.dylib")
fi
- >
cmake
-GNinja
-DPLUGINS="${plugins:-ALL;-jni}"
-DBINDINGS="${bindings:-ALL}"
-DENABLE_DEBUG=ON
-DTOOLS="${tools:-ALL;}"
-DINSTALL_SYSTEM_FILES=OFF
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON
-DCMAKE_INSTALL_PREFIX="$INSTALL_DIR"
-DKDB_DB_SYSTEM="$SYSTEM_DIR"
${CMAKE_OPT[@]}
$TRAVIS_BUILD_DIR
- export PATH=$PATH:"$INSTALL_DIR/bin"
script:
- ninja
- |
if [[ "$FAST" == "ON" ]]; then
ninja run_all
elif [[ "$ASAN" = "ON" && "$TRAVIS_OS_NAME" == "linux" && "$CC" == "clang" ]]; then
# preload required libraries (LD_PRELOAD is a space separated list)
UBSAN_LIBRARY=$(find /usr/ -name '*libclang_rt.ubsan_standalone_cxx-x86_64.so')
LD_PRELOAD="$UBSAN_LIBRARY" ASAN_OPTIONS=symbolize=1 ASAN_SYMBOLIZER_PATH=$(which llvm-symbolizer) ninja run_all
elif [[ "$ASAN" = "ON" ]]; then
ASAN_OPTIONS=symbolize=1 ASAN_SYMBOLIZER_PATH=$(which llvm-symbolizer) ninja run_all
else
ninja install
ninja run_all && kdb run_all
fi