-
Notifications
You must be signed in to change notification settings - Fork 1
/
circle.yml
63 lines (59 loc) · 2.66 KB
/
circle.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
general:
artifacts:
- app/build/outputs
- app/build/reports
machine:
java:
version: oraclejdk8
checkout:
post:
- git submodule sync
- git submodule update --init
# We count tags to compute a version number; make sure renamed tags
# (aka removed and re-added) do not count twice.
- git tag -l | xargs git tag -d
- git fetch --tags
dependencies:
cache_directories:
- ~/.gradle
pre:
- mkdir -p "${ANDROID_HOME?}/licenses"
# This is just a hash sum of the license agreements accepted.
# Take this text from the Android SDK directory on your machine.
- echo 8933bad161af4178b1185d1a37fbf41ea5269c55 >"${ANDROID_HOME?}/licenses/android-sdk-license"
post:
- sudo apt update; sudo apt install -y xsltproc
# For emulator. Cannot use x86 w/o HW acceleration, which is only provided by KVM.
# Keep in sync with the SDK version. To list all supported images:
# $ cd android-sdk-linux; tools/android list sdk --extended --all
# (look for a string: sys-img-XX-google_apis-YY)
# Currently, there's no image for API level 25 with ARM EABI.
- echo y | android update sdk --no-ui --all --filter android-21
- echo y | android update sdk --no-ui --all --filter sys-img-armeabi-v7a-google_apis-21
# For lint to be able to detect deprecated API.
- echo y | android update sdk --no-ui --all --filter platform-tools
test:
pre:
- echo no | android create avd --force -n test -t android-21 --abi google_apis/armeabi-v7a
# Raise memory for the emulator.
- sed -i 's/^hw.ramSize=.*/hw.ramSize=1024/' ~/.android/avd/test.avd/config.ini
# http://www.littlerobots.nl/blog/disable-android-pre-dexing-on-ci-builds/
- ./gradlew -PdisablePreDex lintNormalDebug testNormalDebugUnitTest assembleInstrumentedRelease assembleInstrumentedReleaseAndroidTest --console=plain
# Have to keep the directory for CircleCI to correctly identify the tests.
#- mkdir "${CIRCLE_TEST_REPORTS?}"/lint
#- xsltproc app/config/lint-junit.xslt app/build/outputs/lint-results-normalDebug.xml >"${CIRCLE_TEST_REPORTS?}"/lint/results.xml
- emulator -avd test -no-window:
background: true
- circle-android wait-for-boot
# Not ideal, but lets the emulator ramp up (especially slow because of google_apis).
- sleep 180s
# Unlock the screen.
- adb shell input keyevent 82
override:
- GRADLE_OPTS=-Xmx256m ./gradlew connectedInstrumentedReleaseAndroidTest --console=plain --info --stacktrace
post:
- adb logcat -d >"${CIRCLE_ARTIFACTS?}"/logcat.txt
# Kill running emulator to free up resources for e.g. Release build.
- adb -s emulator-5554 emu kill
- mv app/build/test-results "${CIRCLE_TEST_REPORTS?}"
- mv app/build/outputs/androidTest-results "${CIRCLE_TEST_REPORTS?}"