os:
 - linux
# - osx
#osx_image: xcode7.2
language: cpp
sudo: required
dist: trusty
branches:
  only:
    - master
    - coverity_scan
    - /openmw-.*$/
env:
  global:
   # The next declaration is the encrypted COVERITY_SCAN_TOKEN, created
   #   via the "travis encrypt" command using the project repo's public key
   - secure: "PwN1bETMQf8kiSxFpuuknzjdtqhYniBUFwMaVzpSs3lVVslNU/H3AHoiFtR5gVIuUAgNF13dDn8Zg1hu14QOOpYbXGLuVE51ePcqNjXkwb2NbrfswGOxbUEb4nHhY/Wl1LPjndwLk0kTTyDk6kPHU4nQuuCoElriWV2nShtTJbHOeLbLxRw6ZH5j7iFpdLqJh+gMeh0zFnP2kyHPVZlGnVcqjqTJA+R57J7faG1j/VGlYV34VB5PluIdHrphGUOV1aOh6yIxa3SVOPrjQK6MjP/6eaJ8tE7L5od4YWoMkjlmaNVLz3SBn+HiNpbYx6sXE2Z9B6ZSpP5eKcxVX+D1pdVFn/9c130D0zHT8B3BW0/sVqY35g5QTs4mXs3wS6R1v49iTVB5Y4N10RMHpw87hl2oyILSidNCu0kMJxuXeHw88Uyx3qdj01HahFjN2AQWfzCq9oUBirAXi2ECt5e8zlX7/8Sh+dRL/XaTxZGkEGaO7/DhO/Jr/ptvCt5GclZavvuXnbXB5p0BB06Br/4lRogfC2fOgQPxf2656ss6p7B6I/l98SNEyR1q869GMrFKRJ9rf5yERF2tBYolEZ7eb8mX0jctk9i9WRQ/KscPm/YDOxexMx6aJ5BAG3vK9uDiuOgzmQ2QTnA1X/WCDI+GLIFpzjajWl8Ik1iyXHhTiOc="
addons:
  apt:
    sources:
      - sourceline: 'ppa:openmw/openmw'
      - ubuntu-toolchain-r-test
      - llvm-toolchain-precise-3.6
    packages: [
      # Dev
      clang-3.6, libunshield-dev, libtinyxml-dev,
      g++-6,
      # Tests
      libgtest-dev, google-mock,
      # Boost
      libboost-filesystem-dev, libboost-program-options-dev, libboost-system-dev, libboost-thread-dev,
      # FFmpeg
      libavcodec-dev, libavformat-dev, libavutil-dev, libswscale-dev,
      # Audio & Video
      libsdl2-dev, libqt4-dev, libopenal-dev,
      # The other ones from OpenMW ppa
      libbullet-dev, libswresample-dev, libopenscenegraph-3.4-dev, libmygui-dev
    ]

  coverity_scan:
    project:
      name: "TES3MP/openmw-tes3mp"
      description: "<Your project description here>"
    notification_email: stas5978@gmail.com
    build_command_prepend: "cmake . -DBUILD_UNITTESTS=FALSE"
    build_command:   "make -j3"
    branch_pattern: coverity_scan
matrix:
  include:
    - os: linux
      env:
        ANALYZE="scan-build-3.6 --use-cc clang-3.6 --use-c++ clang++-3.6 "
      compiler: clang
  allow_failures:
    - env: ANALYZE="scan-build-3.6 --use-cc clang-3.6 --use-c++ clang++-3.6 "

before_install: 
      - ./CI/before_install.${TRAVIS_OS_NAME}.sh
before_script: ./CI/before_script.${TRAVIS_OS_NAME}.sh
script:
 - cd ./build
 - if [ "$COVERITY_SCAN_BRANCH" != 1 ]; then ${ANALYZE}make -j3; fi
 - if [ "$COVERITY_SCAN_BRANCH" != 1 ] && [ "${TRAVIS_OS_NAME}" = "osx" ]; then make package; fi
 - if [ "$COVERITY_SCAN_BRANCH" != 1 ] && [ "${TRAVIS_OS_NAME}" = "linux" ]; then ./openmw_test_suite; fi
 - if [ "$COVERITY_SCAN_BRANCH" != 1 ] && [ "${TRAVIS_OS_NAME}" = "linux" ]; then cd .. && ./CI/check_tabs.sh; fi
#notifications:
#  recipients:
#    - corrmage+travis-ci@gmail.com
#  email:
#    on_success: change
#    on_failure: always
