From 18ff286c491f7f55f3d28683a26a1cd33953b214 Mon Sep 17 00:00:00 2001 From: Marten Gajda Date: Wed, 18 Oct 2017 14:14:35 +0200 Subject: [PATCH] Add .travis.yml. Implements #417 This also changes the version code to be based on commit count in the current branch rather than master. Apparently Travis doesn't fetch the master which caused this to fail. Since we only publish master builds this should not have any unwanted side effects. Yet we spread the version code to allow inserting version numbers if necessary. --- .travis.yml | 22 ++++++++++++++++++++++ opentasks/build.gradle | 4 ++-- 2 files changed, 24 insertions(+), 2 deletions(-) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 000000000..7e566e1c9 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,22 @@ +language: android +sudo: false + +android: + components: + - tools + - platform-tools + - build-tools-25.0.3 + - android-25 + - extra-android-m2repository + - sys-img-armeabi-v7a-android-22 + +# Emulator Management: Create, Start and Wait +before_script: + - echo no | android create avd --force -n test -t android-22 --abi armeabi-v7a + - emulator -avd test -no-audio -no-window & + - android-wait-for-emulator + - adb shell input keyevent 82 & + +script: + - android list target + - ./gradlew connectedAndroidTest \ No newline at end of file diff --git a/opentasks/build.gradle b/opentasks/build.gradle index 17f70fcd5..1df2297aa 100644 --- a/opentasks/build.gradle +++ b/opentasks/build.gradle @@ -4,7 +4,7 @@ apply plugin: 'com.android.application' def gitCommitNo = { -> def stdout = new ByteArrayOutputStream() exec { - commandLine 'git', 'rev-list', '--count', 'master' + commandLine 'git', 'rev-list', '--count', 'HEAD' standardOutput = stdout } return Integer.parseInt(stdout.toString().trim()) @@ -17,7 +17,7 @@ android { applicationId "org.dmfs.tasks" minSdkVersion MIN_SDK_VERSION.toInteger() targetSdkVersion TARGET_SDK_VERSION.toInteger() - versionCode gitCommitNo() + versionCode gitCommitNo() * 10 // spread version code to allow inserting versions if necessary versionName version } buildTypes {