-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.travis.yml
114 lines (88 loc) · 3.45 KB
/
.travis.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
before_cache:
# Do not cache a few Gradle files/directories (see https://docs.travis-ci.com/user/languages/java/#Caching)
- "rm -f $HOME/.gradle/caches/modules-2/modules-2.lock"
- "rm -fr $HOME/.gradle/caches/*/plugin-resolution/"
before_install:
# Fix repositories not found
- "touch $HOME/.android/repositories.cfg"
- "yes | sdkmanager \"platforms;android-28\""
- "yes | sdkmanager \"build-tools;28.0.3\""
before_script:
- "chmod +x ./gradlew"
cache:
directories:
# Android SDK
- $HOME/.m2
- $HOME/android-sdk-dl
- $HOME/android-sdk
# Gradle dependencies
- $HOME/.gradle/caches/
- $HOME/.gradle/wrapper/
# Android build cache (see http://tools.android.com/tech-docs/build-cache)
- $HOME/.android/build-cache
# Sonar cache
- $HOME/.sonar/cache
dist: trusty
env:
global:
- ANDROID_ABI=armeabi-v7a
- ANDROID_TAG=google_apis
- ANDROID_TARGET_SDK=28
- EMULATOR_API=24
- ADB_INSTALL_TIMEOUT=5
# Only clone the most recent commit.
git:
depth: 1
jdk: oraclejdk8
jobs:
include:
# Only run development debug variant, to speed up build process
- name: "Unit test devevlopment debug variant"
script: "./gradlew testDevelopmentDebug"
stage: "Unit Test"
- name: "Instrumentation tests with emulator API 16"
addons:
sonarcloud:
organization: "mochadwi-github"
token:
secure: $SONAR_TOKEN # encrypted value of your token
after_success:
- "bash <(curl -s https://codecov.io/bash)"
before_install:
# Fix repositories not found
- "touch $HOME/.android/repositories.cfg"
# Install SDK license so Android Gradle plugin can install deps.
- mkdir "$ANDROID_HOME/licenses" || true
- echo "d56f5187479451eabf01fb78af6dfcb131a6481e" > "$ANDROID_HOME/licenses/android-sdk-license"
- echo "24333f8a63b6825ea9c5514f83c2829b004d1fee" >> "$ANDROID_HOME/licenses/android-sdk-license"
# Install the rest of tools (e.g., avdmanager)
- sdkmanager tools
# Install the system image
- yes | sdkmanager "system-images;android-$EMULATOR_API;default;armeabi-v7a"
- avdmanager list targets | grep -E '^id:' | awk -F '"' '{$1=""; print $2}' # list all targets
# Create and start emulator for the script. Meant to race the install task.
- echo no | avdmanager create avd --force -n test -k "system-images;android-$EMULATOR_API;default;armeabi-v7a"
- $ANDROID_HOME/emulator/emulator -avd test -no-audio -no-skin -netfast -no-window &
before_script:
- android-wait-for-emulator
- "adb shell input keyevent 82 &"
- "adb shell setprop dalvik.vm.dexopt-flags v=n,o=v"
- adb wait-for-device get-serialno
script:
- "./gradlew mergedJacocoReport assembleDevelopmentDebug assembleDevelopmentDebugAndroidTest -PdisablePreDex"
- "./gradlew connectedDevelopmentDebugAndroidTest"
# todo fix sonar-scanner sonar-project.properties to use gradle style instead
# - sonar-scanner
stage: "UI Test"
# todo upload to fabric `crashlyticsUploadDistributionDevelopment` or playstore publishDevelopment
# e.g: ./gradlew --no-daemon --parallel --stacktrace clean assembleDevelopmentDebug
- name: "Deploy to play store"
script: "./gradlew clean"
stage: deploy
language: android
stages:
- "Unit Test"
- "UI Test"
- if: "branch = master"
name: deploy
sudo: false