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)
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.
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="
21 # Workaround for https://github.com/travis-ci/travis-ci/issues/4681
23 - TRAVIS_EMPTY_JOB_WORKAROUND=true
32 - ubuntu-toolchain-r-test
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
49 - env: TRAVIS_EMPTY_JOB_WORKAROUND=true
52 ##########################################################################
53 # Check for code formatting errors
54 ##########################################################################
56 env: CHECK_FORMATTING=true
59 ##########################################################################
60 # Build with the main configuration on all the supported compilers
62 # Note that we only use the memory checker on the main configuration to
63 # speed up Travis builds.
64 ##########################################################################
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"
71 env: UNIT_TESTS=true LLVM_VERSION=3.6.2 BOOST_VERSION=default CMAKE_OPTIONS="-DBOOST_HANA_ENABLE_MEMCHECK=ON"
76 env: UNIT_TESTS=true LLVM_VERSION=3.7.1 BOOST_VERSION=default CMAKE_OPTIONS="-DBOOST_HANA_ENABLE_MEMCHECK=ON"
81 env: UNIT_TESTS=true LLVM_VERSION=3.8.0 BOOST_VERSION=default CMAKE_OPTIONS="-DBOOST_HANA_ENABLE_MEMCHECK=ON"
86 env: UNIT_TESTS=true LLVM_VERSION=3.9.0 BOOST_VERSION=default CMAKE_OPTIONS="-DBOOST_HANA_ENABLE_MEMCHECK=ON"
91 env: UNIT_TESTS=true COMPILER=g++-6 BOOST_VERSION=default CMAKE_OPTIONS="-DBOOST_HANA_ENABLE_MEMCHECK=ON"
96 env: UNIT_TESTS=true BOOST_VERSION=default
101 env: UNIT_TESTS=true BOOST_VERSION=default
106 env: UNIT_TESTS=true BOOST_VERSION=default
109 ##########################################################################
110 # Build with variations in the configuration
111 ##########################################################################
112 # Without concept checks
114 env: UNIT_TESTS=true LLVM_VERSION=default BOOST_VERSION=default CMAKE_OPTIONS="-DBOOST_HANA_ENABLE_CONCEPT_CHECKS=OFF"
119 env: UNIT_TESTS=true LLVM_VERSION=default BOOST_VERSION=default CMAKE_OPTIONS="-DBOOST_HANA_ENABLE_DEBUG_MODE=ON"
124 env: UNIT_TESTS=true LLVM_VERSION=default BOOST_VERSION=default CMAKE_OPTIONS="-DBOOST_HANA_ENABLE_EXCEPTIONS=OFF"
127 # Without exceptions on OS X
129 env: UNIT_TESTS=true BOOST_VERSION=default CMAKE_OPTIONS="-DBOOST_HANA_ENABLE_EXCEPTIONS=OFF"
134 env: UNIT_TESTS=true LLVM_VERSION=default BOOST_VERSION=1.59.0
139 env: UNIT_TESTS=true LLVM_VERSION=default BOOST_VERSION=1.60.0
144 env: UNIT_TESTS=true LLVM_VERSION=default BOOST_VERSION=1.61.0
147 # Without Boost (make sure we don't depend on it)
149 env: UNIT_TESTS=true LLVM_VERSION=default
152 # With Boost.Build instead of CMake (on Linux)
154 env: UNIT_TESTS=true LLVM_VERSION=default BOOST_VERSION=default BOOST_BUILD=true
157 # With Boost.Build instead of CMake (on OS X)
159 env: UNIT_TESTS=true BOOST_VERSION=default BOOST_BUILD=true
163 ##########################################################################
164 # Generate the documentation
165 ##########################################################################
167 env: DOCUMENTATION=true LLVM_VERSION=default BOOST_VERSION=default
170 env: DOCUMENTATION=true LLVM_VERSION=default BOOST_VERSION=default BOOST_BUILD=true
174 ##########################################################################
176 ##########################################################################
178 env: BENCHMARKS=true LLVM_VERSION=3.8.0 BOOST_VERSION=default CMAKE_OPTIONS="-DCMAKE_BUILD_TYPE=Release"
182 ##########################################################################
183 # Jobs that are allowed to fail
184 ##########################################################################
186 # TODO: Find a way to download pre-built Clang trunk and enable this
188 # env: UNIT_TESTS=true LLVM_VERSION=trunk BOOST_VERSION=default
193 env: UNIT_TESTS=true LLVM_VERSION=default BOOST_VERSION=trunk
198 # - env: UNIT_TESTS=true LLVM_VERSION=trunk BOOST_VERSION=default
199 - env: UNIT_TESTS=true LLVM_VERSION=default BOOST_VERSION=trunk
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}
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
215 - if [[ "${COMPILER}" != "" ]]; then export CXX=${COMPILER}; fi
217 ############################################################################
218 # Install Boost headers
219 ############################################################################
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)
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
233 # Make sure we don't conflict with the Hana shipped with Boost
234 rm -rf ${BOOST_ROOT}/include/boost/{hana,hana.hpp}
236 CMAKE_OPTIONS+=" -DBOOST_ROOT=${BOOST_DIR}"
239 ############################################################################
240 # Install a recent CMake (unless already installed on OS X)
241 ############################################################################
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}
248 if ! brew ls --version cmake &>/dev/null; then brew install cmake; fi
251 ############################################################################
252 # Install Boost.Build
253 ############################################################################
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}
260 ############################################################################
261 # Install Clang, libc++ and libc++abi
262 ############################################################################
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"
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)
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}"
288 ############################################################################
289 # Install a recent Doxygen
290 ############################################################################
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}
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
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
311 ############################################################################
312 # Set the git identity (for pushing the documentation and the benchmarks)
313 ############################################################################
314 - git config --global user.name "Travis bot"
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})
324 ############################################################################
325 # Check for common formatting errors.
326 ############################################################################
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
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
341 ############################################################################
342 # Only push the documentation when we're on master, otherwise just make sure
343 # it builds properly.
344 ############################################################################
346 if [[ "${DOCUMENTATION}" == "true" && "${BOOST_BUILD}" != "true" ]]; then
347 (cd build && ! make doc 2>&1 | grep -E "warning|error") || exit 1
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
353 rm -rf doc/html/{search,*.png,*.css,*.js,*.html}
354 cp -R build/doc/html/* doc/html/
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
366 if [[ "${DOCUMENTATION}" == "true" && "${BOOST_BUILD}" == "true" ]]; then
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.
376 # Note: The benchmarks associated to a version of the documentation are
377 # stored in `doc/html/benchmarks/`.
378 ############################################################################
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)
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}/
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
401 export BOOST_HANA_JUST_CHECK_BENCHMARKS=true
402 (cd build && make benchmarks -j2)
406 ############################################################################
407 # Build and run the unit tests and examples.
408 ############################################################################
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)
416 if [[ "${UNIT_TESTS}" == "true" && "${BOOST_BUILD}" == "true" ]]; then
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}")
422 (cd test && b2 toolset=clang cxxflags="-std=c++1y ${CXXFLAGS}" include="${BOOST_DIR}" linkflags="${LDFLAGS}")
429 urls: https://webhooks.gitter.im/e/ce1e3a2036d94b4a644f