language: cpp
branches:
  only:
    - master
    - coverity_scan
    - /openmw-.*$/
    - /^[0-9]+\.[0-9]+\.[0-9]+.*$/
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: "1QK0yVyoOB+gf2I7XzvhXu9w/5lq4stBXIwJbVCTjz4Q4XVHCosURaW1MAgKzMrPnbFEwjyn5uQ8BwsvvfkuN1AZD0YXITgc7gyI+J1wQ/p/ljxRxglakU6WEgsTs2J5z9UmGac4YTXg+quK7YP3rv+zuGim2I2rhzImejyzp0Ym3kRCnNcy+SGBsiRaevRJMe00Ch8zGAbEhduQGeSoS6W0rcu02DNlQKiq5NktWsXR+TWWWVfIeIlQR/lbPsCd0pdxMaMv2QCY0rVbwrYxWJwr/Qe45dAdWp+8/C3PbXpeMSGxlLa33nJNX4Lf/djxbjm8KWk6edaXPajrjR/0iwcpwq0jg2Jt6XfEdnJt35F1gpXlc04sxStjG45uloOKCFYT0wdhIO1Lq+hDP54wypQl+JInd5qC001O7pwhVxO36EgKWqo8HD+BqGDBwsNj2engy9Qcp3wO6G0rLBPB3CrZsk9wrHVv5cSiQSLMhId3Xviu3ZI2qEDA+kgTvxrKrsnMj4bILVCyG5Ka2Mj22wIDW9e8oIab9oTdujax3DTN1GkD6QuOAGzwDsNwGASsgfoeZ+FUhgM75RlBWGMilgkmnF7EJ0oAXLEpjtABnEr2d4qHv+y08kOuTDBLB9ExzCIj024dYYYNLZrqPKx0ncHuCMG2QNj2aJAJEZtj1rQ="
cache: ccache
addons:
  apt:
    sources:
      - sourceline: 'ppa:openmw/openmw'
      - ubuntu-toolchain-r-test
    packages: [
      # Dev
      cmake, clang-tools-7, gcc-8, g++-8, ccache,
      # Boost
      libboost-filesystem-dev, libboost-iostreams-dev, libboost-program-options-dev, libboost-system-dev,
      # FFmpeg
      libavcodec-dev, libavformat-dev, libavutil-dev, libswresample-dev, libswscale-dev,
      # Audio, Video and Misc. deps
      libsdl2-dev, libqt5opengl5-dev, libopenal-dev, libunshield-dev, libtinyxml-dev, liblz4-dev,
      # The other ones from OpenMW ppa
      libbullet-dev, libopenscenegraph-3.4-dev, libmygui-dev,
      # tes3mp stuff
      libboost-dev, libqt5opengl5-dev, libluajit-5.1-dev
    ]
  coverity_scan:
    project:
      name: "TES3MP/openmw-tes3mp"
      description: "<Your project description here>"
    branch_pattern: coverity_scan
    notification_email: koncord@tes3mp.com
    build_command_prepend: "cov-configure --comptype gcc --compiler gcc-8 --template; cmake . -DBUILD_UNITTESTS=FALSE -DBUILD_OPENCS=FALSE -DBUILD_BSATOOL=FALSE -DBUILD_ESMTOOL=FALSE -DBUILD_MWINIIMPORTER=FALSE -DBUILD_LAUNCHER=FALSE"
    build_command: "make VERBOSE=1 -j3"
matrix:
  include:
    - os: linux
      env:
        - ANALYZE="scan-build-7 --use-cc clang-7 --use-c++ clang++-7 "
        - MATRIX_CC="CC=clang-7 && CXX=clang++-7"
      compiler: clang
      sudo: required
      dist: bionic
    - os: linux
      env:
        - MATRIX_CC="CC=gcc-8 && CXX=g++-8"
      sudo: required
      dist: bionic
    - os: linux
      env:
        - MATRIX_CC="CC=clang-7 && CXX=clang++-7"
      sudo: required
      dist: bionic
  allow_failures:
    - env:
        - MATRIX_CC="CC=clang-7 && CXX=clang++-7"
    - env:
        - ANALYZE="scan-build-7 --use-cc clang-7 --use-c++ clang++-7 "
        - MATRIX_CC="CC=clang-7 && CXX=clang++-7"

before_install:
    - ./CI/before_install.${TRAVIS_OS_NAME}.sh
before_script:
    - ccache -z
    - ./CI/before_script.${TRAVIS_OS_NAME}.sh
script:
 - cd ./build
 - ${ANALYZE} make -j3; fi
 - if [ "${TRAVIS_OS_NAME}" = "osx" ]; then make package; fi
 - if [ "${TRAVIS_OS_NAME}" = "osx" ]; then ../CI/check_package.osx.sh; fi
 - if [ "${TRAVIS_OS_NAME}" = "linux" ] && [ "${BUILD_TESTS_ONLY}" ]; then ./openmw_test_suite; fi
 - if [ "${TRAVIS_OS_NAME}" = "linux" ]; then cd .. && ./CI/check_tabs.sh; fi
 - cd "${TRAVIS_BUILD_DIR}"
 - ccache -s
#deploy:
# provider: script
# script: ./CI/deploy.osx.sh
# skip_cleanup: true
# on:
#  branch: master
#  condition: "$TRAVIS_EVENT_TYPE = cron && $TRAVIS_OS_NAME = osx"
#  repo: TES3MP/openmw-tes3mp
#notifications:
#  email:
#    recipients:
#      - corrmage+travis-ci@gmail.com
#    on_success: change
#    on_failure: always
#  irc:
#    channels:
#      - "chat.freenode.net#openmw"
#    on_success: change
#    on_failure: always
#    use_notice: true