language: cpp
cache: ccache
compiler:
  - gcc
  - clang

os:
  - linux
#  - osx

dist: trusty
sudo: required

env:
  global:
    # The next declaration is the encrypted COVERITY_SCAN_TOKEN, created
    #   via the "travis encrypt" command using the project repo's public key
    # coveralls token here:
    - secure: "bCbWf/B++9y5YDn/ugMKVaV+ZmGCNNtxeWiPFfl7D/xwaj3yjy9yILMkqLcmNNc7rMQruEVx371rn+VURcLIFQtCJ+Uqj4vKdx7kSnhe2oNxKBMViAZU04nLSBB9ZNiH6TKvfqm4eUFprQd6AJ6T0GmB//lC1AgKSKNwSUJBMKc="
    # coverity scan token here:
    - secure: "CUY60CEo3S6lQqx7sBiNBaX6ah/hom45+ohCqEY4yhh7LJU1heLc1xZcQEfRS2xZ9hfNQHjjqUtM7iflHHfTyni77IrdUVutygyjxiGuuLMy90cO7nq1JbbzfOZ2vCsQRBhAUHglKm0jonM7XElkDPizrgXbuLXaNdaB1wLMbpc="

  matrix:
    # These are used by .travis-cmake.sh to set a configuration
    - STP_CONFIG=NORM
    - STP_CONFIG=RELEASE
    - STP_CONFIG=NO_BOOST
    #- STP_CONFIG=KLEE
    - STP_CONFIG=COVERAGE
    - STP_CONFIG=STATIC_CMS
    - STP_CONFIG=INTREE_BUILD
    - STP_CONFIG=STATIC_RISS

matrix:
  include:
    # Covertiy scan should only run once
    - os: linux
      compiler: gcc
      env: COVERITY_SCAN=1 STP_CONFIG=NORM

  exclude:
    - os: linux
      compiler: clang
      env: STP_CONFIG=COVERAGE

  allow_failures:
    # Covertiy scan might fail
    - env: COVERITY_SCAN=1 STP_CONFIG=NORM
    - env: STP_CONFIG=COVERAGE

addons:
  coverity_scan:
    project:
      name: "stp/stp"
      description: "Simple Theorem Prover"
    notification_email: soos.mate@gmail.com
    build_command_prepend: "cmake ."
    build_command:   "make"
    branch_pattern: coverity_scan

before_install:
  - sudo add-apt-repository -y ppa:ubuntu-sdk-team/ppa
  - sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
  - sudo apt-get update
  - sudo apt-get install -y --force-yes cmake valgrind git zlib1g-dev

install:
#cmake
  - wget http://www.cmake.org/files/v3.4/cmake-3.4.1.tar.gz
  - tar -xzf cmake-3.4.1.tar.gz
  - cd cmake-3.4.1/
  - ./configure > cmake_config_out.txt
  - make -j2 > cmake_build_out.txt
  - sudo make install > cmake_install_out.txt
  - sudo update-alternatives --install /usr/bin/cmake cmake /usr/local/bin/cmake 1 --force
  - cmake --version
  - cd ..
#coveralls
  - sudo pip install cpp-coveralls
  - wget http://ftp.de.debian.org/debian/pool/main/l/lcov/lcov_1.11.orig.tar.gz
  - tar xf lcov_1.11.orig.tar.gz
  - sudo make -C lcov-1.11/ install
  - gem install coveralls-lcov
#
# get LIT from pip
  - sudo pip install lit
#
# Initialise our submodules
  - git submodule init
  - git submodule update
#
#set up build environment
  - mkdir -p build

script:
  - if [ "$COVERITY_SCAN" != "1" ]; then ./scripts/travis-cmake.sh ; fi

