language: cpp
os:
  - linux
  - osx
compiler:
  - gcc
#  - clang

branches:
  only:
    - master
    - coverity_scan

#notifications:
#  email:
#    recipients:
#      - boinc_cvs@ssl.berkeley.edu
#    on_success: always
#    on_failure: always

# Use Trusty image and enable sudo to install apt dependencies
dist: trusty
sudo: required

cache:
  directories:
  - 3rdParty/buildCache

addons:
  coverity_scan:
    project:
      name: "BOINC/boinc"
      description: "Build submitted via Travis CI"
    notification_email: christian.beer@posteo.de
    build_command_prepend: "./configure --enable-apps"
    build_command:   "make -j 4"
    branch_pattern: coverity_scan

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: "Rd++Hyurnwd/tvjH0PX2seO3QUZ6WOf8bSB2ZkKPfZCU6+tXVMvloyog6Mlc7vl0m3WFAzw24MDtNLFBUktRsVXOkqDup1s6PdkwwcwG+5wAnydN+kXF9PcqKyOi0xJvl48Wji+r92Y9SCLzPnQGjZg70xHET22bDZHt2FsjP80="
  matrix:
    - BOINC_TYPE=libs
    - BOINC_TYPE=server
    - BOINC_TYPE=client
    - BOINC_TYPE=apps
    - BOINC_TYPE=manager
    - BOINC_TYPE=libs-mingw
    - BOINC_TYPE=apps-mingw
    #- BOINC_TYPE=coverity

matrix:
  fast_finish: true
  exclude:
# the osx build currently builds everything in one go
  - os: osx
    env: BOINC_TYPE=libs
  - os: osx
    env: BOINC_TYPE=server
  - os: osx
    env: BOINC_TYPE=client
  - os: osx
    env: BOINC_TYPE=apps
  - os: osx
    env: BOINC_TYPE=libs-mingw
  - os: osx
    env: BOINC_TYPE=apps-mingw

before_install:
   - if [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then ( sudo apt-get -qq update ) fi
   - if [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then ( sudo apt-get install freeglut3-dev libxmu-dev libxi-dev libfcgi-dev libxss-dev libnotify-dev libxcb-util0-dev libsqlite3-dev libgtk2.0-dev libwebkitgtk-dev mingw-w64 binutils-mingw-w64-i686 binutils-mingw-w64-x86-64 gcc-mingw-w64 gcc-mingw-w64-i686 gcc-mingw-w64-x86-64 g++-mingw-w64 g++-mingw-w64-i686 g++-mingw-w64-x86-64 ) fi

before_script:
- if [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then ( ./_autosetup ) fi

script:
- if [[ "${BOINC_TYPE}" == "libs" ]]; then ( ./configure --disable-server --disable-client --disable-manager && make ) fi
- if [[ "${BOINC_TYPE}" == "server" ]]; then ( ./configure --disable-client --disable-manager && make ) fi
- if [[ "${BOINC_TYPE}" == "client" ]]; then ( ./configure --disable-server --disable-manager && make ) fi
- if [[ "${BOINC_TYPE}" == "apps" ]]; then ( ./configure --enable-apps --disable-server --disable-client --disable-manager && make ) fi
- if [[ "${BOINC_TYPE}" == "manager" && "${TRAVIS_OS_NAME}" == "linux" ]]; then ( ./3rdParty/buildLinuxDependencies.sh && ./configure --disable-server --disable-client --with-wx-prefix=${TRAVIS_BUILD_DIR}/3rdParty/buildCache/linux && make ) fi
- if [[ "${BOINC_TYPE}" == "manager" && "${TRAVIS_OS_NAME}" == "linux" ]]; then ( make distclean && ./3rdParty/buildLinuxDependencies.sh --disable-webview --cache_dir ${TRAVIS_BUILD_DIR}/3rdParty/buildCache/linux2 && ./configure --disable-server --disable-client --with-wx-prefix=${TRAVIS_BUILD_DIR}/3rdParty/buildCache/linux2 && make ) fi
- if [[ "${BOINC_TYPE}" == "manager" && "${TRAVIS_OS_NAME}" == "osx" ]]; then ( ./3rdParty/buildMacDependencies.sh -q && ./mac_build/buildMacBOINC-CI.sh --no_shared_headers ) fi
- if [[ "${BOINC_TYPE}" == "libs-mingw" ]]; then ( cd lib && MINGW=x86_64-w64-mingw32 make -f Makefile.mingw ) fi
- if [[ "${BOINC_TYPE}" == "apps-mingw" ]]; then ( cd lib && MINGW=x86_64-w64-mingw32 make -f Makefile.mingw wrapper ) fi
