sudo: required
dist: trusty
language: cpp
addons:
  apt:
    sources:
      - ubuntu-toolchain-r-test
#      - llvm-toolchain-trusty

# we're not using combination parameters here to ensure that the builds
# run in the order we want. (We want to perform the fastest tests first so
# failed tests appear as early as possible).
env:
  global:
    - PATH=/usr/local/bin:$PATH

# NOTE: The compiler setting is unused. It simply makes the display on
# travis-ci.org more readable.
# WARNING: do not use the name CXX. Travis will ignore the value here.
matrix:

  include:
    #
    # ----------- Coverage (covers all tests, slow) -------------------------
    #
    - env: CXX_=g++-7 A=64 BT=Coverage
    - env: CXX_=g++-7 A=32 BT=Coverage
    #
    # ----------- other tests -----------------------------------------------
    #
    #- env: CXX_=clang++-7   A=32 BT=Debug   SAN=ALL VG=ON
    #- env: CXX_=clang++-7   A=64 BT=Debug   SAN=ALL VG=ON
    #- env: CXX_=clang++-7   A=32 BT=Release SAN=ALL VG=ON
    #- env: CXX_=clang++-7   A=64 BT=Release SAN=ALL VG=ON

    - env: CXX_=g++-7       A=32 BT=Debug   SAN=ALL VG=ON
    - env: CXX_=g++-7       A=64 BT=Debug   SAN=ALL VG=ON
    - env: CXX_=g++-7       A=32 BT=Release SAN=ALL VG=ON
    - env: CXX_=g++-7       A=64 BT=Release SAN=ALL VG=ON

    - env: CXX_=clang++-6.0 A=32 BT=Debug   SAN=ALL VG=ON
    - env: CXX_=clang++-6.0 A=64 BT=Debug   SAN=ALL VG=ON
    - env: CXX_=clang++-6.0 A=32 BT=Release SAN=ALL VG=ON
    - env: CXX_=clang++-6.0 A=64 BT=Release SAN=ALL VG=ON

    - env: CXX_=clang++-5.0 A=32 BT=Debug   SAN=ALL VG=ON
    - env: CXX_=clang++-5.0 A=64 BT=Debug   SAN=ALL VG=ON
    - env: CXX_=clang++-5.0 A=32 BT=Release SAN=ALL VG=ON
    - env: CXX_=clang++-5.0 A=64 BT=Release SAN=ALL VG=ON

    - env: CXX_=clang++-4.0 A=32 BT=Debug   SAN=ALL VG=ON
    - env: CXX_=clang++-4.0 A=64 BT=Debug   SAN=ALL VG=ON
    - env: CXX_=clang++-4.0 A=32 BT=Release SAN=ALL VG=ON
    - env: CXX_=clang++-4.0 A=64 BT=Release SAN=ALL VG=ON

    - env: CXX_=clang++-3.9 A=32 BT=Debug   SAN=ALL VG=ON
    - env: CXX_=clang++-3.9 A=64 BT=Debug   SAN=ALL VG=ON
    - env: CXX_=clang++-3.9 A=32 BT=Release SAN=ALL VG=ON
    - env: CXX_=clang++-3.9 A=64 BT=Release SAN=ALL VG=ON

    - env: CXX_=g++-6       A=32 BT=Debug   SAN=ALL VG=ON
    - env: CXX_=g++-6       A=64 BT=Debug   SAN=ALL VG=ON
    - env: CXX_=g++-6       A=32 BT=Release SAN=ALL VG=ON
    - env: CXX_=g++-6       A=64 BT=Release SAN=ALL VG=ON

    - env: CXX_=clang++-3.8 A=32 BT=Debug   SAN=ALL VG=ON
    - env: CXX_=clang++-3.8 A=64 BT=Debug   SAN=ALL VG=ON
    - env: CXX_=clang++-3.8 A=32 BT=Release SAN=ALL VG=ON
    - env: CXX_=clang++-3.8 A=64 BT=Release SAN=ALL VG=ON
 
    - env: CXX_=g++-5       A=32 BT=Debug   SAN=ALL VG=ON
    - env: CXX_=g++-5       A=64 BT=Debug   SAN=ALL VG=ON
    - env: CXX_=g++-5       A=32 BT=Release SAN=ALL VG=ON
    - env: CXX_=g++-5       A=64 BT=Release SAN=ALL VG=ON

    - env: CXX_=clang++-3.7 A=32 BT=Debug   SAN=ALL VG=ON
    - env: CXX_=clang++-3.7 A=64 BT=Debug   SAN=ALL VG=ON
    - env: CXX_=clang++-3.7 A=32 BT=Release SAN=ALL VG=ON
    - env: CXX_=clang++-3.7 A=64 BT=Release SAN=ALL VG=ON
 
    #- env: CXX_=g++-4.9     A=32 BT=Debug   SAN=ALL VG=ON
    #- env: CXX_=g++-4.9     A=64 BT=Debug   SAN=ALL VG=ON
    #- env: CXX_=g++-4.9     A=32 BT=Release SAN=ALL VG=ON
    #- env: CXX_=g++-4.9     A=64 BT=Release SAN=ALL VG=ON

    - env: CXX_=clang++-3.6 A=32 BT=Debug   SAN=ALL VG=ON
    - env: CXX_=clang++-3.6 A=64 BT=Debug   SAN=ALL VG=ON
    - env: CXX_=clang++-3.6 A=32 BT=Release SAN=ALL VG=ON
    - env: CXX_=clang++-3.6 A=64 BT=Release SAN=ALL VG=ON

    # ----------- clang-tidy
    #
    - env: CXX_=clang++-6.0 A=32 BT=Debug   LINT=clang-tidy
    - env: CXX_=clang++-6.0 A=64 BT=Debug   LINT=clang-tidy
    - env: CXX_=clang++-6.0 A=32 BT=Release LINT=clang-tidy
    - env: CXX_=clang++-6.0 A=64 BT=Release LINT=clang-tidy
    #

install:
  - bash -x .ci/travis-install.sh

script:
  - bash -x .ci/travis-test.sh

after_success:
  - echo "Success!"
  - bash -x .ci/travis-coverage.sh
