]>
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 | # File revision #5 | |
12 | ||
13 | sudo: false | |
14 | language: cpp | |
15 | compiler: | |
16 | - gcc | |
17 | # - clang | |
18 | ||
19 | os: | |
20 | - linux | |
21 | ||
22 | env: | |
23 | global: | |
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 | ||
28 | # Files, which coverage results must be ignored (files from other projects). | |
29 | # Example: - IGNORE_COVERAGE='*/boost/progress.hpp */filesystem/src/*' | |
30 | - IGNORE_COVERAGE='' | |
31 | ||
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`. | |
34 | # | |
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) | |
38 | ||
39 | matrix: | |
40 | - CXX_STANDARD=c++98 | |
41 | - CXX_STANDARD=c++0x | |
42 | ||
43 | ############################################################################################################### | |
44 | # From this point and below code is same for all the Boost libs | |
45 | ############################################################################################################### | |
46 | ||
47 | ||
48 | # Installing additional tools | |
49 | addons: | |
50 | apt: | |
51 | packages: | |
52 | - valgrind | |
53 | - python-yaml | |
54 | - lcov | |
55 | ||
56 | before_install: | |
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" | |
62 | - git init $BOOST | |
63 | - cd $BOOST | |
64 | - git remote add --no-tags -t $BRANCH_TO_TEST origin https://github.com/boostorg/boost.git | |
65 | - git fetch --depth=1 | |
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 | |
74 | - git status | |
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 | |
78 | - ./bootstrap.sh | |
79 | - ./b2 headers | |
80 | - cd $BOOST/libs/$PROJECT_TO_TEST/test/ | |
81 | ||
82 | script: | |
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" | |
85 | ||
86 | after_success: | |
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/ \; | |
91 | ||
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 | |
94 | ||
95 | # ... erasing /test/ /example/ folder data | |
96 | - cd $BOOST | |
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 | |
98 | ||
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'` | |
101 | - echo $OTHER_LIBS | |
102 | - eval "lcov --remove $TRAVIS_BUILD_DIR/coverals/coverage.info $OTHER_LIBS -o $TRAVIS_BUILD_DIR/coverals/coverage.info" | |
103 | ||
104 | # Sending data to Coveralls | |
105 | - cd $TRAVIS_BUILD_DIR | |
106 | - gem install coveralls-lcov | |
107 | - coveralls-lcov coverals/coverage.info |