language: cpp
sudo: required
dist: xenial
os:
  - linux
  - osx
compiler:
  - gcc
  - clang
env:
  global:
  - WARN_AS_ERROR=1
    #- MAKEFLAGS="-s"
  - REALM_SYNTHETIC_CORE_MAP=""
  - REALM_BACKTRACE=1
  - TEST_FUZZER=0
  - SHORT=1
  matrix:
  - CXXFLAGS="-std=c++11" DEBUG=0 USE_CMAKE=1 TEST_REGENT=0 TEST_CTEST=1
  - CXXFLAGS="-std=c++11" DEBUG=0 TEST_LEGION_CXX=0 TEST_REALM=0 REGENT_JOBS=4
  - CXXFLAGS="-std=c++11" DEBUG=1 PRIVILEGE_CHECKS=1 BOUNDS_CHECKS=1 TEST_REGENT=0
  - CXXFLAGS="-std=c++11" DEBUG=1 USE_SPY=1 TEST_LEGION_CXX=0 TEST_REALM=0 REGENT_INCREMENTAL=1
    #- CXXFLAGS="-std=c++11" USE_GASNET=1 USE_HDF=1 USE_CMAKE=1 TEST_REGENT=0
  - CXXFLAGS="-std=c++11" DEBUG=1 USE_HDF=1 TEST_REGENT=0
  - CXXFLAGS="-std=c++11" DEBUG=0 TEST_REGENT=0
matrix:
  exclude:
    - os: osx
      compiler: gcc
    - os: osx
      env: CXXFLAGS="-std=c++11" DEBUG=0 TEST_LEGION_CXX=0 TEST_REALM=0 REGENT_JOBS=4
    - os: osx
      env: CXXFLAGS="-std=c++11" DEBUG=1 USE_SPY=1 TEST_LEGION_CXX=0 TEST_REALM=0 REGENT_INCREMENTAL=1
# blacklist some branches
branches:
  only:
    - stable
    - master
    - travis_debug
before_install:
  - export THREADS=2
  - |
    if [[ "$(uname)" = "Linux" ]]; then
      sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y
      sudo add-apt-repository ppa:pypy/ppa -y
      sudo apt-get update -qq
      # OpenMPI packages: openmpi-bin libopenmpi-dev
      # MPICH packages: mpich libmpich-dev
      sudo apt-get install -qq clang-6.0 libclang-6.0-dev llvm-6.0-dev libedit-dev mpich libmpich-dev libblas-dev liblapack-dev libhdf5-dev pypy
      export CMAKE_PREFIX_PATH=/usr/lib/llvm-6.0:/usr/share/llvm-6.0
      export HDF_LIBNAME=hdf5_serial
    fi
  - |
    if [[ "$(uname)" = "Darwin" ]]; then
      brew update
      brew install pypy llvm@6 hdf5
      export CXX="$(brew --prefix)/opt/llvm@6/bin/clang++"
      export CMAKE_PREFIX_PATH="$(brew --prefix)/opt/llvm@6"
    fi
  - if [[ "$(uname)" = "Linux" && "$CXX" = "clang++" ]]; then export CXX="clang++-6.0" CC="clang-6.0"; fi
  - |
    if [[ "$USE_GASNET" -eq 1 ]]; then
      export CONDUIT=mpi
      export GASNET_ROOT="$PWD/gasnet/release"
      # OpenMPI:
      # export LAUNCHER="mpirun -n 2 -bind-to none -x TERRA_PATH -x INCLUDE_PATH -x LD_LIBRARY_PATH -x LG_RT_DIR"
      # MPICH:
      export LAUNCHER="mpirun -n 2"
      unset WARN_AS_ERROR
      git clone https://github.com/StanfordLegion/gasnet.git gasnet
      pushd gasnet
      make -j$THREADS
      popd
    fi
script:
  - ./test.py -j2
