language: cpp

env:
  global:
    - E2D_WITHOUT_AUDIO=true
    - E2D_WITHOUT_GRAPHICS=true

matrix:
  include:

    #
    # linux (g++-7)
    #

    - os: linux
      dist: xenial
      stage: linux
      name: debug, g++-7
      addons: { apt: { sources: ["ubuntu-toolchain-r-test"], packages: ["libx11-dev", "libgl1-mesa-dev", "xorg-dev", "g++-7"] } }
      env: CC=gcc-7 CXX=g++-7
      script: ./scripts/build_debug.sh

    - os: linux
      dist: xenial
      stage: linux
      name: release, g++-7
      addons: { apt: { sources: ["ubuntu-toolchain-r-test"], packages: ["libx11-dev", "libgl1-mesa-dev", "xorg-dev", "g++-7"] } }
      env: CC=gcc-7 CXX=g++-7
      script: ./scripts/build_release.sh

    #
    # linux (g++-8)
    #

    - os: linux
      dist: xenial
      stage: linux
      name: debug, g++-8
      addons: { apt: { sources: ["ubuntu-toolchain-r-test"], packages: ["libx11-dev", "libgl1-mesa-dev", "xorg-dev", "g++-8"] } }
      env: CC=gcc-8 CXX=g++-8
      script: ./scripts/build_debug.sh

    - os: linux
      dist: xenial
      stage: linux
      name: release, g++-8
      addons: { apt: { sources: ["ubuntu-toolchain-r-test"], packages: ["libx11-dev", "libgl1-mesa-dev", "xorg-dev", "g++-8"] } }
      env: CC=gcc-8 CXX=g++-8
      script: ./scripts/build_release.sh

    #
    # linux (clang++-5.0)
    #

    - os: linux
      dist: xenial
      stage: linux
      name: debug, clang++-5.0
      addons: { apt: { sources: ["ubuntu-toolchain-r-test", "llvm-toolchain-xenial-5.0"], packages: ["libx11-dev", "libgl1-mesa-dev", "xorg-dev", "g++-7", "clang-5.0"] } }
      env: CC=clang-5.0 CXX=clang++-5.0
      script: ./scripts/build_debug.sh

    - os: linux
      dist: xenial
      stage: linux
      name: release, clang++-5.0
      addons: { apt: { sources: ["ubuntu-toolchain-r-test", "llvm-toolchain-xenial-5.0"], packages: ["libx11-dev", "libgl1-mesa-dev", "xorg-dev", "g++-7", "clang-5.0"] } }
      env: CC=clang-5.0 CXX=clang++-5.0
      script: ./scripts/build_release.sh

    #
    # linux (clang++-6.0)
    #

    - os: linux
      dist: xenial
      stage: linux
      name: debug, clang++-6.0
      addons: { apt: { sources: ["ubuntu-toolchain-r-test", "llvm-toolchain-xenial-6.0"], packages: ["libx11-dev", "libgl1-mesa-dev", "xorg-dev", "g++-7", "clang-6.0"] } }
      env: CC=clang-6.0 CXX=clang++-6.0
      script: ./scripts/build_debug.sh

    - os: linux
      dist: xenial
      stage: linux
      name: release, clang++-6.0
      addons: { apt: { sources: ["ubuntu-toolchain-r-test", "llvm-toolchain-xenial-6.0"], packages: ["libx11-dev", "libgl1-mesa-dev", "xorg-dev", "g++-7", "clang-6.0"] } }
      env: CC=clang-6.0 CXX=clang++-6.0
      script: ./scripts/build_release.sh

    #
    # macosx (xcode10)
    #

    - os: osx
      osx_image: xcode10
      stage: macosx
      name: debug, xcode10
      addons: { homebrew: { packages: ["git-lfs"] } }
      script: ./scripts/build_debug.sh

    - os: osx
      osx_image: xcode10
      stage: macosx
      name: release, xcode10
      addons: { homebrew: { packages: ["git-lfs"] } }
      script: ./scripts/build_release.sh

    #
    # macosx (xcode11)
    #

    - os: osx
      osx_image: xcode11
      stage: macosx
      name: debug, xcode11
      addons: { homebrew: { packages: ["git-lfs"] } }
      script: ./scripts/build_debug.sh

    - os: osx
      osx_image: xcode11
      stage: macosx
      name: release, xcode11
      addons: { homebrew: { packages: ["git-lfs"] } }
      script: ./scripts/build_release.sh

    #
    # coverage
    #

    - os: osx
      osx_image: xcode10
      stage: coverage
      name: coverage, xcode10
      addons: { homebrew: { packages: ["git-lfs", "lcov"] } }
      script: ./scripts/upload_coverage.sh

before_install:
  - if [ "$TRAVIS_OS_NAME" == 'linux' ]; then
    mkdir $HOME/cmake;
    export PATH="$HOME/cmake/bin:$PATH";
    travis_retry wget -q https://cmake.org/files/v3.11/cmake-3.11.4-Linux-x86_64.sh;
    sh cmake-3.11.4-Linux-x86_64.sh --prefix=$HOME/cmake --exclude-subdir --skip-license;
    fi

before_script:
  - git submodule update --init --recursive
  - git lfs install
  - git lfs pull
