]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | # Copyright Louis Dionne 2013-2016 |
2 | # Distributed under the Boost Software License, Version 1.0. | |
3 | # (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) | |
4 | ||
5 | language: c++ | |
6 | sudo: false | |
7 | ||
8 | # Do not build branches of the form "pr/*". By prefixing pull requests coming | |
9 | # from branches inside the repository with pr/, this avoids building both the | |
10 | # branch push _and_ the pull request. | |
11 | branches: | |
12 | except: /pr\/.*/ | |
13 | ||
14 | env: | |
15 | global: | |
16 | # GitHub token for pushing the documentation, logging in with the | |
17 | # Travis command line utility and so on. The token is stored in the | |
18 | # ${GITHUB_TOKEN} environment variable. | |
19 | - secure: "gikHKTxWGN9FnJ9m+F53Y5j7jWGAOKlL2ylcFM2o0KoXOkoNAK9bJpilNppRwWhgwpC3yTJDN0k7xh9I6Ec8L0G46Q2QZdtJ/NFvWbafpzQcrAg6+872yKlP8h3GHexwEDdAdxCv8g2HeavFrDcqynssI8IoIHyZmsR6Dwym+eo=" | |
20 | ||
21 | # Workaround for https://github.com/travis-ci/travis-ci/issues/4681 | |
22 | matrix: | |
23 | - TRAVIS_EMPTY_JOB_WORKAROUND=true | |
24 | ||
25 | ||
26 | addons: | |
27 | apt: | |
28 | packages: | |
29 | - valgrind | |
30 | - g++-6 | |
31 | sources: &sources | |
32 | - ubuntu-toolchain-r-test | |
33 | ||
34 | ||
35 | cache: | |
36 | directories: | |
37 | - ${TRAVIS_BUILD_DIR}/deps/llvm-3.6.2 | |
38 | - ${TRAVIS_BUILD_DIR}/deps/llvm-3.7.1 | |
39 | - ${TRAVIS_BUILD_DIR}/deps/llvm-3.8.0 | |
40 | - ${TRAVIS_BUILD_DIR}/deps/llvm-3.9.0 | |
41 | - ${TRAVIS_BUILD_DIR}/deps/boost-1.59.0 | |
42 | - ${TRAVIS_BUILD_DIR}/deps/boost-1.60.0 | |
43 | - ${TRAVIS_BUILD_DIR}/deps/boost-1.61.0 | |
44 | - ${TRAVIS_BUILD_DIR}/deps/boost-1.62.0 | |
45 | ||
46 | ||
47 | matrix: | |
48 | exclude: | |
49 | - env: TRAVIS_EMPTY_JOB_WORKAROUND=true | |
50 | ||
51 | include: | |
52 | ########################################################################## | |
53 | # Check for code formatting errors | |
54 | ########################################################################## | |
55 | - os: osx | |
56 | env: CHECK_FORMATTING=true | |
57 | osx_image: xcode8 | |
58 | ||
59 | ########################################################################## | |
60 | # Build with the main configuration on all the supported compilers | |
61 | # | |
62 | # Note that we only use the memory checker on the main configuration to | |
63 | # speed up Travis builds. | |
64 | ########################################################################## | |
65 | # Clang 3.5 | |
66 | # TODO: Find out why this fails to compile the test suite. | |
67 | # - env: UNIT_TESTS=true LLVM_VERSION=3.5.2 BOOST_VERSION=default CMAKE_OPTIONS="-DBOOST_HANA_ENABLE_MEMCHECK=ON" | |
68 | ||
69 | # Clang 3.6 | |
70 | - os: linux | |
71 | env: UNIT_TESTS=true LLVM_VERSION=3.6.2 BOOST_VERSION=default CMAKE_OPTIONS="-DBOOST_HANA_ENABLE_MEMCHECK=ON" | |
72 | compiler: clang | |
73 | ||
74 | # Clang 3.7 | |
75 | - os: linux | |
76 | env: UNIT_TESTS=true LLVM_VERSION=3.7.1 BOOST_VERSION=default CMAKE_OPTIONS="-DBOOST_HANA_ENABLE_MEMCHECK=ON" | |
77 | compiler: clang | |
78 | ||
79 | # Clang 3.8 | |
80 | - os: linux | |
81 | env: UNIT_TESTS=true LLVM_VERSION=3.8.0 BOOST_VERSION=default CMAKE_OPTIONS="-DBOOST_HANA_ENABLE_MEMCHECK=ON" | |
82 | compiler: clang | |
83 | ||
84 | # Clang 3.9 | |
85 | - os: linux | |
86 | env: UNIT_TESTS=true LLVM_VERSION=3.9.0 BOOST_VERSION=default CMAKE_OPTIONS="-DBOOST_HANA_ENABLE_MEMCHECK=ON" | |
87 | compiler: clang | |
88 | ||
89 | # GCC 6 | |
90 | - os: linux | |
91 | env: UNIT_TESTS=true COMPILER=g++-6 BOOST_VERSION=default CMAKE_OPTIONS="-DBOOST_HANA_ENABLE_MEMCHECK=ON" | |
92 | compiler: gcc | |
93 | ||
94 | # Xcode 6.4 | |
95 | - os: osx | |
96 | env: UNIT_TESTS=true BOOST_VERSION=default | |
97 | osx_image: xcode6.4 | |
98 | ||
99 | # Xcode 7.3 | |
100 | - os: osx | |
101 | env: UNIT_TESTS=true BOOST_VERSION=default | |
102 | osx_image: xcode7.3 | |
103 | ||
104 | # Xcode 8 | |
105 | - os: osx | |
106 | env: UNIT_TESTS=true BOOST_VERSION=default | |
107 | osx_image: xcode8 | |
108 | ||
109 | ########################################################################## | |
110 | # Build with variations in the configuration | |
111 | ########################################################################## | |
112 | # Without concept checks | |
113 | - os: linux | |
114 | env: UNIT_TESTS=true LLVM_VERSION=default BOOST_VERSION=default CMAKE_OPTIONS="-DBOOST_HANA_ENABLE_CONCEPT_CHECKS=OFF" | |
115 | compiler: clang | |
116 | ||
117 | # With debug mode | |
118 | - os: linux | |
119 | env: UNIT_TESTS=true LLVM_VERSION=default BOOST_VERSION=default CMAKE_OPTIONS="-DBOOST_HANA_ENABLE_DEBUG_MODE=ON" | |
120 | compiler: clang | |
121 | ||
122 | # Without exceptions | |
123 | - os: linux | |
124 | env: UNIT_TESTS=true LLVM_VERSION=default BOOST_VERSION=default CMAKE_OPTIONS="-DBOOST_HANA_ENABLE_EXCEPTIONS=OFF" | |
125 | compiler: clang | |
126 | ||
127 | # Without exceptions on OS X | |
128 | - os: osx | |
129 | env: UNIT_TESTS=true BOOST_VERSION=default CMAKE_OPTIONS="-DBOOST_HANA_ENABLE_EXCEPTIONS=OFF" | |
130 | osx_image: xcode8 | |
131 | ||
132 | # With Boost 1.59 | |
133 | - os: linux | |
134 | env: UNIT_TESTS=true LLVM_VERSION=default BOOST_VERSION=1.59.0 | |
135 | compiler: clang | |
136 | ||
137 | # With Boost 1.60 | |
138 | - os: linux | |
139 | env: UNIT_TESTS=true LLVM_VERSION=default BOOST_VERSION=1.60.0 | |
140 | compiler: clang | |
141 | ||
142 | # With Boost 1.61 | |
143 | - os: linux | |
144 | env: UNIT_TESTS=true LLVM_VERSION=default BOOST_VERSION=1.61.0 | |
145 | compiler: clang | |
146 | ||
147 | # Without Boost (make sure we don't depend on it) | |
148 | - os: linux | |
149 | env: UNIT_TESTS=true LLVM_VERSION=default | |
150 | compiler: clang | |
151 | ||
152 | # With Boost.Build instead of CMake (on Linux) | |
153 | - os: linux | |
154 | env: UNIT_TESTS=true LLVM_VERSION=default BOOST_VERSION=default BOOST_BUILD=true | |
155 | compiler: clang | |
156 | ||
157 | # With Boost.Build instead of CMake (on OS X) | |
158 | - os: osx | |
159 | env: UNIT_TESTS=true BOOST_VERSION=default BOOST_BUILD=true | |
160 | osx_image: xcode8 | |
161 | ||
162 | ||
163 | ########################################################################## | |
164 | # Generate the documentation | |
165 | ########################################################################## | |
166 | - os: linux | |
167 | env: DOCUMENTATION=true LLVM_VERSION=default BOOST_VERSION=default | |
168 | compiler: clang | |
169 | - os: linux | |
170 | env: DOCUMENTATION=true LLVM_VERSION=default BOOST_VERSION=default BOOST_BUILD=true | |
171 | compiler: clang | |
172 | ||
173 | ||
174 | ########################################################################## | |
175 | # Benchmarks | |
176 | ########################################################################## | |
177 | - os: linux | |
178 | env: BENCHMARKS=true LLVM_VERSION=3.8.0 BOOST_VERSION=default CMAKE_OPTIONS="-DCMAKE_BUILD_TYPE=Release" | |
179 | compiler: clang | |
180 | ||
181 | ||
182 | ########################################################################## | |
183 | # Jobs that are allowed to fail | |
184 | ########################################################################## | |
185 | # Clang trunk | |
186 | # TODO: Find a way to download pre-built Clang trunk and enable this | |
187 | # - os: linux | |
188 | # env: UNIT_TESTS=true LLVM_VERSION=trunk BOOST_VERSION=default | |
189 | # compiler: clang | |
190 | ||
191 | # Boost trunk | |
192 | - os: linux | |
193 | env: UNIT_TESTS=true LLVM_VERSION=default BOOST_VERSION=trunk | |
194 | compiler: clang | |
195 | ||
196 | ||
197 | allow_failures: | |
198 | # - env: UNIT_TESTS=true LLVM_VERSION=trunk BOOST_VERSION=default | |
199 | - env: UNIT_TESTS=true LLVM_VERSION=default BOOST_VERSION=trunk | |
200 | ||
201 | ||
202 | install: | |
203 | ############################################################################ | |
204 | # All the dependencies are installed in ${TRAVIS_BUILD_DIR}/deps/ | |
205 | ############################################################################ | |
206 | - DEPS_DIR="${TRAVIS_BUILD_DIR}/deps" | |
207 | - mkdir -p ${DEPS_DIR} && cd ${DEPS_DIR} | |
208 | ||
209 | ############################################################################ | |
210 | # Setup default versions and override compiler if needed | |
211 | ############################################################################ | |
212 | - if [[ "${LLVM_VERSION}" == "default" ]]; then LLVM_VERSION=3.9.0; fi | |
213 | - if [[ "${BOOST_VERSION}" == "default" ]]; then BOOST_VERSION=1.62.0; fi | |
214 | ||
215 | - if [[ "${COMPILER}" != "" ]]; then export CXX=${COMPILER}; fi | |
216 | ||
217 | ############################################################################ | |
218 | # Install Boost headers | |
219 | ############################################################################ | |
220 | - | | |
221 | if [[ "${BOOST_VERSION}" != "" ]]; then | |
222 | BOOST_DIR=${DEPS_DIR}/boost-${BOOST_VERSION} | |
223 | if [[ -z "$(ls -A ${BOOST_DIR})" ]]; then | |
224 | if [[ "${BOOST_VERSION}" == "trunk" ]]; then | |
225 | BOOST_URL="http://github.com/boostorg/boost.git" | |
226 | travis_retry git clone --depth 1 --recursive --quiet ${BOOST_URL} ${BOOST_DIR} || exit 1 | |
227 | (cd ${BOOST_DIR} && ./bootstrap.sh && ./b2 headers) | |
228 | else | |
229 | BOOST_URL="http://sourceforge.net/projects/boost/files/boost/${BOOST_VERSION}/boost_${BOOST_VERSION//\./_}.tar.gz" | |
230 | mkdir -p ${BOOST_DIR} | |
231 | { travis_retry wget --quiet -O - ${BOOST_URL} | tar --strip-components=1 -xz -C ${BOOST_DIR}; } || exit 1 | |
232 | fi | |
233 | # Make sure we don't conflict with the Hana shipped with Boost | |
234 | rm -rf ${BOOST_ROOT}/include/boost/{hana,hana.hpp} | |
235 | fi | |
236 | CMAKE_OPTIONS+=" -DBOOST_ROOT=${BOOST_DIR}" | |
237 | fi | |
238 | ||
239 | ############################################################################ | |
240 | # Install a recent CMake (unless already installed on OS X) | |
241 | ############################################################################ | |
242 | - | | |
243 | if [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then | |
244 | CMAKE_URL="http://www.cmake.org/files/v3.5/cmake-3.5.2-Linux-x86_64.tar.gz" | |
245 | mkdir cmake && travis_retry wget --no-check-certificate --quiet -O - ${CMAKE_URL} | tar --strip-components=1 -xz -C cmake | |
246 | export PATH=${DEPS_DIR}/cmake/bin:${PATH} | |
247 | else | |
248 | if ! brew ls --version cmake &>/dev/null; then brew install cmake; fi | |
249 | fi | |
250 | ||
251 | ############################################################################ | |
252 | # Install Boost.Build | |
253 | ############################################################################ | |
254 | - | | |
255 | if [[ "${BOOST_BUILD}" == "true" ]]; then | |
256 | (cd ${BOOST_DIR}/tools/build && ./bootstrap.sh && ./b2 install --prefix=${DEPS_DIR}/b2) | |
257 | export PATH=${DEPS_DIR}/b2/bin:${PATH} | |
258 | fi | |
259 | ||
260 | ############################################################################ | |
261 | # Install Clang, libc++ and libc++abi | |
262 | ############################################################################ | |
263 | - | | |
264 | if [[ "${LLVM_VERSION}" != "" ]]; then | |
265 | LLVM_DIR=${DEPS_DIR}/llvm-${LLVM_VERSION} | |
266 | if [[ -z "$(ls -A ${LLVM_DIR})" ]]; then | |
267 | LLVM_URL="http://llvm.org/releases/${LLVM_VERSION}/llvm-${LLVM_VERSION}.src.tar.xz" | |
268 | LIBCXX_URL="http://llvm.org/releases/${LLVM_VERSION}/libcxx-${LLVM_VERSION}.src.tar.xz" | |
269 | LIBCXXABI_URL="http://llvm.org/releases/${LLVM_VERSION}/libcxxabi-${LLVM_VERSION}.src.tar.xz" | |
270 | CLANG_URL="http://llvm.org/releases/${LLVM_VERSION}/clang+llvm-${LLVM_VERSION}-x86_64-linux-gnu-ubuntu-14.04.tar.xz" | |
271 | ||
272 | mkdir -p ${LLVM_DIR} ${LLVM_DIR}/build ${LLVM_DIR}/projects/libcxx ${LLVM_DIR}/projects/libcxxabi ${LLVM_DIR}/clang | |
273 | travis_retry wget --quiet -O - ${LLVM_URL} | tar --strip-components=1 -xJ -C ${LLVM_DIR} | |
274 | travis_retry wget --quiet -O - ${LIBCXX_URL} | tar --strip-components=1 -xJ -C ${LLVM_DIR}/projects/libcxx | |
275 | travis_retry wget --quiet -O - ${LIBCXXABI_URL} | tar --strip-components=1 -xJ -C ${LLVM_DIR}/projects/libcxxabi | |
276 | travis_retry wget --quiet -O - ${CLANG_URL} | tar --strip-components=1 -xJ -C ${LLVM_DIR}/clang | |
277 | (cd ${LLVM_DIR}/build && cmake .. -DCMAKE_INSTALL_PREFIX=${LLVM_DIR}/install -DCMAKE_CXX_COMPILER=clang++) | |
278 | (cd ${LLVM_DIR}/build/projects/libcxx && make install -j2) | |
279 | (cd ${LLVM_DIR}/build/projects/libcxxabi && make install -j2) | |
280 | fi | |
281 | ||
282 | export CXXFLAGS="-nostdinc++ -isystem ${LLVM_DIR}/install/include/c++/v1" | |
283 | export LDFLAGS="-L ${LLVM_DIR}/install/lib -l c++ -l c++abi" | |
284 | export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${LLVM_DIR}/install/lib" | |
285 | export PATH="${LLVM_DIR}/clang/bin:${PATH}" | |
286 | fi | |
287 | ||
288 | ############################################################################ | |
289 | # Install a recent Doxygen | |
290 | ############################################################################ | |
291 | - | | |
292 | if [[ "${DOCUMENTATION}" == "true" ]]; then | |
293 | DOXYGEN_URL="http://ftp.stack.nl/pub/users/dimitri/doxygen-1.8.11.linux.bin.tar.gz" | |
294 | mkdir doxygen && travis_retry wget --quiet -O - ${DOXYGEN_URL} | tar --strip-components=1 -xz -C doxygen | |
295 | export PATH=${DEPS_DIR}/doxygen/bin:${PATH} | |
296 | fi | |
297 | ||
298 | ############################################################################ | |
299 | # Install and use a more recent Ruby and install the gems for the benchmarks | |
300 | ############################################################################ | |
301 | - rvm use 2.1 --install --binary --fuzzy | |
302 | - gem install ruby-progressbar tilt | |
303 | ||
304 | ############################################################################ | |
305 | # Install tools to check for code formatting errors (run on OS X only) | |
306 | ############################################################################ | |
307 | - if [[ "${CHECK_FORMATTING}" == "true" ]]; then brew install pcre vera++; fi | |
308 | ||
309 | ||
310 | before_script: | |
311 | ############################################################################ | |
312 | # Set the git identity (for pushing the documentation and the benchmarks) | |
313 | ############################################################################ | |
314 | - git config --global user.name "Travis bot" | |
315 | ||
316 | ############################################################################ | |
317 | # Go back to the root of the project and setup the build directory | |
318 | ############################################################################ | |
319 | - cd ${TRAVIS_BUILD_DIR} | |
320 | - (mkdir build && cd build && cmake .. -DBOOST_HANA_ENABLE_WERROR=ON ${CMAKE_OPTIONS}) | |
321 | ||
322 | ||
323 | script: | |
324 | ############################################################################ | |
325 | # Check for common formatting errors. | |
326 | ############################################################################ | |
327 | - | | |
328 | if [[ "${CHECK_FORMATTING}" == "true" ]]; then | |
329 | # Find non-ASCII characters in headers | |
330 | hpps=$(find include doc -name \*\.hpp) | |
331 | cpps=$(find test example experimental -name \*\.cpp) | |
332 | pcregrep --color='auto' -n "[\x80-\xFF]" ${hpps} ${cpps} | |
333 | if [[ $? -ne 1 ]]; then exit 1; fi | |
334 | ||
335 | # F001: Source files should not use the '\r' (CR) character | |
336 | # L001: No trailing whitespace at the end of lines | |
337 | # L002: Don't use tab characters | |
338 | find include -name \*\.hpp | vera++ --rule F001 --rule L001 --rule L002 --error | |
339 | fi | |
340 | ||
341 | ############################################################################ | |
342 | # Only push the documentation when we're on master, otherwise just make sure | |
343 | # it builds properly. | |
344 | ############################################################################ | |
345 | - | | |
346 | if [[ "${DOCUMENTATION}" == "true" && "${BOOST_BUILD}" != "true" ]]; then | |
347 | (cd build && ! make doc 2>&1 | grep -E "warning|error") || exit 1 | |
348 | ||
349 | if [[ "${TRAVIS_PULL_REQUEST}" == "false" && "${TRAVIS_BRANCH}" == "master" ]]; then | |
350 | # Suppress output to avoid leaking the token when the command fails | |
351 | git clone https://ldionne:${GITHUB_TOKEN}@github.com/boostorg/hana --depth 1 --branch=gh-pages doc/html &>/dev/null | |
352 | ||
353 | rm -rf doc/html/{search,*.png,*.css,*.js,*.html} | |
354 | cp -R build/doc/html/* doc/html/ | |
355 | ||
356 | pushd doc/html | |
357 | git add --all . | |
358 | git commit --allow-empty -m "Update to ${TRAVIS_COMMIT:0:7}" | |
359 | # Suppress output to avoid leaking the token | |
360 | travis_retry git push origin gh-pages &>/dev/null | |
361 | popd | |
362 | fi | |
363 | fi | |
364 | ||
365 | - | | |
366 | if [[ "${DOCUMENTATION}" == "true" && "${BOOST_BUILD}" == "true" ]]; then | |
367 | touch Jamroot | |
368 | (cd doc && b2) | |
369 | fi | |
370 | ||
371 | ############################################################################ | |
372 | # We only run the full benchmarks on `master` when we're not in a pull | |
373 | # request, because otherwise it takes too much Travis resources. Otherwise, | |
374 | # we only run partial benchmarks to make sure they compile and run properly. | |
375 | # | |
376 | # Note: The benchmarks associated to a version of the documentation are | |
377 | # stored in `doc/html/benchmarks/`. | |
378 | ############################################################################ | |
379 | - | | |
380 | if [[ "${BENCHMARKS}" == "true" ]]; then | |
381 | if [[ "${TRAVIS_PULL_REQUEST}" == "false" && "${TRAVIS_BRANCH}" == "master" ]]; then | |
382 | (cd build && make benchmarks) || exit 1 | |
383 | compiler_slug=$(cd build && make travis_compiler_slug | grep 'travis_compiler_slug:' | cut -d ' ' -f 2) | |
384 | config_slug=$(cd build && make travis_config_slug | grep 'travis_config_slug:' | cut -d ' ' -f 2) | |
385 | ||
386 | # Suppress output to avoid leaking the token when the command fails | |
387 | git clone https://ldionne:${GITHUB_TOKEN}@github.com/boostorg/hana --depth 1 --branch=gh-pages doc/html &>/dev/null | |
388 | rm -rf doc/html/benchmarks/${config_slug}/${compiler_slug}/ | |
389 | mkdir -p doc/html/benchmarks/${config_slug}/${compiler_slug}/ | |
390 | for benchmark in $(ls build/benchmark/*.json | grep -v ".erb"); do | |
391 | cp ${benchmark} doc/html/benchmarks/${config_slug}/${compiler_slug}/ | |
392 | done | |
393 | ||
394 | pushd doc/html | |
395 | git add --all . | |
396 | git commit --allow-empty -m "Update benchmarks to ${TRAVIS_COMMIT:0:7} for build type '${config_slug}' and compiler '${compiler_slug}'" | |
397 | # Suppress output to avoid leaking the token | |
398 | travis_retry git push origin gh-pages &>/dev/null | |
399 | popd | |
400 | else | |
401 | export BOOST_HANA_JUST_CHECK_BENCHMARKS=true | |
402 | (cd build && make benchmarks -j2) | |
403 | fi | |
404 | fi | |
405 | ||
406 | ############################################################################ | |
407 | # Build and run the unit tests and examples. | |
408 | ############################################################################ | |
409 | - | | |
410 | if [[ "${UNIT_TESTS}" == "true" && "${BOOST_BUILD}" != "true" ]]; then | |
411 | export CTEST_PARALLEL_LEVEL=2 # Run unit tests on two cores | |
412 | (cd build && make check -j2 -k) | |
413 | fi | |
414 | ||
415 | - | | |
416 | if [[ "${UNIT_TESTS}" == "true" && "${BOOST_BUILD}" == "true" ]]; then | |
417 | touch Jamroot | |
418 | echo "using clang : : ${CXX} ;" > project-config.jam | |
419 | if [[ "${LDFLAGS}" == "" ]]; then | |
420 | (cd test && b2 toolset=clang cxxflags="-std=c++1y ${CXXFLAGS}" include="${BOOST_DIR}") | |
421 | else | |
422 | (cd test && b2 toolset=clang cxxflags="-std=c++1y ${CXXFLAGS}" include="${BOOST_DIR}" linkflags="${LDFLAGS}") | |
423 | fi | |
424 | fi | |
425 | ||
426 | ||
427 | notifications: | |
428 | webhooks: | |
429 | urls: https://webhooks.gitter.im/e/ce1e3a2036d94b4a644f | |
430 | on_success: change | |
431 | on_failure: always |