From 51ed0f9625b42e55d5ac686e580ef55807617d28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Mart=C3=AD?= <mvdan@mvdan.cc> Date: Wed, 9 Sep 2015 17:30:05 -0700 Subject: [PATCH 1/4] CI: Run tests on a 4.4 emulator too --- .gitlab-ci.yml | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 14e5dcafb..a504d6bd9 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -16,8 +16,9 @@ before_script: - echo y | android -s update sdk --no-ui -a -t platform-tools,tools,build-tools-23.0.1,android-22,extra-android-m2repository - export PATH="$ANDROID_HOME/platform-tools:$PATH" - export PATH="$ANDROID_HOME/build-tools/23.0.1:$PATH" - - echo " == Installing emulator system images" - - echo y | android -s update sdk --no-ui -a -t android-10 + - echo " == Installing Android emulator images" + - echo y | android -s update sdk --no-ui -a -t android-10,android-19 + - echo y | android -s update sdk --no-ui -a -t sys-img-armeabi-v7a-android-19 - echo " == Installing Gradle" - wget -q -O gradle.zip https://services.gradle.org/distributions/gradle-2.4-bin.zip - unzip -q gradle.zip @@ -27,12 +28,21 @@ test: script: - echo " == Building via gradle" - gradle build - - echo " == Setting up Android 2.3.7 emulator" + - echo " == Creating Android 2.3.7 emulator" - echo no | android create avd --force -n fcl-test -t android-10 -b armeabi - echo " == Starting Android 2.3.7 emulator" - emulator -force-32bit -avd fcl-test -no-skin -no-audio -no-window & - ./F-Droid/tools/wait-for-emulator - - echo " == Running Android tests" + - echo " == Running Android tests on the 2.3.7 emulator" - gradle connectedCheck - echo " == Stopping Android 2.3.7 emulator" - kill $! + - echo " == Creating Android 4.4.4 emulator" + - echo no | android create avd --force -n fcl-test -t android-19 -b armeabi-v7a + - echo " == Starting Android 4.4.4 emulator" + - emulator -force-32bit -avd fcl-test -no-skin -no-audio -no-window & + - ./F-Droid/tools/wait-for-emulator + - echo " == Running Android tests on the 4.4.4 emulator" + - gradle connectedCheck + - echo " == Stopping Android 4.4.4 emulator" + - kill $! From de4198efaf899c0996c4f7d614bfb442ace07efc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Mart=C3=AD?= <mvdan@mvdan.cc> Date: Wed, 9 Sep 2015 18:57:03 -0700 Subject: [PATCH 2/4] CI: Increase adb install timeouts It sometimes fails with the default (2 minutes), especially on the 4.4 emulator. Increase to 8 minutes. --- .gitlab-ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index a504d6bd9..1328dd993 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -34,7 +34,7 @@ test: - emulator -force-32bit -avd fcl-test -no-skin -no-audio -no-window & - ./F-Droid/tools/wait-for-emulator - echo " == Running Android tests on the 2.3.7 emulator" - - gradle connectedCheck + - ADB_INSTALL_TIMEOUT=8 gradle connectedCheck - echo " == Stopping Android 2.3.7 emulator" - kill $! - echo " == Creating Android 4.4.4 emulator" @@ -43,6 +43,6 @@ test: - emulator -force-32bit -avd fcl-test -no-skin -no-audio -no-window & - ./F-Droid/tools/wait-for-emulator - echo " == Running Android tests on the 4.4.4 emulator" - - gradle connectedCheck + - ADB_INSTALL_TIMEOUT=8 gradle connectedCheck - echo " == Stopping Android 4.4.4 emulator" - kill $! From e3400006a9943b9d4ef286cb64860835d6acc7a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Mart=C3=AD?= <mvdan@mvdan.cc> Date: Wed, 9 Sep 2015 21:16:09 -0700 Subject: [PATCH 3/4] CI: test adb before running connected checks --- .gitlab-ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 1328dd993..261fd2e6d 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -33,6 +33,7 @@ test: - echo " == Starting Android 2.3.7 emulator" - emulator -force-32bit -avd fcl-test -no-skin -no-audio -no-window & - ./F-Droid/tools/wait-for-emulator + - adb shell input keyevent 82 - echo " == Running Android tests on the 2.3.7 emulator" - ADB_INSTALL_TIMEOUT=8 gradle connectedCheck - echo " == Stopping Android 2.3.7 emulator" @@ -42,6 +43,7 @@ test: - echo " == Starting Android 4.4.4 emulator" - emulator -force-32bit -avd fcl-test -no-skin -no-audio -no-window & - ./F-Droid/tools/wait-for-emulator + - adb shell input keyevent 82 - echo " == Running Android tests on the 4.4.4 emulator" - ADB_INSTALL_TIMEOUT=8 gradle connectedCheck - echo " == Stopping Android 4.4.4 emulator" From 3fe1893336847398b199caaa04b4083d0e02712f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Mart=C3=AD?= <mvdan@mvdan.cc> Date: Wed, 9 Sep 2015 21:47:15 -0700 Subject: [PATCH 4/4] CI: 4.4 says it's ready before it actually is Its boot animation is "stopped" but on my laptop the CPU is still at 100%, which means it's probably still working and not ready yet. The tests fail if you run them right after wait-for-emulator is done. If you wait a few seconds though, they do work since the CPU load drops. Until we can figure out a better solution, have a generous 30-second sleep after it tells us it's ready. --- .gitlab-ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 261fd2e6d..d16707a4e 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -44,6 +44,7 @@ test: - emulator -force-32bit -avd fcl-test -no-skin -no-audio -no-window & - ./F-Droid/tools/wait-for-emulator - adb shell input keyevent 82 + - sleep 30 # 4.4 says it's ready before it actually is - echo " == Running Android tests on the 4.4.4 emulator" - ADB_INSTALL_TIMEOUT=8 gradle connectedCheck - echo " == Stopping Android 4.4.4 emulator"