---

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
        - CC_VERSION=gcc-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
        - CC_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:
  - ./.ci/install.sh

script:
  - $CXX --version
  - cmake --version

  - ./.ci/script.sh

after_success:
  # Generate coverage report and upload report to CodeCov.
  - if [ $COVERAGE == ON ]; then make -C build matrix_client_coverage; fi
  - if [ $COVERAGE == ON ]; then ./.ci/coverage.sh; fi
  - if [ $COVERAGE == ON ]; then bash <(curl -s https://codecov.io/bash) -f "!*tests*" || echo "Codecov failed"; fi
