|
1 | | -name: Build |
| 1 | +name: E2E |
2 | 2 | on: |
| 3 | + workflow_dispatch: |
| 4 | + pull_request: |
| 5 | + branches: |
| 6 | + - main |
3 | 7 | push: |
4 | 8 | branches: |
5 | 9 | - main |
6 | 10 |
|
7 | 11 | concurrency: |
8 | 12 | group: ${{ github.workflow }}-${{ github.ref }} |
| 13 | + cancel-in-progress: true |
9 | 14 |
|
10 | 15 | jobs: |
11 | | - build-android: |
| 16 | + android: |
12 | 17 | runs-on: ubuntu-latest |
13 | 18 |
|
14 | 19 | env: |
|
66 | 71 | run: | |
67 | 72 | yarn turbo run build:android --cache-dir="${{ env.TURBO_CACHE_DIR }}" |
68 | 73 |
|
69 | | - build-ios: |
| 74 | + - name: Install Maestro |
| 75 | + if: env.turbo_cache_hit != 1 |
| 76 | + run: | |
| 77 | + curl -Ls "https://get.maestro.mobile.dev" | bash |
| 78 | + echo "$HOME/.maestro/bin" >> $GITHUB_PATH |
| 79 | +
|
| 80 | + - name: Enable KVM |
| 81 | + if: env.turbo_cache_hit != 1 |
| 82 | + run: | |
| 83 | + echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules |
| 84 | + sudo udevadm control --reload-rules |
| 85 | + sudo udevadm trigger --name-match=kvm |
| 86 | +
|
| 87 | + - name: Run Maestro tests |
| 88 | + if: env.turbo_cache_hit != 1 |
| 89 | + uses: reactivecircus/android-emulator-runner@v2 |
| 90 | + with: |
| 91 | + api-level: 31 |
| 92 | + arch: x86_64 |
| 93 | + script: | |
| 94 | + adb install example/bare/android/app/build/intermediates/apk/debug/app-debug.apk |
| 95 | + maestro test .maestro/ --format junit --output report.xml |
| 96 | +
|
| 97 | + - name: Upload test report |
| 98 | + if: always() && env.turbo_cache_hit != 1 |
| 99 | + uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 |
| 100 | + with: |
| 101 | + name: e2e-android-report |
| 102 | + path: report.xml |
| 103 | + |
| 104 | + ios: |
70 | 105 | runs-on: macos-latest |
71 | 106 |
|
72 | 107 | env: |
@@ -132,3 +167,32 @@ jobs: |
132 | 167 | - name: Build example for iOS |
133 | 168 | run: | |
134 | 169 | yarn turbo run build:ios --cache-dir="${{ env.TURBO_CACHE_DIR }}" |
| 170 | +
|
| 171 | + - name: Install Maestro |
| 172 | + if: env.turbo_cache_hit != 1 |
| 173 | + uses: dniHze/maestro-test-action@v1 |
| 174 | + |
| 175 | + - name: Boot iOS Simulator |
| 176 | + if: env.turbo_cache_hit != 1 |
| 177 | + run: | |
| 178 | + DEVICE=$(xcrun simctl list devices available -j | jq -r '[.devices[] | .[] | select(.name | contains("iPhone"))][0].udid') |
| 179 | + xcrun simctl boot "$DEVICE" |
| 180 | +
|
| 181 | + - name: Install app on Simulator |
| 182 | + if: env.turbo_cache_hit != 1 |
| 183 | + run: | |
| 184 | + APP_PATH=$(find ~/Library/Developer/Xcode/DerivedData -name "TrueSheetExample.app" -path "*/Debug-iphonesimulator/*" | head -1) |
| 185 | + xcrun simctl install booted "$APP_PATH" |
| 186 | +
|
| 187 | + - name: Run Maestro tests |
| 188 | + if: env.turbo_cache_hit != 1 |
| 189 | + run: | |
| 190 | + export PATH="$PATH":"$HOME/.maestro/bin" |
| 191 | + maestro test .maestro/ --format junit --output report.xml |
| 192 | +
|
| 193 | + - name: Upload test report |
| 194 | + if: always() && env.turbo_cache_hit != 1 |
| 195 | + uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 |
| 196 | + with: |
| 197 | + name: e2e-ios-report |
| 198 | + path: report.xml |
0 commit comments