|
| 1 | +# Informational Android Maestro E2E — NOT a required PR / merge gate (#497). |
| 2 | +# Manual only (workflow_dispatch). Do not add schedule until the suite is stable. |
| 3 | +# Does not replace Needs QA? / @Roslin22 nightly handoff. |
| 4 | +name: Maestro Android (informational) |
| 5 | + |
| 6 | +on: |
| 7 | + workflow_dispatch: |
| 8 | + inputs: |
| 9 | + suite: |
| 10 | + description: Maestro suite to run |
| 11 | + type: choice |
| 12 | + required: true |
| 13 | + default: harness |
| 14 | + options: |
| 15 | + - harness |
| 16 | + - smokes |
| 17 | + - multi-account |
| 18 | + |
| 19 | +concurrency: |
| 20 | + group: maestro-android-${{ github.ref }}-${{ inputs.suite }} |
| 21 | + cancel-in-progress: true |
| 22 | + |
| 23 | +permissions: |
| 24 | + contents: read |
| 25 | + |
| 26 | +env: |
| 27 | + EXPO_PUBLIC_API_BASE_URL: https://dev.api.fluent.bible |
| 28 | + # Release APK is not __DEV__; E2E_MODE is for local Debug+Metro only. |
| 29 | + ORG_GRADLE_PROJECT_reactNativeArchitectures: x86_64 |
| 30 | + MAESTRO_VERSION: '2.10.0' |
| 31 | + |
| 32 | +jobs: |
| 33 | + maestro-android: |
| 34 | + name: Maestro ${{ inputs.suite }} |
| 35 | + runs-on: ubuntu-latest |
| 36 | + timeout-minutes: 90 |
| 37 | + |
| 38 | + steps: |
| 39 | + - name: Checkout |
| 40 | + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 |
| 41 | + with: |
| 42 | + persist-credentials: false |
| 43 | + |
| 44 | + - name: Require secrets for suite |
| 45 | + env: |
| 46 | + MAESTRO_EMAIL: ${{ secrets.MAESTRO_EMAIL }} |
| 47 | + MAESTRO_PASSWORD: ${{ secrets.MAESTRO_PASSWORD }} |
| 48 | + MAESTRO_EMAIL_2: ${{ secrets.MAESTRO_EMAIL_2 }} |
| 49 | + MAESTRO_PASSWORD_2: ${{ secrets.MAESTRO_PASSWORD_2 }} |
| 50 | + run: | |
| 51 | + set -euo pipefail |
| 52 | + suite="${{ inputs.suite }}" |
| 53 | + missing=() |
| 54 | + if [[ "${suite}" == "smokes" || "${suite}" == "multi-account" ]]; then |
| 55 | + [[ -n "${MAESTRO_EMAIL:-}" ]] || missing+=("MAESTRO_EMAIL") |
| 56 | + [[ -n "${MAESTRO_PASSWORD:-}" ]] || missing+=("MAESTRO_PASSWORD") |
| 57 | + fi |
| 58 | + if [[ "${suite}" == "multi-account" ]]; then |
| 59 | + [[ -n "${MAESTRO_EMAIL_2:-}" ]] || missing+=("MAESTRO_EMAIL_2") |
| 60 | + [[ -n "${MAESTRO_PASSWORD_2:-}" ]] || missing+=("MAESTRO_PASSWORD_2") |
| 61 | + fi |
| 62 | + if ((${#missing[@]} > 0)); then |
| 63 | + echo "::error::Missing repository secrets for suite=${suite}: ${missing[*]}" |
| 64 | + echo "Configure secrets listed in docs/guides/maestro.md / .github/README.md (#497)." |
| 65 | + exit 1 |
| 66 | + fi |
| 67 | + echo "Secrets OK for suite=${suite} (harness needs none)." |
| 68 | +
|
| 69 | + - name: Setup Node |
| 70 | + uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0 |
| 71 | + with: |
| 72 | + node-version-file: '.nvmrc' |
| 73 | + cache: 'npm' |
| 74 | + |
| 75 | + - name: Setup Java 17 |
| 76 | + uses: actions/setup-java@dded0888837ed1f317902acf8a20df0ad188d165 # v5.0.0 |
| 77 | + with: |
| 78 | + distribution: temurin |
| 79 | + java-version: '17' |
| 80 | + |
| 81 | + - name: Enable KVM |
| 82 | + run: | |
| 83 | + set -euo pipefail |
| 84 | + echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' \ |
| 85 | + | sudo tee /etc/udev/rules.d/99-kvm4all.rules |
| 86 | + sudo udevadm control --reload-rules |
| 87 | + sudo udevadm trigger --name-match=kvm |
| 88 | +
|
| 89 | + - name: Install npm dependencies |
| 90 | + run: npm ci |
| 91 | + |
| 92 | + - name: Install Maestro CLI |
| 93 | + run: npm run maestro:install |
| 94 | + |
| 95 | + - name: Prebuild Android (CNG) |
| 96 | + run: npm run prebuild |
| 97 | + env: |
| 98 | + CI: 'true' |
| 99 | + |
| 100 | + # Assemble inside emulator-runner so ANDROID_HOME / SDK from the action are available. |
| 101 | + # android-emulator-runner invokes script with /usr/bin/sh (dash on ubuntu) — run the |
| 102 | + # body via a bash heredoc so `pipefail` and ${HOME} expansion work (#510). |
| 103 | + - name: Build APK + run Maestro on emulator |
| 104 | + uses: reactivecircus/android-emulator-runner@1dcd0090116d15e7c562f8db72807de5e036a4ed # v2.34.0 |
| 105 | + env: |
| 106 | + MAESTRO_EMAIL: ${{ secrets.MAESTRO_EMAIL }} |
| 107 | + MAESTRO_PASSWORD: ${{ secrets.MAESTRO_PASSWORD }} |
| 108 | + MAESTRO_EMAIL_2: ${{ secrets.MAESTRO_EMAIL_2 }} |
| 109 | + MAESTRO_PASSWORD_2: ${{ secrets.MAESTRO_PASSWORD_2 }} |
| 110 | + with: |
| 111 | + api-level: 34 |
| 112 | + target: google_apis |
| 113 | + arch: x86_64 |
| 114 | + profile: pixel_6 |
| 115 | + disable-animations: true |
| 116 | + emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -no-metrics |
| 117 | + emulator-boot-timeout: 900 |
| 118 | + script: | |
| 119 | + bash -euo pipefail <<'SCRIPT' |
| 120 | + export PATH="${HOME}/.maestro/bin:${PATH}" |
| 121 | + chmod +x android/gradlew |
| 122 | + ( |
| 123 | + cd android |
| 124 | + ./gradlew :app:assembleRelease --no-daemon -PreactNativeArchitectures=x86_64 |
| 125 | + ) |
| 126 | + APK="android/app/build/outputs/apk/release/app-release.apk" |
| 127 | + test -f "${APK}" |
| 128 | + adb install -r "${APK}" |
| 129 | + mkdir -p .maestro/test_output |
| 130 | + suite="${{ inputs.suite }}" |
| 131 | + case "${suite}" in |
| 132 | + harness) |
| 133 | + npm run maestro:test:harness -- --format junit --output .maestro/test_output/report.xml |
| 134 | + ;; |
| 135 | + smokes) |
| 136 | + npm run maestro:test:smokes -- --format junit --output .maestro/test_output/report.xml |
| 137 | + ;; |
| 138 | + multi-account) |
| 139 | + npm run maestro:test:multi-account -- --format junit --output .maestro/test_output/report.xml |
| 140 | + ;; |
| 141 | + *) |
| 142 | + echo "Unknown suite: ${suite}" >&2 |
| 143 | + exit 1 |
| 144 | + ;; |
| 145 | + esac |
| 146 | + adb logcat -d > .maestro/test_output/logcat.txt || true |
| 147 | + SCRIPT |
| 148 | +
|
| 149 | + - name: Upload Maestro artifacts |
| 150 | + if: always() |
| 151 | + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 |
| 152 | + with: |
| 153 | + name: maestro-${{ inputs.suite }}-${{ github.run_id }} |
| 154 | + path: | |
| 155 | + .maestro/test_output |
| 156 | + android/app/build/outputs/apk/release/app-release.apk |
| 157 | + if-no-files-found: warn |
| 158 | + retention-days: 14 |
0 commit comments