Codebase list nfstrace / upstream/0.4.3.2 .travis.yml
upstream/0.4.3.2

Tree @upstream/0.4.3.2 (Download .tar.gz)

.travis.yml @upstream/0.4.3.2raw · history · blame

sudo: false
language: cpp

addons:
  apt:
    packages:
      - ccache
cache:
  apt: true
  directories:
    - ccache
    - $HOME/.ccache
    - $DEPS_DIR

env:
  global:
    - DEPS_DIR="$HOME/install"
    - CMAKE_DIR="$DEPS_DIR/cmake-3.5.2-Linux-x86_64"
    - CMAKE="$CMAKE_DIR/bin/cmake"
    - JSON_DIR="$DEPS_DIR/json-c-0.11"
    - JSON_LIB="$JSON_DIR/install"
    - JSON_INCLUDE_DIR="$JSON_DIR"
    - LCOV_DIR="$DEPS_DIR/lcov-1.11"
    - LCOV="$LCOV_DIR/bin/lcov"
    - GTEST_DIR="$TRAVIS_BUILD_DIR/third_party/googletest"

matrix:
  include:
    - os: linux
      compiler: gcc-6
      addons:
        apt:
          sources: ['ubuntu-toolchain-r-test']
          packages: ['texlive-latex-base','gcc-6','g++-6','libpcap-dev','valgrind']
      env:
        # You can not set CXX directly as Travis CI will overwrite it. You need an intermediate variable like COMPILER
        - COMPILER=g++-6 CXX_FLAGS="-g -O0 -fprofile-arcs -ftest-coverage -fPIC" C_FLAGS="-g -O0 -fprofile-arcs -ftest-coverage" gcov="/usr/bin/gcov-6"
      fast_finish: true
    - os: linux
      compiler: clang-3.8
      addons:
        apt:
          sources: ['ubuntu-toolchain-r-test','llvm-toolchain-precise-3.8']
          packages: ['texlive-latex-base','clang-3.8','llvm-3.8-dev','libpcap-dev','valgrind']
      env:
        - COMPILER=/usr/bin/clang++-3.8 gcov="/usr/bin/gcov-6"
      fast_finish: true

before_install:
  - git submodule update --init --recursive
  - uname -a
  - pwd
  - export
  - export PATH="$PATH:$JSON_LIB"

install:
  - pip install --user --upgrade cpp-coveralls
  - gem install coveralls-lcov
  - |
    if [ ! -f "$CMAKE" ]; then
      wget -O - --no-check-certificate https://cmake.org/files/v3.5/cmake-3.5.2-Linux-x86_64.tar.gz | tar xz && cp -r cmake-3.5.2-Linux-x86_64 $DEPS_DIR
    else
      echo "Using cached cmake"
    fi
  - |

  # installing libjson-c from source because #'ondrej/php5-5.6' is disallowed source in travis-ci
  - |
    if [ ! -f "$JSON_DIR/configure" ]; then
      wget -O - --no-check-certificate https://s3.amazonaws.com/json-c_releases/releases/json-c-0.11.tar.gz | tar xz && cp -r json-c-0.11 $DEPS_DIR && (cd $JSON_DIR && mkdir -p $JSON_LIB && sh ./autogen.sh && ./configure --prefix=$JSON_LIB && make install)
    else
      echo "Using cached json"
    fi

  - |
    if [ ! -f "$LCOV" ]; then
      wget -O - --no-check-certificate http://ftp.de.debian.org/debian/pool/main/l/lcov/lcov_1.11.orig.tar.gz | tar xz && cp -r lcov-1.11 $DEPS_DIR
      make -C $LCOV_DIR
    else 
      echo "Using cached lcov"
    fi

before_script:
  - $CMAKE --version
  - gcov --version 
  - $LCOV --gcov-tool "/usr/bin/gcov-6" --directory . --zerocounters
script:
  - mkdir debug && cd debug
  - $CMAKE -DCMAKE_CXX_COMPILER="$COMPILER" -DCMAKE_BUILD_TYPE=DEBUG -DGTEST_SOURCE_DIR=$GTEST_DIR -D"CMAKE_CXX_FLAGS=$CXX_FLAGS" -DCMAKE_C_FLAGS="$C_FLAGS" -DINCLUDE_COVERAGE_INFO="true" ../
  - make
  - make test
  - make documentation-pdflatex
  - ccache -s

after_success: 
  - |
    if [[ "$COMPILER" == "g++"* ]]; then
      $LCOV --gcov-tool "/usr/bin/gcov-6" --compat-libtool --directory . --capture --output-file coverage.info # capture coverage info
      $LCOV --gcov-tool "/usr/bin/gcov-6" --remove coverage.info 'tests/*' '/usr/*' '*gmock*' --output-file coverage.info # filter out system and test code
      coveralls-lcov coverage.info
    fi
  # - coveralls --gcov "$(which "${GCOV}")" --encoding iso-8859-1 || echo 'coveralls upload failed.'