|
| 1 | +name: E2E tests - Android |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + paths: |
| 8 | + - '.github/workflows/test-e2e-android.yaml' |
| 9 | + - 'packages/react-native-legal/**/*.[tj]sx?' |
| 10 | + - 'packages/react-native-legal/android/**' |
| 11 | + - 'examples/bare-example/**/*.[tj]sx?' |
| 12 | + - 'examples/bare-example/android/**' |
| 13 | + |
| 14 | + push: |
| 15 | + branches: |
| 16 | + - main |
| 17 | + |
| 18 | + workflow_dispatch: |
| 19 | + |
| 20 | +concurrency: |
| 21 | + group: e2e_tests-android-${{ github.ref }} |
| 22 | + cancel-in-progress: true |
| 23 | + |
| 24 | +env: |
| 25 | + MAESTRO_CLI_NO_ANALYTICS: true |
| 26 | + MAESTRO_CLI_ANALYSIS_NOTIFICATION_DISABLED: true |
| 27 | + MAESTRO_DISABLE_UPDATE_CHECK: true |
| 28 | + |
| 29 | +jobs: |
| 30 | + e2e-android: |
| 31 | + runs-on: ubuntu-latest |
| 32 | + strategy: |
| 33 | + fail-fast: false |
| 34 | + matrix: |
| 35 | + api-level: [ 30, 34, 35 ] |
| 36 | + steps: |
| 37 | + - name: Enable KVM group perms |
| 38 | + run: | |
| 39 | + echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules |
| 40 | + sudo udevadm control --reload-rules |
| 41 | + sudo udevadm trigger --name-match=kvm |
| 42 | +
|
| 43 | + - name: Checkout Repo |
| 44 | + uses: actions/checkout@v4 |
| 45 | + with: |
| 46 | + fetch-depth: 0 |
| 47 | + |
| 48 | + - name: Setup |
| 49 | + uses: ./.github/actions/setup |
| 50 | + |
| 51 | + - name: Install Maestro |
| 52 | + uses: ./.github/actions/installMaestro |
| 53 | + with: |
| 54 | + target-platform: android |
| 55 | + |
| 56 | + - name: Cache Build |
| 57 | + id: cache-build |
| 58 | + uses: actions/cache@v4 |
| 59 | + env: |
| 60 | + cache-name: cached-android-build |
| 61 | + with: |
| 62 | + path: | |
| 63 | + examples/bare-example/android/build |
| 64 | + examples/bare-example/android/app/build |
| 65 | + examples/bare-example/android/app/.cxx |
| 66 | + key: bare-example-android-build |
| 67 | + |
| 68 | + - uses: actions/setup-java@v4 |
| 69 | + with: |
| 70 | + distribution: 'zulu' |
| 71 | + java-version: '17' |
| 72 | + cache: 'gradle' |
| 73 | + |
| 74 | + - name: Gradle cache |
| 75 | + uses: gradle/actions/setup-gradle@v3 |
| 76 | + |
| 77 | + - name: Install example dependencies |
| 78 | + run: yarn workspace react-native-legal-bare-example install --frozen-lockfile --immutable |
| 79 | + |
| 80 | + - name: Bundle app |
| 81 | + run: yarn workspace react-native-legal-bare-example build:android |
| 82 | + |
| 83 | + - name: Create AVD and generate snapshot for caching |
| 84 | + uses: reactivecircus/android-emulator-runner@v2 |
| 85 | + with: |
| 86 | + api-level: ${{ matrix.api-level }} |
| 87 | + arch: 'x86_64' |
| 88 | + target: 'google_apis' |
| 89 | + force-avd-creation: true |
| 90 | + emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none |
| 91 | + disable-animations: false |
| 92 | + script: ./scripts/e2e_android_emulator_build_and_test.sh |
| 93 | + |
| 94 | + - name: Upload report |
| 95 | + if: always() |
| 96 | + continue-on-error: true |
| 97 | + uses: ./.github/actions/uploadMaestroTestResults |
| 98 | + with: |
| 99 | + id: API ${{ matrix.api-level }} |
0 commit comments