Skip to content

Commit

Permalink
[CI] Travis with Firebase App Distribution (#11)
Browse files Browse the repository at this point in the history
* Setup travis ci with Firebase App Distribution

* Encrypt google-services.json and serviceCredentialsFile.json into a tar
  • Loading branch information
CedrickFlocon authored and balloob committed Nov 3, 2019
1 parent e54311e commit 3dca2c9
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 3 deletions.
29 changes: 29 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
language: android
dist: trusty

before_install:
- openssl aes-256-cbc -K $encrypted_a039e732823a_key -iv $encrypted_a039e732823a_iv -in travis/secrets.tar.enc -out travis/secrets.tar -d
- tar xvf travis/secrets.tar
- cp travis/google-services.json app/google-services.json
- cp travis/home-assistant-mobile-apps-5fd6b9dd0fdb.json serviceCredentialsFile.json

android:
components:
- android-29
- build-tools-28.0.3

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:
- echo $TRAVIS_COMMIT_MESSAGE > CHANGES.md
- export VERSION_CODE=`git rev-list --count HEAD`
- 'if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then bash ./gradlew testReleaseUnitTest; fi'
- 'if [ "$TRAVIS_BRANCH" = "master" ]; then bash ./gradlew assembleRelease appDistributionUploadRelease; fi'
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
# :iphone: Home Assistant Companion for Android
# :iphone: Home Assistant Companion for Android [![Build Status](https://travis-ci.com/home-assistant/home-assistant-android.svg?branch=master)](https://travis-ci.com/home-assistant/home-assistant-android)
20 changes: 18 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'com.google.firebase.appdistribution'

buildscript {
repositories {
google()
}
dependencies {
classpath 'com.google.firebase:firebase-appdistribution-gradle:1.1.0'
}
}

android {
compileSdkVersion 29
Expand All @@ -9,9 +18,14 @@ android {
applicationId "io.homeassistant.android"
minSdkVersion 21
targetSdkVersion 29
versionCode 1
versionCode "${System.env.VERSION_CODE ?: 1}".toInteger()
versionName "1.0.0"
}

firebaseAppDistribution {
serviceCredentialsFile = "serviceCredentialsFile.json"
releaseNotesFile = "CHANGES.md"
}
}

dependencies {
Expand All @@ -23,3 +37,5 @@ dependencies {
implementation 'com.squareup.okhttp3:logging-interceptor:4.2.2'
implementation "com.squareup.retrofit2:converter-jackson:2.6.2"
}

apply plugin: 'com.google.gms.google-services'
1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ buildscript {
dependencies {
classpath 'com.android.tools.build:gradle:3.5.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:4.3.2'
}
}

Expand Down
Binary file added travis/secrets.tar.enc
Binary file not shown.

0 comments on commit 3dca2c9

Please sign in to comment.