1# Use, modification, and distribution are 2# subject to the Boost Software License, Version 1.0. (See accompanying 3# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 4# 5# Copyright Antony Polukhin 2014-2016. 6 7# 8# See https://svn.boost.org/trac/boost/wiki/TravisCoverals for description of this file 9# and how it can be used with Boost libraries. 10# 11# File revision #6 12 13 14############################################################################################################### 15# From this point and below code is same for all the Boost libs 16############################################################################################################### 17sudo: false 18language: cpp 19compiler: 20 - gcc 21 22os: 23 - linux 24 - osx 25 26env: 27 matrix: 28 - BADGE=linux 29 - BADGE=osx 30 global: 31 # Autodetect Boost branch by using the following code: - BRANCH_TO_TEST=$TRAVIS_BRANCH 32 # or just directly specify it 33 - BRANCH_TO_TEST=$TRAVIS_BRANCH 34 35 # Files, which coverage results must be ignored (files from other projects). 36 # Example: - IGNORE_COVERAGE='*/boost/progress.hpp */filesystem/src/*' 37 - IGNORE_COVERAGE='' 38 39 # Explicitly remove the following library from Boost. This may be usefull, if you're for example running Travis 40 # from `Boost.DLL` repo, while Boost already has `dll`. 41 # 42 # By default is eaual to - BOOST_REMOVE=`basename $TRAVIS_BUILD_DIR` 43 # This will force to use local repo content, instead of the Boost's default 44 # not needed because process is not yet in boost. 45 - BOOST_REMOVE=process 46 - CXX_STANDARD=gnu++11 47 48matrix: 49 exclude: 50 - os: linux 51 env: BADGE=osx 52 - os: osx 53 env: BADGE=linux 54 55 56 57# Installing additional tools 58addons: 59 apt: 60 sources: 61 - ubuntu-toolchain-r-test 62 packages: 63 - valgrind 64 - python-yaml 65 - gcc-5 66 - g++-5 67 # - lcov 68 - clang 69 70before_install: 71 # Set this to the name of the library 72 - PROJECT_TO_TEST=`basename $TRAVIS_BUILD_DIR` 73 - echo "Testing $PROJECT_TO_TEST" 74 - if [ $TRAVIS_OS_NAME = "osx" ]; then brew install gcc5; brew install valgrind; brew install llvm; TOOLSET=clang; BOOST_TEST_CATCH_SYSTEM_ERRORS=no; MULTITHREAD=-j8; else TOOLSET=gcc-5; REPORT_CI=--boost-process-report-ci USE_VALGRIND="testing.launcher=valgrind valgrind=on"; fi 75 # Cloning Boost libraries (fast nondeep cloning) 76 - BOOST=$HOME/boost-local 77 - git init $BOOST 78 - cd $BOOST 79 - echo Branch to test $BRANCH_TO_TEST 80 - if [ $BRANCH_TO_TEST = "master" ]; then 81 BOOST_BRANCH=master; 82 else BOOST_BRANCH=develop; fi 83 - git remote add --no-tags -t $BOOST_BRANCH origin https://github.com/boostorg/boost.git 84 - git fetch --depth=1 85 - git checkout $BOOST_BRANCH 86 - git submodule update --init --merge 87 - git remote set-branches --add origin $BOOST_BRANCH 88 - git pull --recurse-submodules || true 89 - git submodule update --init 90 - git checkout $BOOST_BRANCH 91 - git submodule foreach "git reset --quiet --hard; git clean -fxd" 92 - git reset --hard; git clean -fxd 93 - git status 94 - echo "Removing $BOOST/libs/$BOOST_REMOVE" 95 - rm -rf $BOOST/libs/$BOOST_REMOVE 96 - mv $TRAVIS_BUILD_DIR/../$PROJECT_TO_TEST/ $BOOST/libs/$PROJECT_TO_TEST 97 - TRAVIS_BUILD_DIR=$BOOST/libs/$PROJECT_TO_TEST 98 - ./bootstrap.sh 99 - ./b2 headers 100 - cd $BOOST/libs/$PROJECT_TO_TEST/test 101 - echo BOOST_TEST_CATCH_SYSTEM_ERRORS $BOOST_TEST_CATCH_SYSTEM_ERRORS 102script: 103 # `--coverage` flags required to generate coverage info for Coveralls 104 - ../../../b2 $MULTITHREAD with-valgrind address-model=64 architecture=x86 $USE_VALGRIND toolset=$TOOLSET cxxflags="--coverage -DBOOST_TRAVISCI_BUILD -std=$CXX_STANDARD" linkflags="--coverage" -sBOOST_BUILD_PATH=. $REPORT_CI 105 - ../../../b2 $MULTITHREAD without-valgrind address-model=64 architecture=x86 toolset=$TOOLSET cxxflags="--coverage -DBOOST_TRAVISCI_BUILD -std=$CXX_STANDARD" linkflags="--coverage" -sBOOST_BUILD_PATH=. $REPORT_CI 106after_success: 107 # Copying Coveralls data to a separate folder 108 - mkdir -p $TRAVIS_BUILD_DIR/coverals 109 - find ../../../bin.v2/ -name "*.gcda" -exec cp "{}" $TRAVIS_BUILD_DIR/coverals/ \; 110 - find ../../../bin.v2/ -name "*.gcno" -exec cp "{}" $TRAVIS_BUILD_DIR/coverals/ \; 111 112 # Preparing Coveralls data by changind data format to a readable one 113 - git clone https://github.com/linux-test-project/lcov.git lcov_dir 114 - GCOV_VERSION="" 115 - if [[ "$TOOLSET" == *"-"* ]]; then GCOV_VERSION="--gcov-tool gcov-${TOOLSET#*-}"; fi 116 - LCOV="$BOOST/libs/$PROJECT_TO_TEST/test/lcov_dir/bin/lcov $GCOV_VERSION" 117 - $LCOV --directory $TRAVIS_BUILD_DIR/coverals --base-directory ./ --capture --output-file $TRAVIS_BUILD_DIR/coverals/coverage.info 118 119 # ... erasing /test/ /example/ folder data 120 - cd $BOOST 121 - $LCOV --remove $TRAVIS_BUILD_DIR/coverals/coverage.info "*.cpp" "/usr*" "*/$PROJECT_TO_TEST/test/*" $IGNORE_COVERAGE "*/$PROJECT_TO_TEST/tests/*" "*/$PROJECT_TO_TEST/examples/*" "*/$PROJECT_TO_TEST/example/*" -o $TRAVIS_BUILD_DIR/coverals/coverage.info 122 123 # ... erasing data that is not related to this project directly 124 - OTHER_LIBS=`grep "submodule .*" .gitmodules | sed 's/\[submodule\ "\(.*\)"\]/"\*\/boost\/\1\.hpp" "\*\/boost\/\1\/\*"/g'| sed "/\"\*\/boost\/process\/\*\"/d" | sed ':a;N;$!ba;s/\n/ /g'` 125 - echo $OTHER_LIBS 126 - eval "$LCOV --remove $TRAVIS_BUILD_DIR/coverals/coverage.info $OTHER_LIBS -o $TRAVIS_BUILD_DIR/coverals/coverage.info" > /dev/null 127 128 # Sending data to Coveralls 129 - cd $TRAVIS_BUILD_DIR 130 - gem install coveralls-lcov 131 - coveralls-lcov coverals/coverage.info 132 133after_script: 134 - bash <(curl -s https://codecov.io/bash) 135 - cd $BOOST/libs/$PROJECT_TO_TEST/test 136 - curl -s https://report.ci/report.py | python - --name="$BADGE test run" 137