forked from GridTools/serialbox
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.travis.yml
330 lines (284 loc) · 9.59 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
sudo: required
dist: trusty
language: cpp
#===---------------------------------------------------------------------------------------------===
# Build Matrix
#===---------------------------------------------------------------------------------------------===
matrix:
include:
# OSX / Clang
- os: osx
osx_image: xcode7.3
env: CONFIG=Debug
- os: osx
osx_image: xcode7.3
env: CONFIG=Release
- os: osx
osx_image: xcode8
env: CONFIG=Debug
- os: osx
osx_image: xcode8
env: CONFIG=Release
# Linux / GCC
- os: linux
compiler: gcc
env:
- CXX_COMPILER=g++-4.9
- C_COMPILER=gcc-4.9
- FC_COMPILER=gfortran-4.9
- CONFIG=Release
addons:
apt:
sources: ['ubuntu-toolchain-r-test']
packages:
- gcc-4.9
- g++-4.9
- gfortran-4.9
- libboost-all-dev
- os: linux
compiler: gcc
env:
- CXX_COMPILER=g++-4.9
- C_COMPILER=gcc-4.9
- FC_COMPILER=gfortran-4.9
- CONFIG=Debug
addons:
apt:
sources: ['ubuntu-toolchain-r-test']
packages:
- gcc-4.9
- g++-4.9
- gfortran-4.9
- libboost-all-dev
- os: linux
compiler: gcc
env:
- CXX_COMPILER=g++-5
- C_COMPILER=gcc-5
- FC_COMPILER=gfortran-5
- CONFIG=Release
- BOOST_VERSION=1.60.0
addons:
apt:
sources: ['ubuntu-toolchain-r-test']
packages:
- g++-5
- gcc-5
- gfortran-5
- os: linux
compiler: gcc
env:
- CXX_COMPILER=g++-6
- C_COMPILER=gcc-6
- FC_COMPILER=gfortran-6
- CONFIG=Release
- BOOST_VERSION=1.60.0
addons:
apt:
sources: ['ubuntu-toolchain-r-test']
packages:
- g++-6
- gcc-6
- gfortran-6
# Linux / Clang
- os: linux
env:
- LLVM_VERSION=3.6.2
- CONFIG=Release
compiler: clang
addons:
apt:
sources: ['ubuntu-toolchain-r-test']
packages:
- libboost-all-dev
- os: linux
env:
- LLVM_VERSION=3.6.2
- CONFIG=Debug
compiler: clang
addons:
apt:
sources: ['ubuntu-toolchain-r-test']
packages:
- libboost-all-dev
- os: linux
env:
- LLVM_VERSION=3.7.1
- CONFIG=Release
compiler: clang
addons:
apt:
sources: ['ubuntu-toolchain-r-test']
packages:
- libboost-all-dev
- os: linux
env:
- LLVM_VERSION=3.8.1
- CONFIG=Release
compiler: clang
addons:
apt:
sources: ['ubuntu-toolchain-r-test']
packages:
- libboost-all-dev
# Set directories to cache
cache:
directories:
- ${TRAVIS_BUILD_DIR}/deps/llvm-3.6.2
- ${TRAVIS_BUILD_DIR}/deps/llvm-3.7.1
- ${TRAVIS_BUILD_DIR}/deps/llvm-3.8.1
- ${TRAVIS_BUILD_DIR}/deps/boost-1.60.0-gcc-5
- ${TRAVIS_BUILD_DIR}/deps/boost-1.60.0-gcc-6
#===---------------------------------------------------------------------------------------------===
# Installation
#===---------------------------------------------------------------------------------------------===
install:
# Create deps dir if not existing
- DEPS_DIR="${TRAVIS_BUILD_DIR}/deps"
- mkdir -p ${DEPS_DIR}
- pushd $(pwd)
- cd ${DEPS_DIR}
# Make sure CXX and C are set correctly for Linux builds
- if [[ "${CXX_COMPILER}" != "" ]]; then export CXX=${CXX_COMPILER}; fi
- if [[ "${C_COMPILER}" != "" ]]; then export CC=${C_COMPILER}; fi
# Make sure FC is correctly set
- if [[ "${FC_COMPILER}" != "" ]]; then export FC=${FC_COMPILER}; fi
# Make sure CMAKE_BUILD_TYPE is correctly set
- if [[ "${CONFIG}" != "" ]]; then export CMAKE_BUILD_TYPE=${CONFIG}; fi
# Install LLVM/clang when LLVM_VERSION is set (this may use the cached version)
- |
if [[ "${LLVM_VERSION}" != "" ]]; then
LLVM_DIR=${DEPS_DIR}/llvm-${LLVM_VERSION}
if [[ -z "$(ls -A ${LLVM_DIR})" ]]; then
travis_retry wget --quiet https://cmake.org/files/v3.6/cmake-3.6.1.tar.gz
tar xfz cmake-3.6.1.tar.gz
(cd cmake-3.6.1 && ./configure --prefix=${LLVM_DIR}/cmake && make install)
export PATH="${LLVM_DIR}/cmake/bin:${PATH}"
LLVM_URL="http://llvm.org/releases/${LLVM_VERSION}/llvm-${LLVM_VERSION}.src.tar.xz"
LIBCXX_URL="http://llvm.org/releases/${LLVM_VERSION}/libcxx-${LLVM_VERSION}.src.tar.xz"
LIBCXXABI_URL="http://llvm.org/releases/${LLVM_VERSION}/libcxxabi-${LLVM_VERSION}.src.tar.xz"
CLANG_URL="http://llvm.org/releases/${LLVM_VERSION}/clang+llvm-${LLVM_VERSION}-x86_64-linux-gnu-ubuntu-14.04.tar.xz"
mkdir -p ${LLVM_DIR} ${LLVM_DIR}/build ${LLVM_DIR}/projects/libcxx ${LLVM_DIR}/projects/libcxxabi ${LLVM_DIR}/clang
travis_retry wget --quiet -O - ${LLVM_URL} | tar --strip-components=1 -xJ -C ${LLVM_DIR}
travis_retry wget --quiet -O - ${LIBCXX_URL} | tar --strip-components=1 -xJ -C ${LLVM_DIR}/projects/libcxx
travis_retry wget --quiet -O - ${LIBCXXABI_URL} | tar --strip-components=1 -xJ -C ${LLVM_DIR}/projects/libcxxabi
travis_retry wget --quiet -O - ${CLANG_URL} | tar --strip-components=1 -xJ -C ${LLVM_DIR}/clang
(cd ${LLVM_DIR}/build && cmake .. -DCMAKE_INSTALL_PREFIX=${LLVM_DIR}/install -DCMAKE_CXX_COMPILER=clang++)
(cd ${LLVM_DIR}/build/projects/libcxx && make install -j2)
(cd ${LLVM_DIR}/build/projects/libcxxabi && make install -j2)
fi
export CC="${LLVM_DIR}/clang/bin/clang"
export CXX="${LLVM_DIR}/clang/bin/clang++"
fi
# Compile and install Boost when BOOST_VERSION is set (only works with gcc at the moment)
# this may use the cached version
- |
if [[ "${BOOST_VERSION}" != "" ]]; then
BOOST_DIR=${DEPS_DIR}/boost-${BOOST_VERSION}-${C_COMPILER}
if [[ -z "$(ls -A ${BOOST_DIR})" ]]; then
BOOST_URL="http://sourceforge.net/projects/boost/files/boost/${BOOST_VERSION}/boost_${BOOST_VERSION//\./_}.tar.gz"
mkdir -p ${BOOST_DIR}
{ travis_retry wget --quiet -O - ${BOOST_URL} | tar --strip-components=1 -xz -C ${BOOST_DIR}; } || exit 1
GCC_VERSION=$(${CXX} -dumpversion)
pushd $(pwd)
cd ${BOOST_DIR}
echo "using gcc : ${GCC_VERSION} : ${CXX} ;" > user-config.jam
./bootstrap.sh
./b2 -j2 --toolset=gcc-${GCC_VERSION} --prefix="${BOOST_DIR}" \
--user-config=${BOOST_DIR}/user-config.jam --with-filesystem \
--with-chrono \
--with-system \
--with-log --d+2 install
popd
fi
CMAKE_OPTIONS="-DBOOST_ROOT=${BOOST_DIR}"
fi
# Install a recent CMake (unless already installed on OS X)
- |
if [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then
CMAKE_URL="http://www.cmake.org/files/v3.5/cmake-3.5.2-Linux-x86_64.tar.gz"
mkdir cmake && travis_retry wget --no-check-certificate --quiet -O - ${CMAKE_URL} | tar --strip-components=1 -xz -C cmake
export PATH=${DEPS_DIR}/cmake/bin:$PATH
else
if ! brew ls --version cmake &>/dev/null; then brew install cmake; fi
fi
# Install Python dependencies (Linux) [using python directly in opt/python is not officially
# supported and thus the versions may change]
- |
if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
PYTHON_DIR=/opt/python/3.5.2
${PYTHON_DIR}/bin/pip3 install nose numpy
fi
# Install Python dependencies (Mac OSX)
- |
if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
brew update
brew install python3
pip3 install numpy nose
brew tap homebrew/science
brew install netcdf
export PATH=/usr/local/bin:${PATH}
fi
- popd
#===---------------------------------------------------------------------------------------------===
# Building
#===---------------------------------------------------------------------------------------------===
before_script:
- mkdir build
- pushd $(pwd)
- cd build
- |
if [[ "${FC_COMPILER}" != "" ]]; then
SERIALBOX_ENABLE_FORTRAN=ON
else
SERIALBOX_ENABLE_FORTRAN=OFF
fi
# Linux build
- |
if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
cmake ../ -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} \
-DPYTHON_EXECUTABLE=${PYTHON_DIR}/bin/python3 \
-DSERIALBOX_TESTING=ON \
-DSERIALBOX_ENABLE_FORTRAN=${SERIALBOX_ENABLE_FORTRAN} \
${CMAKE_OPTIONS}
fi
# OSX build
- |
if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
cmake ../ -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} \
-DSERIALBOX_TESTING=ON
fi
- make
- make install
- popd
# Build standalone fortran examples
- pushd $(pwd)
- |
if [[ "${FC_COMPILER}" != "" ]]; then
cd examples/fortran/perturbation
mkdir build && cd build
cmake ../ ${CMAKE_OPTIONS}
make
fi
- popd
#===---------------------------------------------------------------------------------------------===
# Testing
#===---------------------------------------------------------------------------------------------===
script:
- pushd $(pwd)
- cd build
# Run Python, C and C++ unittests
- ctest --output-on-failure --force-new-ctest-process
- popd
# Run stand-alone Fortran examples
- |
if [[ "${FC_COMPILER}" != "" ]]; then
cd examples/fortran/perturbation/build
bash run.sh
fi
notifications:
email:
recipients:
on_success: never
on_failure: always