]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
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. | |
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 | ||
12 | os: | |
13 | - linux | |
14 | ||
15 | env: | |
16 | - CXX_STANDARD=c++98 | |
17 | - CXX_STANDARD=c++0x | |
18 | ||
19 | before_install: | |
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)) | |
23 | ||
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 | |
27 | ||
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' | |
30 | ||
31 | ||
32 | # From this point and below code is same for all the Boost libs | |
33 | # Cloning Boost libraries (fast nondeep cloning) | |
34 | - PROJECT_DIR=`pwd` | |
35 | - BOOST=$HOME/boost-local | |
36 | - git init $BOOST | |
37 | - cd $BOOST | |
38 | - git remote add --no-tags -t $BRANCH_TO_TEST origin https://github.com/boostorg/boost.git | |
39 | - git fetch --depth=1 | |
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 | |
48 | - git status | |
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 | |
52 | - ./bootstrap.sh | |
53 | - ./b2 headers | |
54 | ||
55 | script: | |
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" | |
60 | ||
61 | after_success: | |
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/ \; | |
66 | ||
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 | |
72 | ||
73 | # ... erasing /test/ /example/ folder data | |
74 | - cd $BOOST | |
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 | |
76 | ||
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'` | |
79 | - echo $OTHER_LIBS | |
80 | - eval "lcov --remove $PROJECT_DIR/coverals/coverage.info $OTHER_LIBS -o $PROJECT_DIR/coverals/coverage.info" | |
81 | ||
82 | # Sending data to Coveralls | |
83 | - cd $PROJECT_DIR | |
84 | - gem install coveralls-lcov | |
85 | - coveralls-lcov coverals/coverage.info |