Changes between Version 7 and Version 8 of TravisCoverals


Ignore:
Timestamp:
Jan 5, 2016, 1:47:06 PM (7 years ago)
Author:
Antony Polukhin
Comment:

Updated .travisci to use modern non-sudo approach

Legend:

Unmodified
Added
Removed
Modified
  • TravisCoverals

    v7 v8  
    7373
    7474
    75 === `.travis.yml` content (22.08.2015) ===
     75=== `.travis.yml` content (05.01.2016) ===
    7676{{{
    7777# Use, modification, and distribution are
     
    8585# and how it can be used with Boost libraries.
    8686#
     87# File revision #5
    8788
     89sudo: false
    8890language: cpp
     91compiler:
     92    - gcc
     93#    - clang
     94
    8995os:
    9096    - linux
    9197
    9298env:
    93     - CXX_STANDARD=c++98
    94     - CXX_STANDARD=c++0x
     99    global:
     100        # Autodetect Boost branch by using the following code: - BRANCH_TO_TEST=$TRAVIS_BRANCH
     101        # or just directly specify it
     102        - BRANCH_TO_TEST=$TRAVIS_BRANCH
     103
     104        # Files, which coverage results must be ignored (files from other projects).
     105        # Example: - IGNORE_COVERAGE='*/boost/progress.hpp */filesystem/src/*'
     106        - IGNORE_COVERAGE=''
     107
     108        # Explicitly remove the following library from Boost. This may be usefull, if you're for example running Travis
     109        # from `Boost.DLL` repo, while Boost already has `dll`.
     110        #
     111        # By default is eaual to - BOOST_REMOVE=$(basename $TRAVIS_BUILD_DIR)
     112        # This will force to use local repo content, instead of the Boost's default.
     113        - BOOST_REMOVE=$(basename $TRAVIS_BUILD_DIR)
     114
     115    matrix:
     116        - CXX_STANDARD=c++98
     117        - CXX_STANDARD=c++0x
     118
     119###############################################################################################################
     120# From this point and below code is same for all the Boost libs
     121###############################################################################################################
     122
     123
     124# Installing additional tools
     125addons:
     126  apt:
     127    packages:
     128    - valgrind
     129    - python-yaml
     130    - lcov
    95131
    96132before_install:
    97     # Set this to the name of your Boost library
    98     # Autodetect library name by using the following code: - PROJECT_TO_TEST=$(basename $(pwd))
    99     - PROJECT_TO_TEST=$(basename $(pwd))
    100 
    101     # Autodetect Boost branch by using the following code: - BRANCH_TO_TEST=`git rev-parse --abbrev-ref HEAD`
    102     # or by - BRANCH_TO_TEST=$TRAVIS_BRANCH or just directly specify it
    103     - BRANCH_TO_TEST=$TRAVIS_BRANCH
    104 
    105     # Files, which coverage results must be ignored (files from other projects). Example: - IGNORE_COVERAGE='*/boost/progress.hpp */filesystem/src/path.cpp'
    106     - IGNORE_COVERAGE='*/boost/progress.hpp */filesystem/src/path.cpp */numeric/conversion/converter_policies.hpp'
    107 
    108 
    109     # From this point and below code is same for all the Boost libs
     133    # Set this to the name of the library
     134    - PROJECT_TO_TEST=`basename $TRAVIS_BUILD_DIR`
    110135    # Cloning Boost libraries (fast nondeep cloning)
    111     - PROJECT_DIR=`pwd`
    112136    - BOOST=$HOME/boost-local
     137    - echo "Testing $PROJECT_TO_TEST, to remove $BOOST/libs/$BOOST_REMOVE, testing branch $BRANCH_TO_TEST"
    113138    - git init $BOOST
    114139    - cd $BOOST
     
    124149    - git reset --hard; git clean -fxd
    125150    - git status
    126     - rm -rf $BOOST/libs/$PROJECT_TO_TEST
    127     - mv $PROJECT_DIR/../$PROJECT_TO_TEST/ $BOOST/libs/$PROJECT_TO_TEST
    128     - PROJECT_DIR=$BOOST/libs/$PROJECT_TO_TEST
     151    - rm -rf $BOOST/libs/$BOOST_REMOVE
     152    - mv $TRAVIS_BUILD_DIR $BOOST/libs/$PROJECT_TO_TEST
     153    - TRAVIS_BUILD_DIR=$BOOST/libs/$PROJECT_TO_TEST
    129154    - ./bootstrap.sh
    130155    - ./b2 headers
    131     - sudo apt-get update -qq
    132     - sudo apt-get install -qq valgrind
     156    - cd $BOOST/libs/$PROJECT_TO_TEST/test/
    133157
    134158script:
    135     - if [ "$CCFLAGS" != "" ]; then FLAGS="cxxflags=\"$CCFLAGS\" linkflags=\"$LINKFLAGS\""; else FLAGS=""; fi
    136     - cd $BOOST/libs/$PROJECT_TO_TEST/test/
    137159    # `--coverage` flags required to generate coverage info for Coveralls
    138     - ../../../b2 testing.launcher=valgrind  cxxflags="--coverage -std=$CXX_STANDARD" linkflags="--coverage"
     160    - ../../../b2 testing.launcher=valgrind address-model=64 architecture=x86 toolset=$CC cxxflags="--coverage -DBOOST_TRAVISCI_BUILD -std=$CXX_STANDARD" linkflags="--coverage"
    139161
    140162after_success:
    141163    # Copying Coveralls data to a separate folder
    142     - mkdir -p $PROJECT_DIR/coverals
    143     - find ../../../bin.v2/ -name "*.gcda" -exec cp "{}" $PROJECT_DIR/coverals/ \;
    144     - find ../../../bin.v2/ -name "*.gcno" -exec cp "{}" $PROJECT_DIR/coverals/ \;
     164    - mkdir -p $TRAVIS_BUILD_DIR/coverals
     165    - find ../../../bin.v2/ -name "*.gcda" -exec cp "{}" $TRAVIS_BUILD_DIR/coverals/ \;
     166    - find ../../../bin.v2/ -name "*.gcno" -exec cp "{}" $TRAVIS_BUILD_DIR/coverals/ \;
    145167
    146     # Preparing Coveralls data by
    147     # ... installing the tools
    148     - sudo apt-get install -qq python-yaml lcov
    149     # ... changind data format to a readable one
    150     - lcov --directory $PROJECT_DIR/coverals --base-directory ./ --capture --output-file $PROJECT_DIR/coverals/coverage.info
     168    # Preparing Coveralls data by changind data format to a readable one
     169    - lcov --directory $TRAVIS_BUILD_DIR/coverals --base-directory ./ --capture --output-file $TRAVIS_BUILD_DIR/coverals/coverage.info
    151170
    152171    # ... erasing /test/ /example/ folder data
    153172    - cd $BOOST
    154     - 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
     173    - 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
    155174
    156175    # ... erasing data that is not related to this project directly
    157176    - 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'`
    158177    - echo $OTHER_LIBS
    159     - eval "lcov --remove $PROJECT_DIR/coverals/coverage.info $OTHER_LIBS -o $PROJECT_DIR/coverals/coverage.info"
     178    - eval "lcov --remove $TRAVIS_BUILD_DIR/coverals/coverage.info $OTHER_LIBS -o $TRAVIS_BUILD_DIR/coverals/coverage.info"
    160179
    161180    # Sending data to Coveralls
    162     - cd $PROJECT_DIR
     181    - cd $TRAVIS_BUILD_DIR
    163182    - gem install coveralls-lcov
    164183    - coveralls-lcov coverals/coverage.info