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
28 # Files, which coverage results must be ignored (files from other projects).
29 # Example: - IGNORE_COVERAGE='*/boost/progress.hpp */filesystem/src/*'
32 # Explicitly remove the following library from Boost. This may be usefull, if you're for example running Travis
33 # from `Boost.DLL` repo, while Boost already has `dll`.
35 # By default is eaual to - BOOST_REMOVE=$(basename $TRAVIS_BUILD_DIR)
36 # This will force to use local repo content, instead of the Boost's default.
37 - BOOST_REMOVE=$(basename $TRAVIS_BUILD_DIR)
43 ###############################################################################################################
44 # From this point and below code is same for all the Boost libs
45 ###############################################################################################################
48 # Installing additional tools
57 # Set this to the name of the library
58 - PROJECT_TO_TEST=`basename $TRAVIS_BUILD_DIR`
59 # Cloning Boost libraries (fast nondeep cloning)
60 - BOOST=$HOME/boost-local
61 - echo "Testing $PROJECT_TO_TEST, to remove $BOOST/libs/$BOOST_REMOVE, testing branch $BRANCH_TO_TEST"
64 - git remote add --no-tags -t $BRANCH_TO_TEST origin https://github.com/boostorg/boost.git
66 - git checkout $BRANCH_TO_TEST
67 - git submodule update --init --merge
68 - git remote set-branches --add origin $BRANCH_TO_TEST
69 - git pull --recurse-submodules
70 - git submodule update --init
71 - git checkout $BRANCH_TO_TEST
72 - git submodule foreach "git reset --quiet --hard; git clean -fxd"
73 - git reset --hard; git clean -fxd
75 - rm -rf $BOOST/libs/$BOOST_REMOVE
76 - mv $TRAVIS_BUILD_DIR $BOOST/libs/$PROJECT_TO_TEST
77 - TRAVIS_BUILD_DIR=$BOOST/libs/$PROJECT_TO_TEST
80 - cd $BOOST/libs/$PROJECT_TO_TEST/test/
83 # `--coverage` flags required to generate coverage info for Coveralls
84 - ../../../b2 testing.launcher=valgrind address-model=64 architecture=x86 toolset=$CC cxxflags="--coverage -DBOOST_TRAVISCI_BUILD -std=$CXX_STANDARD" linkflags="--coverage"
87 # Copying Coveralls data to a separate folder
88 - mkdir -p $TRAVIS_BUILD_DIR/coverals
89 - find ../../../bin.v2/ -name "*.gcda" -exec cp "{}" $TRAVIS_BUILD_DIR/coverals/ \;
90 - find ../../../bin.v2/ -name "*.gcno" -exec cp "{}" $TRAVIS_BUILD_DIR/coverals/ \;
92 # Preparing Coveralls data by changind data format to a readable one
93 - lcov --directory $TRAVIS_BUILD_DIR/coverals --base-directory ./ --capture --output-file $TRAVIS_BUILD_DIR/coverals/coverage.info
95 # ... erasing /test/ /example/ folder data
97 - 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
99 # ... erasing data that is not related to this project directly
100 - 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'`
102 - eval "lcov --remove $TRAVIS_BUILD_DIR/coverals/coverage.info $OTHER_LIBS -o $TRAVIS_BUILD_DIR/coverals/coverage.info"
104 # Sending data to Coveralls
105 - cd $TRAVIS_BUILD_DIR
106 - gem install coveralls-lcov
107 - coveralls-lcov coverals/coverage.info