]>
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-2015. | |
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 | language: cpp | |
13 | os: | |
14 | - linux | |
15 | ||
16 | env: | |
17 | - CXX_STANDARD=c++98 | |
18 | - CXX_STANDARD=c++0x | |
19 | ||
20 | before_install: | |
21 | # Set this to the name of your Boost library | |
22 | # Autodetect library name by using the following code: - PROJECT_TO_TEST=$(basename $(pwd)) | |
23 | - PROJECT_TO_TEST=$(basename $(pwd)) | |
24 | ||
25 | # Autodetect Boost branch by using the following code: - BRANCH_TO_TEST=`git rev-parse --abbrev-ref HEAD` | |
26 | # or by - BRANCH_TO_TEST=$TRAVIS_BRANCH or just directly specify it | |
27 | - BRANCH_TO_TEST=$TRAVIS_BRANCH | |
28 | ||
29 | # Files, which coverage results must be ignored (files from other projects). Example: - IGNORE_COVERAGE= | |
30 | - IGNORE_COVERAGE= | |
31 | ||
32 | ||
33 | # From this point and below code is same for all the Boost libs | |
34 | # Cloning Boost libraries (fast nondeep cloning) | |
35 | - PROJECT_DIR=`pwd` | |
36 | - BOOST=$HOME/boost-local | |
37 | - git init $BOOST | |
38 | - cd $BOOST | |
39 | - git remote add --no-tags -t $BRANCH_TO_TEST origin https://github.com/boostorg/boost.git | |
40 | - git fetch --depth=1 | |
41 | - git checkout $BRANCH_TO_TEST | |
42 | - git submodule update --init --merge | |
43 | - git remote set-branches --add origin $BRANCH_TO_TEST | |
44 | - git pull --recurse-submodules | |
45 | - git submodule update --init | |
46 | - git checkout $BRANCH_TO_TEST | |
47 | - git submodule foreach "git reset --quiet --hard; git clean -fxd" | |
48 | - git reset --hard; git clean -fxd | |
49 | - git status | |
50 | - rm -rf $BOOST/libs/$PROJECT_TO_TEST | |
51 | - mv $PROJECT_DIR/../$PROJECT_TO_TEST/ $BOOST/libs/$PROJECT_TO_TEST | |
52 | - PROJECT_DIR=$BOOST/libs/$PROJECT_TO_TEST | |
53 | - ./bootstrap.sh | |
54 | - ./b2 headers | |
55 | - sudo apt-get update -qq | |
56 | - sudo apt-get install -qq valgrind | |
57 | ||
58 | script: | |
59 | - if [ "$CCFLAGS" != "" ]; then FLAGS="cxxflags=\"$CCFLAGS\" linkflags=\"$LINKFLAGS\""; else FLAGS=""; fi | |
60 | - cd $BOOST/libs/$PROJECT_TO_TEST/test/ | |
61 | # `--coverage` flags required to generate coverage info for Coveralls | |
62 | - ../../../b2 testing.launcher=valgrind cxxflags="--coverage -std=$CXX_STANDARD" linkflags="--coverage" | |
63 | ||
64 | after_success: | |
65 | # Copying Coveralls data to a separate folder | |
66 | - mkdir -p $PROJECT_DIR/coverals | |
67 | - find ../../../bin.v2/ -name "*.gcda" -exec cp "{}" $PROJECT_DIR/coverals/ \; | |
68 | - find ../../../bin.v2/ -name "*.gcno" -exec cp "{}" $PROJECT_DIR/coverals/ \; | |
69 | ||
70 | # Preparing Coveralls data by | |
71 | # ... installing the tools | |
72 | - sudo apt-get install -qq python-yaml lcov | |
73 | # ... changind data format to a readable one | |
74 | - lcov --directory $PROJECT_DIR/coverals --base-directory ./ --capture --output-file $PROJECT_DIR/coverals/coverage.info | |
75 | ||
76 | # ... erasing /test/ /example/ folder data | |
77 | - cd $BOOST | |
78 | - 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 | |
79 | ||
80 | # ... erasing data that is not related to this project directly | |
81 | - 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'` | |
82 | - echo $OTHER_LIBS | |
83 | - eval "lcov --remove $PROJECT_DIR/coverals/coverage.info $OTHER_LIBS -o $PROJECT_DIR/coverals/coverage.info" | |
84 | ||
85 | # Sending data to Coveralls | |
86 | - cd $PROJECT_DIR | |
87 | - gem install coveralls-lcov | |
88 | - coveralls-lcov coverals/coverage.info |