1# Use travis docker infrastructure
2sudo: false
3language: cpp
4
5env:
6    global:
7        - PREFIX=$HOME/prefix
8
9compiler:
10    - gcc
11    - clang
12
13# Install a recent gcc and gcov,
14# it will not be necessary once travis worker is based on ubuntu > 12.04.
15# Install SWIG for bindings generation
16# Install valgrind for memcheck tests
17# Adding george-edison55-precise-backports ppa for for cmake 3.x.
18# Install python3-dev for the client simulator
19addons:
20    apt:
21        # Travis white list of ppa
22        # https://github.com/travis-ci/apt-source-whitelist/blob/master/ubuntu.json
23        sources:
24            - ubuntu-toolchain-r-test
25            - george-edison55-precise-backports
26            - llvm-toolchain-precise
27        # Travis white list of dpkg packages
28        # https://github.com/travis-ci/apt-package-whitelist/blob/master/ubuntu-precise
29        packages:
30            - swig
31            - valgrind
32            - g++-4.8
33            - cmake-data
34            - cmake
35            - python3-dev
36            - clang-format-3.8
37
38install:
39    - wget https://codecov.io/bash -O $HOME/codecov; chmod +x $HOME/codecov
40    # This version of catch is known to work.
41    - wget --directory-prefix $PREFIX/include
42              https://raw.github.com/philsquared/Catch/v1.2.1/single_include/catch.hpp
43    - wget 'https://01.org/sites/default/files/asio-1.10.6.tar.gz'
44    - tar xf asio-1.10.6.tar.gz -C $PREFIX --strip-components=1
45
46before_script:
47    - coverage=OFF
48    # Force the manualy installed 4.8 version as it is not the default
49    # Only enable coverage on gcc as clang segfault on coverage file write
50    - if [ "$CC" = "gcc" ]; then
51          export CC=gcc-4.8 CXX=g++-4.8;
52          coverage=ON;
53      fi
54
55# how to build
56script:
57  # Check coding style
58  - git ls-files | grep -E '\.[ch](pp)?$' |  xargs clang-format-3.8 -i &&
59        git diff --exit-code || { git reset --hard; false; }
60
61  - ( mkdir build_debug && cd build_debug &&
62        cmake -DCMAKE_PREFIX_PATH=$PREFIX -DCMAKE_BUILD_TYPE=Debug -DCOVERAGE=${coverage} .. &&
63        make -j &&
64        CTEST_OUTPUT_ON_FAILURE=1 make ExperimentalTest ExperimentalMemCheck )
65  - ( mkdir build && cd build &&
66        cmake -DCMAKE_PREFIX_PATH=$PREFIX -DCMAKE_INSTALL_PREFIX=../install -DCMAKE_BUILD_TYPE=Release .. &&
67        make -j &&
68        CTEST_OUTPUT_ON_FAILURE=1 make test &&
69        make install &&
70        cpack --verbose -G DEB && dpkg --info *.deb)
71  - ( cd skeleton-subsystem &&
72        cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=../install . &&
73        make &&
74        CTEST_OUTPUT_ON_FAILURE=1 make ExperimentalTest ExperimentalMemCheck &&
75        make install )
76  - ( cd tools/clientSimulator &&
77        echo "TODO - install the generated .deb instead of using ../install."
78             "This would permit to test the packaging" &&
79        cmake -DCMAKE_INSTALL_PREFIX=../install . &&
80        make &&
81        make install )
82  # Keep this last
83  - ( mkdir build_less_features && cd build_less_features &&
84        rm -rf $PREFIX/asio-1.10.6 &&
85        cmake -DCMAKE_PREFIX_PATH=$PREFIX -DCMAKE_BUILD_TYPE=Debug
86        -DNETWORKING=OFF -DPYTHON_BINDINGS=OFF -DC_BINDINGS=OFF .. &&
87        make -j &&
88        CTEST_OUTPUT_ON_FAILURE=1 make test )
89
90after_success:
91    # Push coverage info on codecov.io.
92    # Ignore generated files, samples and tests
93    - if [ "${coverage}" = "ON" ]; then
94          $HOME/codecov
95               -g "*/build_debug/bindings/python/*"
96               -g "*/build_debug/CMakeFiles/*"
97               -g "*/build/*"
98               -g "*/install/*"
99               -g "*/skeleton-subsystem/*"
100               -g "*/tools/clientSimulator/*"
101               -g "*/test/test-subsystem/*"
102               -g "*/test/introspection-subsystem/*"
103               -g "*/test/functional-tests/*"
104               -g "*/test/tmpfile/*"
105               -g "*/test/tokenizer/*"
106               -g "*/bindings/c/Test.cpp"
107               -g "*/utility/test/*"
108               -x /usr/bin/gcov-4.8
109               -a '\--long-file-names --preserve-paths';
110      fi
111
112notifications:
113  irc:
114    - "chat.freenode.net#parameter-framework"
115