Merge branch 'ci-emulators' into 'master'

CI: speed up running of Android tests



See merge request !284
This commit is contained in:
Daniel Martí 2016-05-12 16:47:42 +00:00
commit e96dcd653d
2 changed files with 21 additions and 30 deletions

View File

@ -1,48 +1,39 @@
image: mvdan/fdroid-ci:client-20160429 image: mvdan/fdroid-ci:client-20160512
cache: cache:
paths: paths:
- .gradle/wrapper - .gradle/wrapper
- .gradle/caches - .gradle/caches
variables: build:
AVD_SDK: "17"
SKIN: "QVGA"
# switch glibc to a memory conserving mode
MALLOC_ARENA_MAX: "2"
gradle:
script: script:
- echo y | android update sdk --no-ui --filter android-$AVD_SDK
- echo y | android update sdk --no-ui --all --filter sys-img-armeabi-v7a-android-$AVD_SDK
- export GRADLE_USER_HOME=$PWD/.gradle - export GRADLE_USER_HOME=$PWD/.gradle
- ./gradlew assemble -PdisablePreDex
# always report on lint errors to the build log # always report on lint errors to the build log
- sed -i -e 's,textReport .*,textReport true,' app/build.gradle - sed -i -e 's,textReport .*,textReport true,' app/build.gradle
# 'build' means assemble and check - ./gradlew lint -PdisablePreDex
- ./gradlew build -PdisablePreDex || { - ./gradlew test -PdisablePreDex || {
for log in app/build/reports/*ests/*/*ml; do for log in app/build/reports/*ests/*/*ml; do
echo "read $log here:"; echo "read $log here:";
cat "$log" | curl --silent -F 'clbin=<-' https://clbin.com; cat "$log" | curl --silent -F 'clbin=<-' https://clbin.com;
done; done;
exit 1; exit 1;
} }
# emulators will only start if they have tiny amounts of RAM # this file changes every time but should not be cached
- sed -i -e 's,^hw.ramSize=.*,hw.ramSize=384,' - rm -f $GRADLE_USER_HOME/caches/modules-2/modules-2.lock
-e 's,^vm.heapSize=.*,vm.heapSize=48,'
-e 's,^hw.gpu.enabled.*,hw.gpu.enabled = false,' connectedCheck:
$ANDROID_HOME/platforms/android-$AVD_SDK/skins/$SKIN/hardware.ini variables:
- echo "hw.gpu.enabled = false" >> AVD_SDK: "17"
$ANDROID_HOME/platforms/android-$AVD_SDK/skins/$SKIN/hardware.ini # switch glibc to a memory conserving mode
- echo no | android --verbose create avd MALLOC_ARENA_MAX: "2"
--force script:
--name fcl-test - export GRADLE_USER_HOME=$PWD/.gradle
--skin $SKIN - emulator64-arm -avd fcl-test-$AVD_SDK -no-skin -no-audio -no-window &
--target android-$AVD_SDK
- emulator64-arm -avd fcl-test -no-skin -no-audio -no-window &
- ./tools/wait-for-emulator - ./tools/wait-for-emulator
- adb shell input keyevent 82 & - adb shell input keyevent 82 &
- export EXITVALUE=0 - export EXITVALUE=0
- ADB_INSTALL_TIMEOUT=8 ./gradlew connectedCheck -PdisablePreDex || { - ./gradlew connectedCheck -PdisablePreDex || {
adb -e logcat -d '*:E'; adb -e logcat -d '*:E';
echo "get the full logcat here:"; echo "get the full logcat here:";
adb -e logcat -d | curl --silent -F 'clbin=<-' https://clbin.com; adb -e logcat -d | curl --silent -F 'clbin=<-' https://clbin.com;
@ -53,7 +44,6 @@ gradle:
echo "read $log here:"; echo "read $log here:";
cat "$log" | curl --silent -F 'clbin=<-' https://clbin.com; cat "$log" | curl --silent -F 'clbin=<-' https://clbin.com;
done done
- sed -n 's/.*"ctr2">\([0-9]*\)%<.*/Coverage - \1.0% covered\n/p' app/build/reports/coverage/debug/index.html
# this file changes every time but should not be cached # this file changes every time but should not be cached
- rm -f $GRADLE_USER_HOME/caches/modules-2/modules-2.lock - rm -f $GRADLE_USER_HOME/caches/modules-2/modules-2.lock
- exit $EXITVALUE - exit $EXITVALUE
@ -62,11 +52,15 @@ pmd:
script: script:
- export GRADLE_USER_HOME=$PWD/.gradle - export GRADLE_USER_HOME=$PWD/.gradle
- ./gradlew pmd -PdisablePreDex - ./gradlew pmd -PdisablePreDex
# this file changes every time but should not be cached
- rm -f $GRADLE_USER_HOME/caches/modules-2/modules-2.lock
checkstyle: checkstyle:
script: script:
- export GRADLE_USER_HOME=$PWD/.gradle - export GRADLE_USER_HOME=$PWD/.gradle
- ./gradlew checkstyle -PdisablePreDex - ./gradlew checkstyle -PdisablePreDex
# this file changes every time but should not be cached
- rm -f $GRADLE_USER_HOME/caches/modules-2/modules-2.lock
tools: tools:
script: script:

View File

@ -139,9 +139,6 @@ android {
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
testProguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro', 'src/androidTest/proguard-rules.pro' testProguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro', 'src/androidTest/proguard-rules.pro'
} }
debug {
testCoverageEnabled = true
}
} }
compileOptions { compileOptions {