another shot at travis

This commit is contained in:
Vincent Breitmoser 2015-06-17 04:27:56 +02:00
parent 5e77117232
commit cc793c2882
2 changed files with 40 additions and 10 deletions

View File

@ -1,5 +1,11 @@
language: android language: android
jdk: openjdk7 jdk: openjdk7
sudo: false
env:
global:
- ANDROID_API_LEVEL=21
- ANDROID_ABI=armeabi-v7a
- ADB_INSTALL_TIMEOUT=8 # minutes (2 minutes by default)
android: android:
components: components:
- build-tools-22.0.1 - build-tools-22.0.1
@ -16,14 +22,13 @@ android:
- 'android-sdk-preview-license-52d11cd2' - 'android-sdk-preview-license-52d11cd2'
- 'android-sdk-license-.+' - 'android-sdk-license-.+'
- 'google-gdk-license-.+' - 'google-gdk-license-.+'
# before_script:
# - echo no | android create avd --force -n test -t android-21 --abi armeabi-v7a
# - emulator -avd test -no-skin -no-audio -no-window &
script:
- ./gradlew
- ./gradlew testDebug
- ./gradlew jacocoTestReport coveralls
# don't run instrumentation tests for now before_script:
# - android-wait-for-emulator && adb shell input keyevent 82 & - echo no | android create avd --force -n test -t android-$ANDROID_API_LEVEL --abi $ANDROID_ABI
# - ./gradlew connectedAndroidTest - emulator -avd test -no-skin -no-audio -no-window &
- ./tools/android-wait-for-emulator
- adb shell input keyevent 82 &
script:
- ./gradlew connectedAndroidTest
- ./gradlew testDebug jacocoTestReport coveralls

25
tools/android-wait-for-emulator Executable file
View File

@ -0,0 +1,25 @@
#!/bin/bash
# Originally written by Ralf Kistner <ralf@embarkmobile.com>, but placed in the public domain
set +e
bootanim=""
failcounter=0
timeout_in_sec=720
until [[ "$bootanim" =~ "stopped" ]]; do
bootanim=`adb -e shell getprop init.svc.bootanim 2>&1 &`
if [[ "$bootanim" =~ "device not found" || "$bootanim" =~ "device offline"
|| "$bootanim" =~ "running" ]]; then
let "failcounter += 1"
echo "Waiting for emulator to start"
if [[ $failcounter -gt timeout_in_sec ]]; then
echo "Timeout ($timeout_in_sec seconds) reached; failed to start emulator"
exit 1
fi
fi
sleep 10
done
echo "Emulator is ready"