language: android
dist: trusty # For oracleJDK fail errors, as per advice from https://travis-ci.community/t/error-installing-oraclejdk8-expected-feature-release-number-in-range-of-9-to-14-but-got-8/3766/6


jdk:
  - oraclejdk8

android:
  components:
    - build-tools-29.0.2 # The BuildTools version used by the project
    - android-29 # The SDK version used to compile the project

before_install:
 - chmod +x gradlew

before_cache:
  - rm -f  $HOME/.gradle/caches/modules-2/modules-2.lock
  - rm -fr $HOME/.gradle/caches/*/plugin-resolution/
  
cache:
  directories:
    - $HOME/.gradle/caches/
    - $HOME/.gradle/wrapper/
    - $HOME/.android/build-cache

script:
- ./gradlew check
- ./gradlew tests:test  
- if [ -n "$TRAVIS_TAG" ]; then
    wget  -O jdk-windows.zip https://github.com/ojdkbuild/ojdkbuild/releases/download/java-1.8.0-openjdk-1.8.0.232-1.b09/java-1.8.0-openjdk-1.8.0.232-1.b09.ojdkbuild.windows.x86_64.zip;
    ./gradlew desktop:packrWindows32;
    ./gradlew desktop:packrWindows64;
    ./gradlew desktop:packrLinux32;
    ./gradlew desktop:packrLinux64;
    ./gradlew desktop:zipLinuxFilesForJar;
    ./gradlew android:assembleRelease;
  fi
    
deploy:
  provider: releases
  skip_cleanup: true
  draft: false
  api_key:
    secure: gx8AhuLqrQ8a5g/9/khHvWIoJ4yJ3zrVZ3G+QI2jQ7kAbRMCIGKNI4yFr/7f4pHc7SL9O5ihofcOBFO1/nLR9x1wyg7IHsXM6qTvajYqNzsQWSHX9TWvJsHOyL3bEPr/8Zy6BvX5AtIsDuF9vmKa8eLdITrHEx9MXn+MZnsHHc74EERkZjmmt1E06Lz0P4ykw8DWrMI5Gzq533LKXQa3p1XVLv68pImDBQtlgZBwZnyzIOYGEO4zqzTf5cWClrbTm/XNGioleoPGd+v3csy4DLQha+Bm7IyUcxiiMsRKXSUlR7oiz0P7yB+17jNpymnlOYjNEn8bgau4s67Kr/YjSwtPOnAInbY6T5h+TEeaZTSyg8um03YuXD3T2ZE7VNX/0yBVWf0ji2J2V0oHem24Inb5aqgIk6jNHSy4GSu0ify5Gkxa80JHHUF2411xohGPIt2saZTXx+QlSOOpIajG7lODAm0xdv1/PUMtKJRHX5VxlWXBwmIQNJ9IK4ZmON6uKYQzZeN30nal7NqGRZn/hpPbMshwBWPpBiK/kjuR5jkAu8lrWotzpc+j/WAob9afyfxADmtygGzSGXHoe0Ynw6kOmtS3bg5dj0e+dXZMc8EYfoPF7kPwGToE7jVinwLVcC6NNNUiYxCKehR2zs21B6WdIZvN4OJidL1WOkrYNDc=
  file: 
    - desktop/build/libs/Unciv.jar
    - deploy/Unciv-Linux32.zip
    - deploy/Unciv-Linux64.zip
    - deploy/Unciv-Windows32.zip
    - deploy/Unciv-Windows64.zip
    - deploy/linuxFilesForJar.zip
    - android/build/outputs/apk/release/Unciv-release-unsigned.apk
  on:
    repo: yairm210/Unciv
    tags: true

