language: cpp

git:
  submodules: true
  depth: 5

os:
  - linux
  - osx
dist: bionic
osx_image: xcode11.5

env:
  global:  # default values
    - PYTHON_VERSION=3.8
  matrix:
    - TASK=regular PYTHON_VERSION=3.6
    - TASK=sdist PYTHON_VERSION=2.7
    - TASK=bdist
    - TASK=if-else
    - TASK=lint
    - TASK=check-docs
    - TASK=mpi METHOD=source
    - TASK=mpi METHOD=pip PYTHON_VERSION=3.7
    - TASK=gpu METHOD=source PYTHON_VERSION=3.5
    - TASK=gpu METHOD=pip PYTHON_VERSION=3.6

matrix:
  exclude:
    - os: osx
      env: TASK=gpu METHOD=source PYTHON_VERSION=3.5
    - os: osx
      env: TASK=gpu METHOD=pip PYTHON_VERSION=3.6
    - os: osx
      env: TASK=lint
    - os: osx
      env: TASK=check-docs

before_install:
  - test -n $CC  && unset CC
  - test -n $CXX && unset CXX
  - export BUILD_DIRECTORY="$TRAVIS_BUILD_DIR"
  - if [[ $TRAVIS_OS_NAME == "osx" ]]; then
        export OS_NAME="macos";
        export COMPILER="gcc";
    else
        export OS_NAME="linux";
        export COMPILER="clang";
    fi
  - export CONDA="$HOME/miniconda"
  - export PATH="$CONDA/bin:$PATH"
  - export CONDA_ENV="test-env"
  - export LGB_VER=$(head -n 1 VERSION.txt)
  - export AMDAPPSDK_PATH=$HOME/AMDAPPSDK
  - export LD_LIBRARY_PATH="$AMDAPPSDK_PATH/lib/x86_64:$LD_LIBRARY_PATH"
  - export LD_LIBRARY_PATH="/usr/local/clang/lib:$LD_LIBRARY_PATH"  # fix error "libomp.so: cannot open shared object file: No such file or directory" on Linux with Clang
  - export OPENCL_VENDOR_PATH=$AMDAPPSDK_PATH/etc/OpenCL/vendors

install:
  - bash .ci/setup.sh

script:
  - bash .ci/test.sh

notifications:
  email: false
