language: cpp
sudo: required
dist: trusty

matrix:
  fast_finish: true
  include:
    - compiler: gcc
      addons:
        apt:
          sources:
            - ubuntu-toolchain-r-test
          packages:
            - g++-5
      env: COMPILER=g++-5 CXX=g++-5
    - compiler: clang
      addons:
        apt:
          sources:
            - ubuntu-toolchain-r-test
            - llvm-toolchain-precise-3.8
          packages:
            - clang-3.8
      env: COMPILER=clang++-3.8

before_install:
  - sudo add-apt-repository ppa:likemartinma/devel -y
  - sudo add-apt-repository --yes ppa:beineri/opt-qt57-trusty
  - sudo apt-get update -qq
  - sudo apt-get --force-yes install -qq qt57-meta-full
  - sudo apt-get --force-yes install -qq libsqlite3-dev libsqlcipher-dev libantlr-dev
  - QT_ENV_SCRIPT=$(find /opt -name 'qt*-env.sh')
  - source $QT_ENV_SCRIPT

install:
  - if [ "$CXX" = "g++" ]; then export CXX="g++-5" CC="gcc-5"; fi
  - if [ "$CXX" = "clang++" ]; then export CXX="clang++-3.8" CC="clang-3.8"; fi

script:
  - mkdir build
  - mkdir build_cipher
  - cd build
  - cmake -DENABLE_TESTING=ON ..
  - make
  - ctest -V
  - cd ../build_cipher
  - cmake -DENABLE_TESTING=ON -Dsqlcipher=1 ..
  - make
  - ctest -V

notifications:
  email:
    recipients:
      - mkleusberg@gmail.com
      - innermous@gmail.com
      - justin@postgresql.org
    on_success: never
    on_failure: always
