From f0fcadfaf45eda6ba6c86a2326aebbce7f3cc6b5 Mon Sep 17 00:00:00 2001 From: Torsten Grote Date: Thu, 15 Apr 2021 15:36:24 -0300 Subject: [PATCH 1/5] Also run optional bridge test with schedules --- .gitlab-ci.yml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index b2755a66b..71fa7367f 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -87,11 +87,14 @@ test_reproducible: - rm -f $GRADLE_USER_HOME/caches/modules-2/modules-2.lock - rm -fr $GRADLE_USER_HOME/caches/*/plugin-resolution/ -manual_tests: +bridge test: extends: .optional_tests - when: manual - except: - - tags + rules: + - if: '$CI_PIPELINE_SOURCE == "schedule"' + allow_failure: true + - if: '$CI_COMMIT_TAG == null' + when: manual + allow_failure: true pre_release_tests: extends: .optional_tests From 2f86bc312c404cee1aa7a6593afab804890d9176 Mon Sep 17 00:00:00 2001 From: Torsten Grote Date: Thu, 15 Apr 2021 15:38:34 -0300 Subject: [PATCH 2/5] Catch UnableToTakeScreenshotException to make CI more stable --- .../java/org/briarproject/briar/android/ScreenshotTest.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/briar-android/src/androidTestScreenshot/java/org/briarproject/briar/android/ScreenshotTest.java b/briar-android/src/androidTestScreenshot/java/org/briarproject/briar/android/ScreenshotTest.java index 61c0a5bbd..99798ae5b 100644 --- a/briar-android/src/androidTestScreenshot/java/org/briarproject/briar/android/ScreenshotTest.java +++ b/briar-android/src/androidTestScreenshot/java/org/briarproject/briar/android/ScreenshotTest.java @@ -3,6 +3,8 @@ package org.briarproject.briar.android; import android.app.Activity; import android.util.Log; +import com.jraska.falcon.Falcon.UnableToTakeScreenshotException; + import org.briarproject.bramble.api.connection.ConnectionRegistry; import org.briarproject.bramble.api.system.Clock; import org.briarproject.briar.api.test.TestDataCreator; @@ -34,6 +36,8 @@ public abstract class ScreenshotTest extends UiTest { protected void screenshot(String name, Activity activity) { try { Screengrab.screenshot(name, new FalconScreenshotStrategy(activity)); + } catch (UnableToTakeScreenshotException e) { + Log.e("Screengrab", "Error taking screenshot", e); } catch (RuntimeException e) { if (e.getMessage() == null || !e.getMessage().equals("Unable to capture screenshot.")) From 5a3a12767ce003933f860d6062341bc5fdb39273 Mon Sep 17 00:00:00 2001 From: Torsten Grote Date: Thu, 15 Apr 2021 15:39:32 -0300 Subject: [PATCH 3/5] Increase SetupActivity timeout in PromoVideoTest as the current one doesn't seem to be sufficient --- .../java/org/briarproject/briar/android/PromoVideoTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/briar-android/src/androidTestScreenshot/java/org/briarproject/briar/android/PromoVideoTest.java b/briar-android/src/androidTestScreenshot/java/org/briarproject/briar/android/PromoVideoTest.java index 7e9d6f430..6b808c5d1 100644 --- a/briar-android/src/androidTestScreenshot/java/org/briarproject/briar/android/PromoVideoTest.java +++ b/briar-android/src/androidTestScreenshot/java/org/briarproject/briar/android/PromoVideoTest.java @@ -87,7 +87,7 @@ public class PromoVideoTest extends ScreenshotTest { // It takes a long time for SetupActivity to start after the splash, // (because it is shown longer for videos), so increase timeout. - if (!isFilming) waitFor(SetupActivity.class, 20_000); + if (!isFilming) waitFor(SetupActivity.class, 30_000); // Note: We use waiting code only when not filming, // to make the test reliable for CI. Otherwise, we used fixed From 67bd065bc384418c7314b79ce94ef0db4978ac6b Mon Sep 17 00:00:00 2001 From: Torsten Grote Date: Thu, 15 Apr 2021 15:54:46 -0300 Subject: [PATCH 4/5] Allow manual emulator tests in all situations --- .gitlab-ci.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 71fa7367f..85313abcd 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -48,15 +48,12 @@ android test: when: on_failure rules: - if: '$CI_PIPELINE_SOURCE == "schedule"' - - if: '$CI_PIPELINE_SOURCE == "merge_request_event"' - changes: + - changes: - briar-android/**/* when: manual allow_failure: true retry: max: 1 - when: - - script_failure tags: - kvm From f7a957150eb121a3ee5be9755e08b3704e60fa53 Mon Sep 17 00:00:00 2001 From: Torsten Grote Date: Mon, 19 Apr 2021 10:50:42 -0300 Subject: [PATCH 5/5] Tweak CI rules for optional tests so they are not needed for merge requests --- .gitlab-ci.yml | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 85313abcd..2163f5717 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -25,6 +25,10 @@ test: script: - ./gradlew --no-daemon -Djava.security.egd=file:/dev/urandom animalSnifferMain animalSnifferTest - ./gradlew --no-daemon -Djava.security.egd=file:/dev/urandom check + rules: + - if: '$CI_PIPELINE_SOURCE == "merge_request_event"' + when: always + - when: always android test: extends: .base-test @@ -48,10 +52,15 @@ android test: when: on_failure rules: - if: '$CI_PIPELINE_SOURCE == "schedule"' - - changes: + when: on_success + - if: '$CI_PIPELINE_SOURCE == "merge_request_event"' + changes: - briar-android/**/* when: manual allow_failure: true + - if: '$CI_COMMIT_TAG == null' + when: manual + allow_failure: true retry: max: 1 tags: @@ -88,6 +97,7 @@ bridge test: extends: .optional_tests rules: - if: '$CI_PIPELINE_SOURCE == "schedule"' + when: on_success allow_failure: true - if: '$CI_COMMIT_TAG == null' when: manual