1os: 2 - linux 3 - osx 4# Use travis docker infrastructure 5sudo: false 6# Use a recent OSX image 7# cf. 8# https://docs.travis-ci.com/user/languages/objective-c/#Supported-OS-X-iOS-SDK-versions 9osx_image: xcode7.2 10language: cpp 11cache: ccache 12 13env: 14 global: 15 - PREFIX=$HOME/prefix 16 - MY_CMAKE_OPTIONS="-DCMAKE_PREFIX_PATH=$PREFIX -DCMAKE_INSTALL_PREFIX=$HOME/install" 17 - OSX_CMAKE_OPTIONS="-DBUILD_TESTING=OFF -DPYTHON_BINDINGS=OFF -DCLIENT_SIMULATOR=OFF" 18 - CTEST_OUTPUT_ON_FAILURE=1 19 - LINUX=false 20 - OSX=false 21 22compiler: 23 - gcc 24 - clang 25 26matrix: 27 exclude: 28 - os: osx 29 compiler: gcc 30 31# Install a recent gcc and gcov, 32# it will not be necessary once travis worker is based on ubuntu > 12.04. 33# Install SWIG for bindings generation 34# Install valgrind for memcheck tests 35# Adding george-edison55-precise-backports ppa for for cmake 3.x. 36# Install python3-dev for the client simulator 37addons: 38 apt: 39 # Travis white list of ppa 40 # https://github.com/travis-ci/apt-source-whitelist/blob/master/ubuntu.json 41 sources: 42 - ubuntu-toolchain-r-test 43 - george-edison55-precise-backports 44 - llvm-toolchain-precise-3.8 45 # Travis white list of dpkg packages 46 # https://github.com/travis-ci/apt-package-whitelist/blob/master/ubuntu-precise 47 packages: 48 - swig 49 - valgrind 50 - g++-4.8 51 - cmake-data 52 - cmake 53 - python3-dev 54 - clang-format-3.8 55 56before_install: 57 # OS detection 58 # TODO: an explicit build matrix may be better but it has limitation, e.g. 59 # each matrix entry may only define a single env variable. 60 - if [ $TRAVIS_OS_NAME = linux ]; then export LINUX=true; fi 61 - if [ $TRAVIS_OS_NAME = osx ]; then export OSX=true; fi 62install: 63 - wget https://codecov.io/bash -O $HOME/codecov; chmod +x $HOME/codecov 64 # This version of catch is known to work. 65 - wget --directory-prefix $PREFIX/include 66 https://raw.github.com/philsquared/Catch/v1.2.1/single_include/catch.hpp 67 - wget -O asio-1.10.6.tar.gz https://github.com/chriskohlhoff/asio/archive/asio-1-10-6.tar.gz 68 - tar xf asio-1.10.6.tar.gz -C $PREFIX --strip-components=2 asio-asio-1-10-6/asio 69 # Current limitations on OSX builds: no testing, no client-simulator 70 # (because we haven't found a straightforward way to have CMake find the 71 # python libraries (find_package(PythonLibs)). 72 - if $OSX; then 73 brew update; 74 for package in cmake; do 75 if brew list $package; then 76 brew outdated $package || brew upgrade $package; 77 else 78 brew install $package; 79 fi; 80 done; 81 fi 82 83before_script: 84 - coverage=OFF 85 # Force the manualy installed 4.8 version as it is not the default 86 # Only enable coverage on gcc as clang segfault on coverage file write 87 # Workaround a bug with the ccache/g++-4.8.1 combination 88 - if [ "$CC" = "gcc" ]; then 89 export CC=gcc-4.8 CXX=g++-4.8; 90 coverage=ON; 91 export CCACHE_CPP2=1; 92 fi 93 - if $OSX; then export MY_CMAKE_OPTIONS+=" -DBUILD_TESTING=OFF -DPYTHON_BINDINGS=OFF"; fi 94 95# how to build 96script: 97 # Check coding style 98 - if $LINUX; then (git ls-files | grep -E '\.[ch](pp)?$' | xargs clang-format-3.8 -i && 99 git diff --exit-code || { git reset --hard; false; }); fi 100 101 - ( mkdir build_debug && cd build_debug && 102 cmake $MY_CMAKE_OPTIONS -DCMAKE_BUILD_TYPE=Debug -DCOVERAGE=${coverage} .. && 103 make -j$(nproc) && 104 (if $LINUX; then make ExperimentalTest ExperimentalMemCheck; fi) ) 105 - ( mkdir build && cd build && 106 cmake $MY_CMAKE_OPTIONS -DCMAKE_BUILD_TYPE=Release .. && 107 make -j$(nproc) && 108 (if $LINUX; then make test; fi) && 109 make install && 110 (if $LINUX; then cpack --verbose -G DEB && dpkg --info *.deb; fi) ) 111 - ( cd skeleton-subsystem && 112 cmake $MY_CMAKE_OPTIONS -DCMAKE_BUILD_TYPE=Release . && 113 make -j$(nproc) && 114 (if $LINUX; then make ExperimentalTest ExperimentalMemCheck; fi) && 115 make install ) 116 - if $LINUX; then ( cd tools/clientSimulator && 117 echo "TODO - install the generated .deb instead of using \$HOME/install." 118 "This would permit to test the packaging" && 119 cmake $MY_CMAKE_OPTIONS . && 120 make && 121 make install ); fi 122 # Check that all installed files are in a component (no "unspecified 123 # component" archive created) 124 - (cd build && cpack -G TGZ -D CPACK_ARCHIVE_COMPONENT_INSTALL=ON && 125 [ ! -e "*-Unspecified.tar.gz" ]) 126 # Keep this last 127 - ( mkdir build_less_features && cd build_less_features && 128 rm -rf $PREFIX/asio-1.10.6 && 129 cmake $MY_CMAKE_OPTIONS -DCMAKE_BUILD_TYPE=Debug 130 -DNETWORKING=OFF -DPYTHON_BINDINGS=OFF -DC_BINDINGS=OFF .. && 131 make -j$(nproc) && 132 (if $LINUX; then make test; fi) ) 133 134after_success: 135 # Push coverage info on codecov.io. 136 # Ignore generated files, samples and tests 137 - if [ "${coverage}" = "ON" ]; then 138 $HOME/codecov 139 -g "*/build_debug/bindings/python/*" 140 -g "*/build_debug/CMakeFiles/*" 141 -g "*/build/*" 142 -g "*/install/*" 143 -g "*/skeleton-subsystem/*" 144 -g "*/tools/clientSimulator/*" 145 -g "*/test/test-subsystem/*" 146 -g "*/test/introspection-subsystem/*" 147 -g "*/test/functional-tests/*" 148 -g "*/test/tmpfile/*" 149 -g "*/test/tokenizer/*" 150 -g "*/bindings/c/Test.cpp" 151 -g "*/utility/test/*" 152 -x /usr/bin/gcov-4.8 153 -a '\--long-file-names --preserve-paths'; 154 fi 155 156notifications: 157 irc: 158 - "chat.freenode.net#parameter-framework" 159