os: linux
dist: xenial
language: android
jdk: oraclejdk8
env:
  global:
    - ANDROID_API=30
    - ANDROID_BUILD_TOOLS=30.0.3
    - secure: eY3bGKw4jZ+HHkkMBZHiL2dhcz+RJYHib0WC77SSVHLJcCg63pBvs420i4rjNQHycMs+PhRSlR79jdglDTm8svphhRjSts6VMkHDxObwJIyLF8vAZ0PfjhqfOXO+4+Fx6pRIjwM7cBMOQrDfSimJHRB+z/f2AJfUIsaMSlltGVya7nmrLY/fO4dtl4wPnejslj3mhnBAxr+a2Or978RwI2TMpxBovHZKFT/46wJTcMzKXGdXU64M8nmQmpcKHeIKIBiR4g+A2tahC+Us4tFxxoTDd3R+IAzj7Gvjd5JuMlYmQ3quRv2M08u9OJNiT14LpDXy19fZKdw/QNHg3S8JVis8kJDkv6z4HyZXTIBgISZpCZZti04GP29Lj+1f4ISRFc6uxankDuRgfX8ucsxoEPJVq3PfJlpTdP7wjlQtEGv0HF/3MNNyruNbLHFiCgHOANwEOX44INtw6XylPEftmw4y4ptntFG3VXyV1Zi+732Qe4b2QNTbvLPrsmkCRKzo59vKKAzBBhvYvFVITcWbySqdx9/n1H25SRL2Q96nPGQSQyBF6obzzFcjMKkknPle1PXvAfb171964cdIK6/zo9rh/ZCL3+gAKZibmGWvbeztWYl5ON8B8x8mgLO/qgPIotY+aqwmsY06pKrqi6adYZacMF+UgtbLJlhnird6ugk=
    - secure: EmcSyXk/5pEJhbRX9DSFzhQGYvGaYdxjDuQwmLuxUGitGpFQZbWexTAK/l0LLcIRsiSmucY7KJgOpL7I6odh2kVUZedarj8/5K1P69ljDDB7bfG8jyOLZvHJ1JTZRuKvUnT846zQwQWTnLXF9N4LaQ86FVqSW2bGHqptIivEjDEVh78V3g4PDsbX5aQ5LjTlSn7bezu9chpVS0fnRlqjAa6U2kUwUt+DDaSHEOs35Z89jT7JoonGFrMsyA7S26CQhOBYE3w76AllIea+MWzPJX3V364ZIzPBnQAkCz02oVI3n+LHZkzUCYHkY8DXWXNy6+/sulFa6L1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lock
  - rm -rf $HOME/.gradle/caches/*/plugin-resolution/
cache:
  directories:
    - "$HOME/.gradle/caches/"
    - "$HOME/.gradle/wrapper/"
    - "$HOME/.android/build-cache"
before_install:
  - 'if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then bash ./.travis/run_on_non_pull_requests.sh; fi'
  - yes | sdkmanager "build-tools;${ANDROID_BUILD_TOOLS}"
  - yes | sdkmanager "platform-tools"
  - yes | sdkmanager "tools"
  - yes | sdkmanager "platforms;android-${ANDROID_API}"
  - yes | sdkmanager "extras;android;m2repository"
  - yes | sdkmanager --list
  - chmod +x gradlew
script:
  - "./gradlew clean test build connectedCheck -Pbuild=prod"
after_failure: cat $TRAVIS_BUILD_DIR/SWADroid/build/reports/lint-results.xml
before_deploy:
  - 'if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then bash ./.travis/run_on_before_deploy.sh; fi'
  - "cd $TRAVIS_BUILD_DIR/SWADroid/build/outputs/apk/prod"
  - "${ANDROID_HOME}/build-tools/${ANDROID_BUILD_TOOLS}/apksigner sign --ks ${TRAVIS_BUILD_DIR}/keystore.jks --ks-pass pass:$storepass --key-pass pass:$keypass --out SWADroid-release.apk SWADroid-prod-unsigned.apk"
  - "${ANDROID_HOME}/build-tools/${ANDROID_BUILD_TOOLS}/apksigner verify SWADroid-release.apk"
deploy:
  provider: releases
  token:
    secure: "IzDdPlY0KyCF1TUdUUeYYU/vBCNmJpxZ/w3B7QeVd1BhyL947jiyJpdEckJhMB7z4MWt5IHRGOXU2pYGxoJC86ES/33Acn91eo22FuaeRmIwjxL9yczae5KmakrSUA8iDjubfjLeWRy/MXAIGJ9qAuLOreAe/xGEoAILCxlJMjANw0AuJG+dBabBc2pt67bjaJO4WNFCkfDK9AC8XGJPXlwWB4L1IDwPQLBWEVRyhf3Ac1Om0lzf7kF240xCcR/cmLqOXArU8iRr3n30HaRQOBibCMjnds7etA+Fs1HiyB8B5gqMXpUM02hI35R9GHOrgqO/+N5lNMdDveLjLhwjPXrkIoWrzI/QifXxnnpa/bCqo4knjy7B8CGAZ5Z3w9Hq/zN2YAkLUIMyl9z1b2LzN9pzAh5SrtuRCBJKUfB7I/qv+wEVj8vrFrZDnMuQntAfBtKu6bD0L/lupkKD31L1i3G9bG3vSaaGauQGqi2/ORyPtLVhgH7LQI7gMzghi2DP1BhgrJCUHK4O7dky0klr0spfEiOLKhZQhzVosjXySh2CLzo/pqkCzWCjr6ozvzyc2VTxh5EvheJvw1gxl5eGlTDzCIu4U9ebQ5X5jXm7uec2c9tn9IYxBjASC7ay9x6UuM7khdbqg4RQ0JLo/6032ZIkxuloZMGF8P1jzHHCtko="
  file: "$TRAVIS_BUILD_DIR/SWADroid/build/outputs/apk/prod/SWADroid-release.apk"
  cleanup: false
  skip_cleanup: true
  name: SWADroid $TRAVIS_TAG
  release_notes: Automated release from Travis CI.
  target_commitish: "$TRAVIS_COMMIT"
  on:
    tags: true
    repo: Amab/SWADroid
    branch: master
notifications:
  slack:
    secure: FDRqQsWyWvSg3uXYV1jtxh209yYdE9wqMRx2Jmf9ivRMowSDqAfLaOD8hlAjD/DnBCBhVpSkOzT4+treByU1qpLXcWBpewl1GukK3jD6AoqD4Xtmp3xOAJsG1BvqeYp48Q95lZFgZ8WxV2IXO4/rAi3GcCDKVYGs3fEEwk/aVEfFDyHE7oT+mruZqrFHbwcPbObTucJWjFLu+VdCSdJ6HTN/gm/04TVg5ox0fqeyxqyAxW3QOEu/2EUOZ78ijrab7+Cn32KluoTlTDJY0+iSszYQll08+g2LsJruyzqWJzp8y0jZMs23e63ge16WrnzCHknTFIUXNG8/OVwCb2gsBA+RIchqEWLiKuOPtkSTZoMCqulDPYVOdGBJbv1CdJW4TKNmnLfsA9EMHlcv+50zcz7rq9115i4qPsous0gKw8Bc+tSL3S28YP81J8UmvTeQjAPgC7iQIeXHNvPpM62hP2v/sK9BUhmsfrFopeQGPVY5vLKXvAF+dJHuyUNK1T17iVyxa55D9Et6QeHqLsHgLKUx22RW128a0FuaFwD1EIKNuj0q+Fn8DNcXtyHoKVdGCD/K3nbDPwx+IsIvHTJfPwDL/cX8eXj+ggK32nuJVQwXLDMloz3xFKe+wO19/7kMzyKQD4Brq4xX2qQ3fiE5uRj6BIxJ2q8wuey3uuJMPVA=
