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.
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.
20 # Set this to the name of your Boost library
21 # Autodetect library name by using the following code: - PROJECT_TO_TEST=$(basename $(pwd))
22 - PROJECT_TO_TEST=$(basename $(pwd))
24 # Autodetect Boost branch by using the following code: - BRANCH_TO_TEST=`git rev-parse --abbrev-ref HEAD`
25 # or by - BRANCH_TO_TEST=$TRAVIS_BRANCH or just directly specify it
26 - BRANCH_TO_TEST=$TRAVIS_BRANCH
28 # Files, which coverage results must be ignored (files from other projects). Example: - IGNORE_COVERAGE='*/boost/progress.hpp */filesystem/src/path.cpp'
29 - IGNORE_COVERAGE='*/boost/progress.hpp */filesystem/src/path.cpp */numeric/conversion/converter_policies.hpp'
32 # From this point and below code is same for all the Boost libs
33 # Cloning Boost libraries (fast nondeep cloning)
35 - BOOST=$HOME/boost-local
38 - git remote add --no-tags -t $BRANCH_TO_TEST origin https://github.com/boostorg/boost.git
40 - git checkout $BRANCH_TO_TEST
41 - git submodule update --init --merge
42 - git remote set-branches --add origin $BRANCH_TO_TEST
43 - git pull --recurse-submodules
44 - git submodule update --init
45 - git checkout $BRANCH_TO_TEST
46 - git submodule foreach "git reset --quiet --hard; git clean -fxd"
47 - git reset --hard; git clean -fxd
49 - rm -rf $BOOST/libs/$PROJECT_TO_TEST
50 - mv $PROJECT_DIR/../$PROJECT_TO_TEST/ $BOOST/libs/$PROJECT_TO_TEST
51 - PROJECT_DIR=$BOOST/libs/$PROJECT_TO_TEST
56 - if [ "$CCFLAGS" != "" ]; then FLAGS="cxxflags=\"$CCFLAGS\" linkflags=\"$LINKFLAGS\""; else FLAGS=""; fi
57 - cd $BOOST/libs/$PROJECT_TO_TEST/test/
58 # `--coverage` flags required to generate coverage info for Coveralls
59 - ../../../b2 cxxflags="--coverage -std=$CXX_STANDARD" linkflags="--coverage"
62 # Copying Coveralls data to a separate folder
63 - mkdir -p $PROJECT_DIR/coverals
64 - find ../../../bin.v2/ -name "*.gcda" -exec cp "{}" $PROJECT_DIR/coverals/ \;
65 - find ../../../bin.v2/ -name "*.gcno" -exec cp "{}" $PROJECT_DIR/coverals/ \;
67 # Preparing Coveralls data by
68 # ... installing the tools
69 - sudo apt-get install -qq python-yaml lcov
70 # ... changind data format to a readable one
71 - lcov --directory $PROJECT_DIR/coverals --base-directory ./ --capture --output-file $PROJECT_DIR/coverals/coverage.info
73 # ... erasing /test/ /example/ folder data
75 - lcov --remove $PROJECT_DIR/coverals/coverage.info "/usr*" "*/$PROJECT_TO_TEST/test/*" $IGNORE_COVERAGE "*/$PROJECT_TO_TEST/tests/*" "*/$PROJECT_TO_TEST/examples/*" "*/$PROJECT_TO_TEST/example/*" -o $PROJECT_DIR/coverals/coverage.info
77 # ... erasing data that is not related to this project directly
78 - 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'`
80 - eval "lcov --remove $PROJECT_DIR/coverals/coverage.info $OTHER_LIBS -o $PROJECT_DIR/coverals/coverage.info"
82 # Sending data to Coveralls
84 - gem install coveralls-lcov
85 - coveralls-lcov coverals/coverage.info