-
Notifications
You must be signed in to change notification settings - Fork 29
/
.travis.yml
91 lines (79 loc) · 4.23 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
sudo: true
language: bash
dist: bionic
env:
global:
- ANDROID_BUILD_TOOLS=28.0.3
- ABI=x86_64
- ADB_INSTALL_TIMEOUT=5
- ANDROID_TOOLS_URL="https://dl.google.com/android/repository/sdk-tools-linux-4333796.zip"
- ANDROID_HOME=${HOME}/android-sdk
- EMU_FLAVOR=default # use google_apis flavor if no default flavor emulator
- GRAVIS="https://raw.githubusercontent.com/DanySK/Gravis-CI/master/"
- JDK="1.8"
- TOOLS=${ANDROID_HOME}/tools
- PATH=${ANDROID_HOME}:${ANDROID_HOME}/emulator:${TOOLS}:${TOOLS}/bin:${ANDROID_HOME}/platform-tools:${PATH}
- JACOCO_SOURCE_PATH="iterableapi/src/main/java iterableapi-ui/src/main/java"
- API=28
before_install:
# Set up JDK 8 for Android SDK
- curl "${GRAVIS}.install-jdk-travis.sh" --output ~/.install-jdk-travis.sh
- export TARGET_JDK="${JDK}"
- source ~/.install-jdk-travis.sh
# Set up Android SDK
- wget -q "${ANDROID_TOOLS_URL}" -O android-sdk-tools.zip
- unzip -q android-sdk-tools.zip -d ${ANDROID_HOME}
- rm android-sdk-tools.zip
- mkdir -p ~/.android
- echo 'count=0' > ~/.android/repositories.cfg # avoid harmless sdkmanager warning
- yes | sdkmanager --licenses >/dev/null # accept all sdkmanager warnings
- echo y | sdkmanager --no_https "platform-tools" >/dev/null
- echo y | sdkmanager --no_https "tools" >/dev/null # A second time per Travis docs, gets latest versions
- echo y | sdkmanager --no_https "build-tools;${ANDROID_BUILD_TOOLS}" >/dev/null # Implicit gradle dependency - gradle drives changes
- echo y | sdkmanager --no_https "platforms;android-${API}" >/dev/null # We need the API of the current compileSdkVersion from gradle.properties
install:
# Download required emulator tools
- echo y | sdkmanager --no_https "platforms;android-$API" >/dev/null # We need the API of the emulator we will run
- echo y | sdkmanager --no_https "emulator" >/dev/null
- echo y | sdkmanager --no_https "system-images;android-$API;$EMU_FLAVOR;$ABI" >/dev/null # install our emulator
# Set up KVM on linux for hardware acceleration.
- sudo -E apt-get -yq --no-install-suggests --no-install-recommends install bridge-utils libpulse0 libvirt-bin qemu-kvm virtinst ubuntu-vm-builder
- sudo adduser $USER libvirt
- sudo adduser $USER kvm
# Create an Android emulator
- echo no | avdmanager create avd --force -n test -k "system-images;android-$API;$EMU_FLAVOR;$ABI" -c 10M
- |
EMU_PARAMS="-verbose -no-snapshot -no-window -camera-back none -camera-front none -selinux permissive -qemu -m 2048"
EMU_COMMAND="emulator"
# This double "sudo" monstrosity is used to have Travis execute the
# emulator with its new group permissions and help preserve the rule
# of least privilege.
sudo -E sudo -u $USER -E bash -c "${ANDROID_HOME}/emulator/${EMU_COMMAND} -avd test ${AUDIO} ${EMU_PARAMS} &"
# Wait for emulator to be ready
- ./tools/android-wait-for-emulator.sh
- adb shell input keyevent 82 &
before_script:
- curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
- chmod +x ./cc-test-reporter
- ./cc-test-reporter before-build
script:
- touch local.properties
- ./gradlew :iterableapi:jacocoTestDebugUnitTestReport :app:jacocoDebugTestReport :iterableapi:connectedCheck :app:jacocoDebugAndroidTestReport :iterableapi:javadoc :iterableapi-ui:javadoc
after_script:
- ./cc-test-reporter format-coverage app/build/reports/jacoco/jacocoDebugTestReport/jacocoDebugTestReport.xml --input-type jacoco
- ./cc-test-reporter format-coverage iterableapi/build/reports/coverage/debug/report.xml --input-type jacoco
- ./cc-test-reporter format-coverage iterableapi/build/jacoco/jacoco.xml --input-type jacoco
- ./cc-test-reporter format-coverage app/build/reports/jacoco/jacocoDebugAndroidTestReport/jacocoDebugAndroidTestReport.xml --input-type jacoco
- ./cc-test-reporter upload-coverage
after_success:
- bash <(curl -s https://codecov.io/bash)
before_cache:
- rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
- curl "${GRAVIS}.clean_gradle_cache.sh" --output ~/.clean_gradle_cache.sh
- bash ~/.clean_gradle_cache.sh > /dev/null
cache:
directories:
- $HOME/.gradle/caches/
- $HOME/.gradle/wrapper/
- $HOME/.android/build-cache
- $HOME/android-sdk/system-images