Skip to content

Commit 0fb19ae

Browse files
committed
Merge branch 'add-repeat-arguments-for-self-hosted-e2e-tests-droid-1266'
2 parents e236c90 + 0b93056 commit 0fb19ae

File tree

1 file changed

+29
-9
lines changed

1 file changed

+29
-9
lines changed

.github/workflows/android-app.yml

+29-9
Original file line numberDiff line numberDiff line change
@@ -32,19 +32,20 @@ on:
3232
description: Override container image
3333
type: string
3434
required: false
35-
run_e2e_tests:
36-
description: Run e2e tests
37-
type: boolean
38-
required: false
3935
run_firebase_tests:
4036
description: Run firebase tests
4137
type: boolean
4238
required: false
4339
mockapi_test_repeat:
44-
description: Mockapi test repeat
40+
description: Mockapi test repeat(self hosted)
4541
default: '1'
4642
required: true
4743
type: string
44+
e2e_test_repeat:
45+
description: e2e test repeat(self hosted)
46+
default: '0'
47+
required: true
48+
type: string
4849
# Build if main is updated to ensure up-to-date caches are available
4950
push:
5051
branches: [main]
@@ -407,7 +408,6 @@ jobs:
407408
instrumented-tests:
408409
name: Run instrumented tests
409410
runs-on: [self-hosted, android-device]
410-
timeout-minutes: 30
411411
needs: [build-app, build-instrumented-tests]
412412
strategy:
413413
fail-fast: false
@@ -447,8 +447,14 @@ jobs:
447447
name: ${{ matrix.test-type }}-instrumentation-apks
448448
path: ${{ matrix.path }}
449449

450+
- name: Calculate timeout
451+
id: calculate-timeout
452+
run: echo "timeout=$(( ${{ matrix.test-repeat }} * 10 ))" >> $GITHUB_OUTPUT
453+
shell: bash
454+
450455
- name: Run instrumented test script
451456
if: ${{ matrix.test-repeat != 0 }}
457+
timeout-minutes: ${{ fromJSON(steps.calculate-timeout.outputs.timeout) }}
452458
shell: bash -ieo pipefail {0}
453459
env:
454460
AUTO_FETCH_TEST_HELPER_APKS: true
@@ -471,11 +477,15 @@ jobs:
471477
name: Run instrumented e2e tests
472478
# Temporary workaround for targeting the runner android-runner-v1
473479
runs-on: [self-hosted, android-device, android-emulator]
474-
if: github.event_name == 'schedule' || github.event.inputs.run_e2e_tests == 'true'
475-
timeout-minutes: 30
480+
if: github.event_name == 'schedule' || ${{ github.event.inputs.e2e_test_repeat }} != '0'
476481
needs: [build-app, build-instrumented-tests]
482+
strategy:
483+
matrix:
484+
include:
485+
- test-repeat: ${{ github.event.inputs.e2e_test_repeat || 1 }}
477486
steps:
478487
- name: Prepare report dir
488+
if: ${{ matrix.test-repeat != 0 }}
479489
id: prepare-report-dir
480490
env:
481491
INNER_REPORT_DIR: /tmp/${{ github.run_id }}-${{ github.run_attempt }}
@@ -484,21 +494,31 @@ jobs:
484494
echo "report_dir=$INNER_REPORT_DIR" >> $GITHUB_OUTPUT
485495
486496
- name: Checkout repository
497+
if: ${{ matrix.test-repeat != 0 }}
487498
uses: actions/checkout@v4
488499

489500
# Using v3 due to v4 being very slow for this artifact.
490501
- uses: actions/download-artifact@v3
502+
if: ${{ matrix.test-repeat != 0 }}
491503
with:
492504
name: apks
493505
path: android/app/build/outputs/apk
494506

495507
# Using v3 due to v4 being very slow for this artifact.
496508
- uses: actions/download-artifact@v3
509+
if: ${{ matrix.test-repeat != 0 }}
497510
with:
498511
name: e2e-instrumentation-apks
499512
path: android/test/e2e/build/outputs/apk
500513

514+
- name: Calculate timeout
515+
id: calculate-timeout
516+
run: echo "timeout=$(( ${{ matrix.test-repeat }} * 10 ))" >> $GITHUB_OUTPUT
517+
shell: bash
518+
501519
- name: Run instrumented test script
520+
if: ${{ matrix.test-repeat != 0 }}
521+
timeout-minutes: ${{ fromJSON(steps.calculate-timeout.outputs.timeout) }}
502522
shell: bash -ieo pipefail {0}
503523
env:
504524
AUTO_FETCH_TEST_HELPER_APKS: true
@@ -509,7 +529,7 @@ jobs:
509529
INVALID_TEST_ACCOUNT_NUMBER: '0000000000000000'
510530
ENABLE_HIGHLY_RATE_LIMITED_TESTS: ${{ github.event_name == 'schedule' && 'true' || 'false' }}
511531
REPORT_DIR: ${{ steps.prepare-report-dir.outputs.report_dir }}
512-
run: ./android/scripts/run-instrumented-tests.sh
532+
run: ./android/scripts/run-instrumented-tests-repeat.sh ${{ matrix.test-repeat }}
513533

514534
firebase-tests:
515535
name: Run firebase tests

0 commit comments

Comments
 (0)