File: .travis.yml

package info (click to toggle)
nfstrace 0.4.3.2-1
  • links: PTS, VCS
  • area: main
  • in suites: buster, sid
  • size: 21,744 kB
  • sloc: cpp: 37,459; ansic: 2,281; sh: 357; makefile: 16
file content (103 lines) | stat: -rw-r--r-- 3,477 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
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.'