#-----------------------------------------------------------------------------
#
#  Configuration for continuous integration service at travis-ci.org
#
#-----------------------------------------------------------------------------

language: cpp

sudo: false

matrix:
    include:
        - os: linux
          compiler: clang
          env: INSTALL_CXX=clang++-3.5
          addons:
            apt:
                sources: ['ubuntu-toolchain-r-test', 'llvm-toolchain-precise-3.5']
                packages: ['clang-3.5','libprotobuf-dev','protobuf-compiler']
        - os: linux
          compiler: clang
          env: INSTALL_CXX=clang++-3.6
          #env: INSTALL_CXX=clang++-3.6 COVERAGE=llvm-cov-3.6
          addons:
            apt:
                sources: ['ubuntu-toolchain-r-test', 'llvm-toolchain-precise-3.6']
                packages: ['clang-3.6','libprotobuf-dev','protobuf-compiler']
        - os: linux
          compiler: gcc
          env: INSTALL_CXX=g++-4.8
          addons:
            apt:
                sources: ['ubuntu-toolchain-r-test']
                packages: ['g++-4.8','libprotobuf-dev','protobuf-compiler']
        - os: linux
          compiler: gcc
          env: INSTALL_CXX=g++-4.9 COVERAGE=gcov-4.9
          addons:
            apt:
                sources: ['ubuntu-toolchain-r-test']
                packages: ['g++-4.9','libprotobuf-dev','protobuf-compiler']
        - os: osx
          compiler: clang

before_script:
    - if [ -n "${INSTALL_CXX}" ]; then CXX=${INSTALL_CXX}; fi
    - if [[ $(uname -s) == 'Darwin' ]]; then brew install protobuf; fi;
    - make test

script:
    - if [ -n "${COVERAGE}" ]; then
        make clean;
        CXXFLAGS="--coverage" LDFLAGS="--coverage" make test;
        ${COVERAGE} -lp test/*tests.o test/t/*/*test_cases.o;
        pip install --user cpp-coveralls;
        ~/.local/bin/coveralls --no-gcov -i include/protozero;
      fi

