forked from boostorg/hana
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
450 lines (379 loc) · 17.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
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
# Copyright Louis Dionne 2013-2017
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
language: c++
sudo: false
# Do not build branches of the form "pr/*". By prefixing pull requests coming
# from branches inside the repository with pr/, this avoids building both the
# branch push _and_ the pull request.
branches:
except: /pr\/.*/
env:
global:
# GitHub token for pushing the documentation, logging in with the
# Travis command line utility and so on. The token is stored in the
# ${GITHUB_TOKEN} environment variable.
- secure: "gB1wvjk565j3O4UBGjyN44Vd8IGqcNHzkbvRdFNHp7C+C+JG2vhAeLlpiK0Zd483gdTjq9gPjIDwpwyG2UJ+yjT1kMTJvD1YNWpGcK6vOHYl1yMOwv/LBdnKn+J7i/FnoeULGRCCI2Fpp1qILhxeZgLxTxsdQaYXlAkkR0i8cgQ="
# Workaround for https://github.com/travis-ci/travis-ci/issues/4681
matrix:
- TRAVIS_EMPTY_JOB_WORKAROUND=true
addons:
apt:
packages:
- valgrind
- g++-6
sources: &sources
- ubuntu-toolchain-r-test
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.0
- ${TRAVIS_BUILD_DIR}/deps/llvm-3.9.0
- ${TRAVIS_BUILD_DIR}/deps/boost-1.59.0
- ${TRAVIS_BUILD_DIR}/deps/boost-1.60.0
- ${TRAVIS_BUILD_DIR}/deps/boost-1.61.0
- ${TRAVIS_BUILD_DIR}/deps/boost-1.62.0
- ${TRAVIS_BUILD_DIR}/deps/boost-1.63.0
matrix:
exclude:
- env: TRAVIS_EMPTY_JOB_WORKAROUND=true
include:
##########################################################################
# Check for code formatting errors
##########################################################################
- os: osx
env: CHECK_FORMATTING=true
osx_image: xcode8
##########################################################################
# Build with the main configuration on all the supported compilers
#
# Note that we only use the memory checker on the main configuration to
# speed up Travis builds.
##########################################################################
# Clang 3.5
# TODO: Find out why this fails to compile the test suite.
# - env: UNIT_TESTS=true LLVM_VERSION=3.5.2 BOOST_VERSION=default ENABLE_MEMCHECK=true
# Clang 3.6
- os: linux
env: UNIT_TESTS=true LLVM_VERSION=3.6.2 BOOST_VERSION=default ENABLE_MEMCHECK=true
compiler: clang
# Clang 3.7
- os: linux
env: UNIT_TESTS=true LLVM_VERSION=3.7.1 BOOST_VERSION=default ENABLE_MEMCHECK=true
compiler: clang
# Clang 3.8
- os: linux
env: UNIT_TESTS=true LLVM_VERSION=3.8.0 BOOST_VERSION=default ENABLE_MEMCHECK=true
compiler: clang
# Clang 3.9
- os: linux
env: UNIT_TESTS=true LLVM_VERSION=3.9.0 BOOST_VERSION=default ENABLE_MEMCHECK=true
compiler: clang
# GCC 6
- os: linux
env: UNIT_TESTS=true COMPILER=g++-6 BOOST_VERSION=default ENABLE_MEMCHECK=true
compiler: gcc
# Xcode 6.4
- os: osx
env: UNIT_TESTS=true BOOST_VERSION=default
osx_image: xcode6.4
# Xcode 7.3
- os: osx
env: UNIT_TESTS=true BOOST_VERSION=default
osx_image: xcode7.3
# Xcode 8
- os: osx
env: UNIT_TESTS=true BOOST_VERSION=default
osx_image: xcode8
##########################################################################
# Build with variations in the configuration
##########################################################################
# Without concept checks
- os: linux
env: UNIT_TESTS=true LLVM_VERSION=default BOOST_VERSION=default CMAKE_OPTIONS="-DBOOST_HANA_ENABLE_CONCEPT_CHECKS=OFF"
compiler: clang
# With debug mode
- os: linux
env: UNIT_TESTS=true LLVM_VERSION=default BOOST_VERSION=default CMAKE_OPTIONS="-DBOOST_HANA_ENABLE_DEBUG_MODE=ON"
compiler: clang
# Without exceptions
- os: linux
env: UNIT_TESTS=true LLVM_VERSION=default BOOST_VERSION=default CMAKE_OPTIONS="-DBOOST_HANA_ENABLE_EXCEPTIONS=OFF"
compiler: clang
# Without exceptions on OS X
- os: osx
env: UNIT_TESTS=true BOOST_VERSION=default CMAKE_OPTIONS="-DBOOST_HANA_ENABLE_EXCEPTIONS=OFF"
osx_image: xcode8
# With Boost 1.59
- os: linux
env: UNIT_TESTS=true LLVM_VERSION=default BOOST_VERSION=1.59.0
compiler: clang
# With Boost 1.60
- os: linux
env: UNIT_TESTS=true LLVM_VERSION=default BOOST_VERSION=1.60.0
compiler: clang
# With Boost 1.61
- os: linux
env: UNIT_TESTS=true LLVM_VERSION=default BOOST_VERSION=1.61.0
compiler: clang
# With Boost 1.62
- os: linux
env: UNIT_TESTS=true LLVM_VERSION=default BOOST_VERSION=1.62.0
compiler: clang
# Without Boost (make sure we don't depend on it)
- os: linux
env: UNIT_TESTS=true LLVM_VERSION=default
compiler: clang
# With Boost.Build instead of CMake (on Linux)
- os: linux
env: UNIT_TESTS=true LLVM_VERSION=default BOOST_VERSION=default BOOST_BUILD=true
compiler: clang
# With Boost.Build instead of CMake (on OS X)
- os: osx
env: UNIT_TESTS=true BOOST_VERSION=default BOOST_BUILD=true
osx_image: xcode8
##########################################################################
# Generate the documentation
##########################################################################
- os: linux
env: DOCUMENTATION=true LLVM_VERSION=default BOOST_VERSION=default
compiler: clang
- os: linux
env: DOCUMENTATION=true LLVM_VERSION=default BOOST_VERSION=default BOOST_BUILD=true
compiler: clang
##########################################################################
# Benchmarks
##########################################################################
- os: linux
env: BENCHMARKS=true LLVM_VERSION=3.8.0 BOOST_VERSION=default CMAKE_OPTIONS="-DCMAKE_BUILD_TYPE=Release"
compiler: clang
##########################################################################
# Jobs that are allowed to fail
##########################################################################
# Clang trunk
# TODO: Find a way to download pre-built Clang trunk and enable this
# - os: linux
# env: UNIT_TESTS=true LLVM_VERSION=trunk BOOST_VERSION=default
# compiler: clang
# Boost trunk
- os: linux
env: UNIT_TESTS=true LLVM_VERSION=default BOOST_VERSION=trunk
compiler: clang
allow_failures:
# - env: UNIT_TESTS=true LLVM_VERSION=trunk BOOST_VERSION=default
- env: UNIT_TESTS=true LLVM_VERSION=default BOOST_VERSION=trunk
install:
############################################################################
# All the dependencies are installed in ${TRAVIS_BUILD_DIR}/deps/
############################################################################
- DEPS_DIR="${TRAVIS_BUILD_DIR}/deps"
- mkdir -p ${DEPS_DIR} && cd ${DEPS_DIR}
############################################################################
# Setup default versions and override compiler if needed
############################################################################
- if [[ "${LLVM_VERSION}" == "default" ]]; then LLVM_VERSION=3.9.0; fi
- if [[ "${BOOST_VERSION}" == "default" ]]; then BOOST_VERSION=1.63.0; fi
- if [[ "${COMPILER}" != "" ]]; then export CXX=${COMPILER}; fi
############################################################################
# Install Boost headers
############################################################################
- |
if [[ "${BOOST_VERSION}" != "" ]]; then
BOOST_DIR=${DEPS_DIR}/boost-${BOOST_VERSION}
if [[ -z "$(ls -A ${BOOST_DIR})" ]]; then
if [[ "${BOOST_VERSION}" == "trunk" ]]; then
BOOST_URL="http://github.com/boostorg/boost.git"
travis_retry git clone --depth 1 --recursive --quiet ${BOOST_URL} ${BOOST_DIR} || exit 1
(cd ${BOOST_DIR} && ./bootstrap.sh && ./b2 headers)
else
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
fi
# Make sure we don't conflict with the Hana shipped with Boost
rm -rf ${BOOST_ROOT}/include/boost/{hana,hana.hpp}
fi
CMAKE_OPTIONS+=" -DBOOST_ROOT=${BOOST_DIR}"
fi
############################################################################
# Install a recent CMake
############################################################################
- |
if [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then
CMAKE_URL="https://cmake.org/files/v3.7/cmake-3.7.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
brew upgrade cmake || brew install cmake
fi
- cmake --version
############################################################################
# Install Boost.Build
############################################################################
- |
if [[ "${BOOST_BUILD}" == "true" ]]; then
(cd ${BOOST_DIR}/tools/build && ./bootstrap.sh && ./b2 install --prefix=${DEPS_DIR}/b2)
export PATH=${DEPS_DIR}/b2/bin:${PATH}
fi
############################################################################
# Install Clang, libc++ and libc++abi
############################################################################
- |
if [[ "${LLVM_VERSION}" != "" ]]; then
LLVM_DIR=${DEPS_DIR}/llvm-${LLVM_VERSION}
if [[ -z "$(ls -A ${LLVM_DIR})" ]]; then
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 CXXFLAGS="-nostdinc++ -isystem ${LLVM_DIR}/install/include/c++/v1"
export LDFLAGS="-L ${LLVM_DIR}/install/lib -l c++ -l c++abi"
export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${LLVM_DIR}/install/lib"
export PATH="${LLVM_DIR}/clang/bin:${PATH}"
fi
- ${CXX} --version
############################################################################
# Install a recent Doxygen
############################################################################
- |
if [[ "${DOCUMENTATION}" == "true" ]]; then
DOXYGEN_URL="http://ftp.stack.nl/pub/users/dimitri/doxygen-1.8.11.linux.bin.tar.gz"
mkdir doxygen && travis_retry wget --quiet -O - ${DOXYGEN_URL} | tar --strip-components=1 -xz -C doxygen
export PATH=${DEPS_DIR}/doxygen/bin:${PATH}
doxygen --version
fi
############################################################################
# Install and use a more recent Ruby and install the gems for the benchmarks
############################################################################
- rvm use 2.1 --install --binary --fuzzy
- gem install ruby-progressbar tilt
############################################################################
# Install tools to check for code formatting errors (run on OS X only)
############################################################################
- |
if [[ "${CHECK_FORMATTING}" == "true" ]]; then
brew upgrade pcre || brew install pcre || exit 1
brew upgrade vera++ || brew install vera++ || exit 1
fi
before_script:
############################################################################
# Set the git identity (for pushing the documentation and the benchmarks)
############################################################################
- git config --global user.name "Travis bot"
- git config --global user.email "<>"
############################################################################
# Go back to the root of the project and setup the build directory
############################################################################
- cd ${TRAVIS_BUILD_DIR}
- (mkdir build && cd build && cmake .. ${CMAKE_OPTIONS})
script:
############################################################################
# Check for common formatting errors.
############################################################################
- |
if [[ "${CHECK_FORMATTING}" == "true" ]]; then
# Find non-ASCII characters in headers
hpps=$(find include doc -name \*\.hpp)
cpps=$(find test example -name \*\.cpp)
pcregrep --color='auto' -n "[\x80-\xFF]" ${hpps} ${cpps}
if [[ $? -ne 1 ]]; then exit 1; fi
# F001: Source files should not use the '\r' (CR) character
# L001: No trailing whitespace at the end of lines
# L002: Don't use tab characters
find include -name \*\.hpp | vera++ --rule F001 --rule L001 --rule L002 --error
fi
############################################################################
# Only push the documentation when we're on master, otherwise just make sure
# it builds properly.
############################################################################
- |
if [[ "${DOCUMENTATION}" == "true" && "${BOOST_BUILD}" != "true" ]]; then
(cd build && ! make doc 2>&1 | grep -E "warning|error") || exit 1
if [[ "${TRAVIS_PULL_REQUEST}" == "false" && "${TRAVIS_BRANCH}" == "master" ]]; then
# Suppress output to avoid leaking the token when the command fails
git clone https://ldionne:${GITHUB_TOKEN}@github.com/boostorg/hana --depth 1 --branch=gh-pages doc/html &>/dev/null
rm -rf doc/html/{search,*.png,*.css,*.js,*.html}
cp -R build/doc/html/* doc/html/
pushd doc/html
git add --all .
git commit --allow-empty -m "Update documentation to ${TRAVIS_COMMIT:0:7}"
# Suppress output to avoid leaking the token
travis_retry git push origin gh-pages &>/dev/null
popd
fi
fi
- |
if [[ "${DOCUMENTATION}" == "true" && "${BOOST_BUILD}" == "true" ]]; then
touch Jamroot
(cd doc && b2)
if [[ ! -d doc/html ]]; then exit 1; fi
fi
############################################################################
# We only run the full benchmarks on `master` when we're not in a pull
# request, because otherwise it takes too much Travis resources. Otherwise,
# we only run partial benchmarks to make sure they compile and run properly.
#
# Note: The benchmarks associated to a version of the documentation are
# stored in `doc/html/benchmarks/`.
############################################################################
- |
if [[ "${BENCHMARKS}" == "true" ]]; then
if [[ "${TRAVIS_PULL_REQUEST}" == "false" && "${TRAVIS_BRANCH}" == "master" ]]; then
(cd build && make benchmarks) || exit 1
compiler_slug=$(cd build && make travis_compiler_slug | grep 'travis_compiler_slug:' | cut -d ' ' -f 2)
config_slug=$(cd build && make travis_config_slug | grep 'travis_config_slug:' | cut -d ' ' -f 2)
# Suppress output to avoid leaking the token when the command fails
git clone https://ldionne:${GITHUB_TOKEN}@github.com/boostorg/hana --depth 1 --branch=gh-pages doc/html &>/dev/null
rm -rf doc/html/benchmarks/${config_slug}/${compiler_slug}/
mkdir -p doc/html/benchmarks/${config_slug}/${compiler_slug}/
for benchmark in $(ls build/benchmark/*.json | grep -v ".erb"); do
cp ${benchmark} doc/html/benchmarks/${config_slug}/${compiler_slug}/
done
pushd doc/html
git add --all .
git commit --allow-empty -m "Update benchmarks to ${TRAVIS_COMMIT:0:7} for build type '${config_slug}' and compiler '${compiler_slug}'"
# Suppress output to avoid leaking the token
travis_retry git push origin gh-pages &>/dev/null
popd
else
export BOOST_HANA_JUST_CHECK_BENCHMARKS=true
(cd build && make benchmarks -j2)
fi
fi
############################################################################
# Build and run the unit tests and examples.
############################################################################
- |
if [[ "${UNIT_TESTS}" == "true" && "${BOOST_BUILD}" != "true" ]]; then
(cd build && make tests examples -j2 -k) &&
if [[ "${ENABLE_MEMCHECK}" == "true" ]]; then
(cd build && ctest --output-on-failure -j2 -D ExperimentalMemCheck)
else
(cd build && ctest --output-on-failure -j2)
fi
fi
- |
if [[ "${UNIT_TESTS}" == "true" && "${BOOST_BUILD}" == "true" ]]; then
touch Jamroot
echo "using clang : : ${CXX} ;" > project-config.jam
if [[ "${LDFLAGS}" == "" ]]; then
(cd test && b2 toolset=clang cxxflags="-std=c++1y ${CXXFLAGS}" include="${BOOST_DIR}")
else
(cd test && b2 toolset=clang cxxflags="-std=c++1y ${CXXFLAGS}" include="${BOOST_DIR}" linkflags="${LDFLAGS}")
fi
fi
notifications:
webhooks:
urls: https://webhooks.gitter.im/e/ce1e3a2036d94b4a644f
on_success: change
on_failure: always