# Copyright Louis Dionne 2013-2016 # 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: "gikHKTxWGN9FnJ9m+F53Y5j7jWGAOKlL2ylcFM2o0KoXOkoNAK9bJpilNppRwWhgwpC3yTJDN0k7xh9I6Ec8L0G46Q2QZdtJ/NFvWbafpzQcrAg6+872yKlP8h3GHexwEDdAdxCv8g2HeavFrDcqynssI8IoIHyZmsR6Dwym+eo=" # 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 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 CMAKE_OPTIONS="-DBOOST_HANA_ENABLE_MEMCHECK=ON" # Clang 3.6 - os: linux env: UNIT_TESTS=true LLVM_VERSION=3.6.2 BOOST_VERSION=default CMAKE_OPTIONS="-DBOOST_HANA_ENABLE_MEMCHECK=ON" compiler: clang # Clang 3.7 - os: linux env: UNIT_TESTS=true LLVM_VERSION=3.7.1 BOOST_VERSION=default CMAKE_OPTIONS="-DBOOST_HANA_ENABLE_MEMCHECK=ON" compiler: clang # Clang 3.8 - os: linux env: UNIT_TESTS=true LLVM_VERSION=3.8.0 BOOST_VERSION=default CMAKE_OPTIONS="-DBOOST_HANA_ENABLE_MEMCHECK=ON" compiler: clang # Clang 3.9 - os: linux env: UNIT_TESTS=true LLVM_VERSION=3.9.0 BOOST_VERSION=default CMAKE_OPTIONS="-DBOOST_HANA_ENABLE_MEMCHECK=ON" compiler: clang # GCC 6 - os: linux env: UNIT_TESTS=true COMPILER=g++-6 BOOST_VERSION=default CMAKE_OPTIONS="-DBOOST_HANA_ENABLE_MEMCHECK=ON" 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 # 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.62.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 (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 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 ############################################################################ # 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} 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 install pcre vera++; fi before_script: ############################################################################ # Set the git identity (for pushing the documentation and the benchmarks) ############################################################################ - git config --global user.name "Travis bot" ############################################################################ # Go back to the root of the project and setup the build directory ############################################################################ - cd ${TRAVIS_BUILD_DIR} - (mkdir build && cd build && cmake .. -DBOOST_HANA_ENABLE_WERROR=ON ${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 experimental -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 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) 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 export CTEST_PARALLEL_LEVEL=2 # Run unit tests on two cores (cd build && make check -j2 -k) 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