Going to start off with the .travis.yml
file and then explain it.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
language: android | |
jdk: oraclejdk7 | |
env: | |
matrix: | |
- ANDROID_TARGET=android-L ANDROID_ABI=armeabi-v7a | |
android: | |
components: | |
- build-tools-19.1 | |
before_install: | |
# Install base Android SDK | |
- sudo apt-get update -qq | |
- if [ `uname -m` = x86_64 ]; then sudo apt-get install -qq --force-yes libgd2-xpm ia32-libs ia32-libs-multiarch > /dev/null; fi | |
- wget http://dl.google.com/android/android-sdk_r23-linux.tgz | |
- tar xzf android-sdk_r23-linux.tgz | |
- export ANDROID_HOME=$PWD/android-sdk-linux | |
- export PATH=${PATH}:${ANDROID_HOME}/tools:${ANDROID_HOME}/platform-tools | |
- echo yes | android update sdk --filter platform-tools --no-ui --force > /dev/null | |
- echo yes | android update sdk --all --filter build-tools-20.0.0 --no-ui --force > /dev/null | |
- echo yes | android update sdk --filter android-20 --no-ui --force > /dev/null | |
- echo yes | android update sdk --filter sys-img-x86-android-19 --no-ui --force > /dev/null | |
- echo yes | android update sdk --filter extra-android-support --no-ui --force > /dev/null | |
- echo yes | android update sdk --filter extra-android-m2repository --no-ui --force > /dev/null | |
before_script: | |
- cp keystore.properties.example keystore.properties | |
- cp readability.properties.example readability.properties | |
- cp local.properties.example local.properties | |
script: "./gradlew clean assembleTravis" | |
deploy: | |
provider: releases | |
api_key: | |
secure: MeGKfVwOrIMT5TzI5tBhwfCH7tICedcJe0p5Cp3lyPhY26VlVJQ2HKH3yuv7OF9a6ngVWdBjxPtn2dDlWb3AqpPZDEwgzCJrYjaDlBfhk3JSdepKmhEltbcvFWyPgWGNVGWw3+EmDiDrmscKjF9kc0F06KveRziJb8JC3RBIDIk= | |
file: ${TRAVIS_BUILD_DIR}/app/build/outputs/apk/app-travis.apk | |
on: | |
repo: dinosaurwithakatana/holo_hacker_news | |
branch: material | |
tags: true | |
all_branches: true |
This was based off the configuration found here.
The reason this has to be done stems from this issue on the travis-ci project. Unfortunately, this is a temporary workaround as the travis team needs to find a way to update their images.
-
env
ANDROID_TARGET
: the source travis config usesandroid-20
, however I chose to useandroid-L
as that's what is used in thebuild.gradle
file as well.
-
before_install
: this grabs the new android sdk and updates it for use on this build -
before_script
: this is used specifically for my repository as I have specific properties for the build. -
script
: utilize the gradle wrapper which will automatically get the correct gradle binary and execute the build -
deploy
: based on the guide- I personally started this section using the travis cli tool and the command
travis setups releases
file
: use the${TRAVIS_BUILD_DIR}
env var to get the root dir and append the gradle output dir to the string, no plus sign or quotations necessary.on
: this is used for conditional deploymentstags
set to true makes sure the deployment only occurs on tags, this requires theall_branches
prop as well due to a known issue.
- I personally started this section using the travis cli tool and the command