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)
5 # Copyright Antony Polukhin 2014-2015.
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.
24 # Autodetect Boost branch by using the following code: - BRANCH_TO_TEST=$TRAVIS_BRANCH
25 # or just directly specify it
26 #- BRANCH_TO_TEST=$TRAVIS_BRANCH
27 - BRANCH_TO_TEST=develop
29 # Files, which coverage results must be ignored (files from other projects).
30 # Example: - IGNORE_COVERAGE='*/boost/progress.hpp */filesystem/src/*'
31 - IGNORE_COVERAGE='*/numeric/conversion/converter_policies.hpp'
33 # Explicitly remove the following library from Boost. This may be usefull, if you're for example running Travis
34 # from `Boost.DLL` repo, while Boost already has `dll`.
36 # By default is eaual to - BOOST_REMOVE=$(basename $TRAVIS_BUILD_DIR)
37 # This will force to use local repo content, instead of the Boost's default.
38 - BOOST_REMOVE=$(basename $TRAVIS_BUILD_DIR)
41 - CXX_FLAGS="--coverage -DBOOST_TRAVISCI_BUILD -std=c++98" LINK_FLAGS=--coverage TOOLSET=gcc
42 - CXX_FLAGS="--coverage -DBOOST_TRAVISCI_BUILD -std=c++11" LINK_FLAGS=--coverage TOOLSET=gcc-5
43 - CXX_FLAGS="--coverage -DBOOST_TRAVISCI_BUILD -std=c++1y" LINK_FLAGS=--coverage TOOLSET=gcc-5
44 #- CXX_FLAGS="--coverage -DBOOST_TRAVISCI_BUILD -std=c++11 -stdlib=libc++" LINK_FLAGS="--coverage -stdlib=libc++" TOOLSET=clang
45 #- CXX_FLAGS="--coverage -DBOOST_TRAVISCI_BUILD -std=c++1y -stdlib=libc++" LINK_FLAGS="--coverage -stdlib=libc++" TOOLSET=clang
47 ###############################################################################################################
48 # From this point and below code is same for all the Boost libs
49 ###############################################################################################################
52 # Installing additional tools
56 - ubuntu-toolchain-r-test
67 # Set this to the name of the library
68 - PROJECT_TO_TEST=`basename $TRAVIS_BUILD_DIR`
69 # Cloning Boost libraries (fast nondeep cloning)
70 - BOOST=$HOME/boost-local
71 - echo "Testing $PROJECT_TO_TEST, to remove $BOOST/libs/$BOOST_REMOVE, testing branch $BRANCH_TO_TEST"
74 - git remote add --no-tags -t $BRANCH_TO_TEST origin https://github.com/boostorg/boost.git
76 - git checkout $BRANCH_TO_TEST
77 - git submodule update --init --merge
78 - git remote set-branches --add origin $BRANCH_TO_TEST
79 - git pull --recurse-submodules
80 - git submodule update --init
81 - git checkout $BRANCH_TO_TEST
82 - git submodule foreach "git reset --quiet --hard; git clean -fxd"
83 - git reset --hard; git clean -fxd
85 - rm -rf $BOOST/libs/$BOOST_REMOVE
86 - mv $TRAVIS_BUILD_DIR $BOOST/libs/$PROJECT_TO_TEST
87 - TRAVIS_BUILD_DIR=$BOOST/libs/$PROJECT_TO_TEST
90 - cd $BOOST/libs/$PROJECT_TO_TEST/test/
93 # `--coverage` flags required to generate coverage info for Coveralls
94 - ../../../b2 testing.launcher=valgrind address-model=64 architecture=x86 toolset=$TOOLSET cxxflags="$CXX_FLAGS" linkflags="$LINK_FLAGS"
97 # Copying Coveralls data to a separate folder
98 - mkdir -p $TRAVIS_BUILD_DIR/coverals
99 - find ../../../bin.v2/ -name "*.gcda" -exec cp "{}" $TRAVIS_BUILD_DIR/coverals/ \;
100 - find ../../../bin.v2/ -name "*.gcno" -exec cp "{}" $TRAVIS_BUILD_DIR/coverals/ \;
102 # Preparing Coveralls data by changind data format to a readable one
103 - lcov --directory $TRAVIS_BUILD_DIR/coverals --base-directory ./ --capture --output-file $TRAVIS_BUILD_DIR/coverals/coverage.info
105 # ... erasing /test/ /example/ folder data
107 - lcov --remove $TRAVIS_BUILD_DIR/coverals/coverage.info "/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
109 # ... erasing data that is not related to this project directly
110 - OTHER_LIBS=`grep "submodule .*" .gitmodules | sed 's/\[submodule\ "\(.*\)"\]/"\*\/boost\/\1\.hpp" "\*\/boost\/\1\/\*"/g'| sed "/\"\*\/boost\/$PROJECT_TO_TEST\/\*\"/d" | sed ':a;N;$!ba;s/\n/ /g'`
112 - eval "lcov --remove $TRAVIS_BUILD_DIR/coverals/coverage.info $OTHER_LIBS -o $TRAVIS_BUILD_DIR/coverals/coverage.info"
114 # Sending data to Coveralls
115 - cd $TRAVIS_BUILD_DIR
116 - gem install coveralls-lcov
117 - coveralls-lcov coverals/coverage.info