group: travis_latest
language: python
services: docker

osx_image: xcode10.1

matrix:
  include:
  - env: TASK=lint
    os: linux
    python: '3.6'
  - env: TASK=unittest_gtest
    os: linux
    python: '3.6'
  - env: TASK=cmake_test
    os: linux
    python: '3.6'
  - env: TASK=unittest_gtest
    language: ruby
    os: osx
  - env: TASK=cmake_test
    language: ruby
    os: osx
  - env: TASK=s390x_test
    os: linux
    python: '3.6'

# dependent apt packages
addons:
  apt:
    sources:
      - ubuntu-toolchain-r-test
    packages:
      - doxygen
      - wget
      - git
      - libcurl4-openssl-dev
      - unzip
      - gcc-4.8
      - g++-4.8
  homebrew:
    packages:
      - gcc@7
      - python3
    update: true

before_install:
  - export TRAVIS=scripts/travis
  - source ${TRAVIS}/travis_setup_env.sh
  - ${TRAVIS}/travis_osx_install.sh

install:
  - if [[ ${TRAVIS_OS_NAME} == "osx" ]]; then brew install python; fi
  - python3 --version ; python3 -m pip --version
  - python3 -m pip install cpplint pylint flake8
  - |
    # Set up QEMU to run s390x Docker container
    if [[ ${TASK} == "s390x_test" ]]; then
      docker run --rm --privileged multiarch/qemu-user-static:register --reset
    fi

before_script:
  # stop the build if there are Python syntax errors or undefined names
  - flake8 . --count --select=E901,E999,F821,F822,F823 --show-source --statistics
  # exit-zero treats all errors as warnings.  The GitHub editor is 127 chars wide
  - flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics

script: ${TRAVIS}/travis_script.sh

before_cache:
  - ${TRAVIS}/travis_before_cache.sh

cache:
  directories:
    - ${HOME}/.cache/usr

notifications:
# Emails are sent to the committer's git-configured email address by default,
  email:
    on_success: change
    on_failure: always
  slack: dmlc:mKX5kxjqTP6fBb89lXD3G5f3
