language: c
compiler: gcc
sudo: false
env:
  global:
    - SDL_VERSION=2.0.8
    - DEPLOY_BRANCH=newengine
git:
  depth: 50
  submodules: true
jdk:
  - oraclejdk8

jobs:
  include:
    - stage: build
      name: "Build for Linux i686"
      cache: ccache
      os: linux
      dist: xenial
      addons:
        apt:
          packages:
            - gcc-multilib
            - g++-multilib
            - libx11-dev:i386
            - libxext-dev:i386
            - x11-utils
            - libgl1-mesa-dev
            - libasound-dev
            - libstdc++6:i386
            - libfuse2:i386
            - zlib1g:i386
      before_script:
        - export ARCH=i686
        - sh scripts/travis_common_deps.sh
        - sh scripts/travis_${TRAVIS_OS_NAME}_deps.sh
      script:
        - sh scripts/build_${TRAVIS_OS_NAME}_engine.sh full
        - sh scripts/build_${TRAVIS_OS_NAME}_engine.sh dedicated
      after_script:
        - ccache --show-stats
        - sh scripts/continious_upload.sh xash3d-fwgs-${ARCH}.AppImage xashds-linux-${ARCH}
    - # ...
      name: "Build for Linux amd64"
      cache: ccache
      os: linux
      dist: xenial
      addons:
        apt:
          packages:
            - libx11-dev
            - libxext-dev
            - x11-utils
            - libgl1-mesa-dev
            - libasound-dev
            - libstdc++6
            - libfuse2
      before_script:
        - export ARCH=x86_64
        - sh scripts/travis_common_deps.sh
        - sh scripts/travis_${TRAVIS_OS_NAME}_deps.sh
      script:
        - sh scripts/build_${TRAVIS_OS_NAME}_engine.sh full
        - sh scripts/build_${TRAVIS_OS_NAME}_engine.sh dedicated
      after_script:
        - ccache --show-stats
        - sh scripts/continious_upload.sh xash3d-fwgs-${ARCH}.AppImage xashds-linux-${ARCH}
    - # ...
      name: "Build for Android"
      cache: ccache
      os: linux
      dist: xenial
      language: java # we want xenial, so just java, not android
      jdk: openjdk8
      before_script:
        - export ANDROID_HOME=$TRAVIS_BUILD_DIR/sdk
        - sh scripts/travis_common_deps.sh
        - sh scripts/travis_android_deps.sh
        - export ANDROID_SDK_HOME=$ANDROID_HOME
        - export ANDROID_NDK_HOME=$ANDROID_SDK_HOME/ndk-bundle
      script:
        - cd android
        - sh compile.sh
      after_script:
        - ccache --show-stats
#        - sh scripts/continious_upload.sh xash3d-fwgs.apk
#    - # ...
#      name: "Build for Windows MinGW"
#      cache: ccache
#      os: linux
#      dist: xenial
#      addons:
#        apt:
#          packages:
#            - mingw-w64-i686-dev
#            - binutils-mingw-w64-i686
#            - gcc-mingw-w64-i686
#            - g++-mingw-w64-i686
#            - p7zip-full
#      before_script:
#        - sh scripts/travis_common_deps.sh
#        - sh scripts/travis_mingw_deps.sh
#      script:
#        - sh scripts/build_mingw_engine.sh
#      after_script:
#        - ccache --show-stats
#        - sh scripts/continious_upload.sh xash3d-mingw.7z
#    - # ...
#      name: "Build for OSX"
#      cache: ccache
#      os: osx
#      before_script:
#        - sh scripts/travis_common_deps.sh
#        - sh scripts/travis_${TRAVIS_OS_NAME}_deps.sh
#      script:
#        - sh scripts/build_${TRAVIS_OS_NAME}_engine.sh
#      after_script:
#        - sh scripts/continious_upload.sh xash3d-osx.tar.bz2
    - # ...
      name: "Build for Windows MSVC"
      cache: ccache
      os: windows
      before_script:
        - sh scripts/travis_common_deps.sh
        - sh scripts/travis_${TRAVIS_OS_NAME}_deps.sh
      script:
        - sh scripts/build_${TRAVIS_OS_NAME}_engine.sh
      after_script:
        - sh scripts/continious_upload.sh xash3d-vc.7z xash3d-vc2008-sln.7z

branches:
  except:
# Do not build tags that we create when we upload to GitHub Releases
    - /^(?i:continuous)/
