language: cpp

os:
  - linux
  - osx

dist: trusty
sudo: required
osx_image: xcode7

compiler:
  - clang
  - gcc

env:
  global:
    - CCACHE_SIZE=50M
    - CCACHE_COMPRESS=1
    - BUILD_JOBS=2
    # SONAR_TOKEN for accessing the SonarQube server
    - secure: "VezRbHFg6kllV5WG06M3tG3aHJaC3xrMylJ6RCVbL+uz2JeralVCqV7eIk4fVb9cu83Li+weEa0AJj0wkxpIUJ+vUh5F65L6gSWSbgHP7muOSVsmnEc6KvX4n3av/ZGe4geSmsxqh2pd/2xI1h7KioGRhKeqaZIdjVgWgGJW2iQ="
    # GITHUB_TOKEN for posting found issues as comments in the PR that's beeing analyzed by SonarQube
    - secure: "Th0mBSkUCDqu+EA6F7zA6DCSDZBNunfndANyq06BwaFlj71daWWjthwYFsfg3T5N2ZmI+PsULQQpOirCnJt1lbNHhMVJwZPkW0JnjoxbSNpSI2+nHv7+GO9X9WjK0LRFawiQu8WxmLMQDA+0oR0BERSFKc3gmbuav9fDfla0dXg="

  matrix:
    - BUILD_MODE="shared"
    - BUILD_MODE="static"
    - BUILD_MODE="bsi"
    - BUILD_MODE="mini-shared"
    - BUILD_MODE="mini-static"
    - BUILD_MODE="cross-arm32"
    - BUILD_MODE="cross-arm64"
    - BUILD_MODE="cross-ppc32"
    - BUILD_MODE="cross-ppc64"
    - BUILD_MODE="cross-win32"
    - BUILD_MODE="coverage"
    - BUILD_MODE="sanitizer"
    - BUILD_MODE="valgrind"
    - BUILD_MODE="sonarqube"

matrix:
  # Ignore some problem builds for now
  allow_failures:
    - os: linux
      env: BUILD_MODE="cross-ppc32"
    - os: linux
      env: BUILD_MODE="cross-win32"

  exclude:
    # Skip GCC on OS X entirely
    - os: osx
      compiler: gcc

    # Run bsi, coverage, valgrind, sonarqube, sanitizer, minimized and
    # non-ARM cross builds on Linux/gcc only. The sanitizer builds
    # under Clang run the tests very slowly and cause CI timeouts.

    - compiler: clang
      env: BUILD_MODE="bsi"
    - compiler: clang
      env: BUILD_MODE="coverage"
    - compiler: clang
      env: BUILD_MODE="sonarqube"
    - compiler: clang
      env: BUILD_MODE="sanitizer"
    - compiler: clang
      env: BUILD_MODE="valgrind"
    - compiler: clang
      env: BUILD_MODE="mini-shared"
    - compiler: clang
      env: BUILD_MODE="mini-static"
    - compiler: clang
      env: BUILD_MODE="cross-win32"
    - compiler: clang
      env: BUILD_MODE="cross-ppc32"
    - compiler: clang
      env: BUILD_MODE="cross-ppc64"

    # No ARM Clang compiler on Linux
    - os: linux
      compiler: clang
      env: BUILD_MODE="cross-arm32"
    - os: linux
      compiler: clang
      env: BUILD_MODE="cross-arm64"

install:
  - ./src/scripts/ci/travis/install.sh

script:
  - if [ "${COVERITY_SCAN_BRANCH}" != 1 ]; then ./src/scripts/ci/travis/build.sh ; fi

after_success:
  - ./src/scripts/ci/travis/after_success.sh

notifications:
  email: botan-commits@lists.randombit.net

git:
  depth: 5

cache:
  ccache: true
  directories:
    - $HOME/.sonar/cache

addons:
  sonarqube: true

  coverity_scan:
    project:
      name: "randombit/botan"
    notification_email: lloyd@randombit.net
    build_command_prepend: "./configure.py --cc-bin=/usr/bin/g++-4.8"
    build_command: "make -j2"
    branch_pattern: coverity_scan