Skip to content
Snippets Groups Projects
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
.travis.yml 2.35 KiB
---

language: cpp
sudo: required
dist: trusty

services:
  - docker

notifications:
  email: false

matrix:
  include:
    - os: osx
      osx_image: xcode9
      compiler: clang
      env:
        - OPENSLL_ROOT_DIR=/usr/local/opt/openssl
        - TESTS=OFF
        - USE_BUNDLED_BOOST=OFF
    - os: linux
      compiler: gcc
      env:
        - CXX_VERSION=g++-6
        - TESTS=ON
        - COVERAGE=ON
        - USE_BUNDLED_BOOST=ON
      addons:
        apt:
          sources:
            - "ubuntu-toolchain-r-test"
          packages:
            - "g++-6"
            - "lcov"
    - os: linux
      compiler: clang
      env:
        - CXX_VERSION=clang++-6.0
        - TESTS=ON
        - USE_BUNDLED_BOOST=ON
      addons:
        apt:
          sources:
            - "ubuntu-toolchain-r-test"
            - "llvm-toolchain-trusty-6.0"
          packages:
            - "clang++-6.0"
            - "clang-6.0"
            - "g++-7"

install:
  - if [ $TRAVIS_OS_NAME == osx ]; then brew update && brew upgrade boost && brew install libsodium; fi

  - if [ $TRAVIS_OS_NAME == linux ]; then sudo add-apt-repository -y ppa:george-edison55/cmake-3.x; fi
  - if [ $TRAVIS_OS_NAME == linux ]; then sudo add-apt-repository -y ppa:chris-lea/libsodium; fi
  - if [ $TRAVIS_OS_NAME == linux ]; then sudo apt-get update -qq; fi
  - if [ $TRAVIS_OS_NAME == linux ]; then sudo apt-get install -qq -y cmake libsodium-dev; fi

script:
  - if [[ "${CXX_VERSION}" != "" ]]; then export CXX=${CXX_VERSION}; fi

  - $CXX --version
  - cmake --version

  # Build library, examples & tests
  - mkdir -p .deps/usr/{lib,include}/
  - cmake -Hdeps -B.deps -DCMAKE_BUILD_TYPE=Release
      -DUSE_BUNDLED_BOOST=${USE_BUNDLED_BOOST}
      -DUSE_BUNDLED_GTEST=${TESTS}
  - cmake --build .deps
  - cmake -H. -Bbuild -DOPENSSL_ROOT_DIR=$OPENSLL_ROOT_DIR -DBUILD_LIB_TESTS=$TESTS -DCOVERAGE=$COVERAGE
  - cmake --build build

  # Unit & Integration tests
  - if [ $TESTS == ON ]; then make synapse; fi
  - if [ $TESTS == ON ]; then make test; fi

  # Linting
  - if [ $LINT == ON ]; then make lint; fi

after_success:
  - if [ $COVERAGE == ON ]; then make -C build matrix_client_coverage; fi

  # Generate coverage report.
  - if [ $COVERAGE == ON ]; then ./.ci/coverage.sh; fi

  # Upload report to CodeCov.
  - if [ $COVERAGE == ON ]; then bash <(curl -s https://codecov.io/bash) -f "!*tests*" || echo "Codecov failed"; fi