|
| 1 | +name: 📱 E2E iOS (Maestro) |
| 2 | +on: |
| 3 | + push: |
| 4 | + branches-ignore: |
| 5 | + - main |
| 6 | + pull_request: |
| 7 | + branches: |
| 8 | + - main |
| 9 | + |
| 10 | +concurrency: |
| 11 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 12 | + cancel-in-progress: true |
| 13 | + |
| 14 | +jobs: |
| 15 | + maestro-ios: |
| 16 | + name: 🧪 Maestro smoke tests (iOS sim) |
| 17 | + runs-on: macos-15 |
| 18 | + timeout-minutes: 60 |
| 19 | + env: |
| 20 | + EXAMPLE_DIR: examples/kitchen-sink |
| 21 | + APP_ID: com.gstj.reactnativemagicmodalexample |
| 22 | + |
| 23 | + steps: |
| 24 | + - name: 🏗 Setup Repo |
| 25 | + uses: actions/checkout@v4 |
| 26 | + |
| 27 | + - name: 🏗 Setup PNPM |
| 28 | + uses: pnpm/action-setup@v4 |
| 29 | + |
| 30 | + - name: 🏗 Setup Node |
| 31 | + uses: actions/setup-node@v4 |
| 32 | + with: |
| 33 | + node-version: 20.x |
| 34 | + cache: pnpm |
| 35 | + |
| 36 | + - name: 🏗 Setup Ruby (for CocoaPods) |
| 37 | + uses: ruby/setup-ruby@v1 |
| 38 | + with: |
| 39 | + ruby-version: "3.2" |
| 40 | + bundler-cache: false |
| 41 | + |
| 42 | + - name: 🏗 Install CocoaPods |
| 43 | + run: gem install cocoapods --no-document |
| 44 | + |
| 45 | + - name: 🏗 Get PNPM store directory |
| 46 | + id: pnpm-cache |
| 47 | + run: | |
| 48 | + echo "pnpm_cache_dir=$(pnpm store path)" >> "$GITHUB_OUTPUT" |
| 49 | +
|
| 50 | + - name: 🏗 Setup PNPM cache |
| 51 | + uses: actions/cache@v4 |
| 52 | + with: |
| 53 | + path: ${{ steps.pnpm-cache.outputs.pnpm_cache_dir }} |
| 54 | + key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} |
| 55 | + restore-keys: | |
| 56 | + ${{ runner.os }}-pnpm-store- |
| 57 | +
|
| 58 | + - name: 📦 Install Dependencies |
| 59 | + run: pnpm install --frozen-lockfile |
| 60 | + |
| 61 | + - name: 🏗 Install Maestro CLI |
| 62 | + run: | |
| 63 | + curl -fsSL "https://get.maestro.mobile.dev" | bash |
| 64 | + echo "$HOME/.maestro/bin" >> "$GITHUB_PATH" |
| 65 | +
|
| 66 | + - name: 🔎 Verify Maestro |
| 67 | + run: maestro --version |
| 68 | + |
| 69 | + - name: 📱 Boot iOS Simulator |
| 70 | + id: boot-sim |
| 71 | + run: | |
| 72 | + # Use the latest iPhone simulator already available on the runner image. |
| 73 | + DEVICE_UDID=$(xcrun simctl list devices available -j \ |
| 74 | + | python3 -c "import json,sys; d=json.load(sys.stdin)['devices']; \ |
| 75 | + rt=sorted([k for k in d if 'iOS' in k]); \ |
| 76 | + uuids=[x['udid'] for x in d[rt[-1]] if 'iPhone' in x['name']]; \ |
| 77 | + print(uuids[-1])") |
| 78 | + echo "Using simulator UDID: $DEVICE_UDID" |
| 79 | + xcrun simctl boot "$DEVICE_UDID" || true |
| 80 | + xcrun simctl bootstatus "$DEVICE_UDID" -b |
| 81 | + echo "device_udid=$DEVICE_UDID" >> "$GITHUB_OUTPUT" |
| 82 | +
|
| 83 | + - name: 🛠 Expo prebuild (iOS) |
| 84 | + working-directory: ${{ env.EXAMPLE_DIR }} |
| 85 | + run: pnpm expo prebuild --platform ios --clean |
| 86 | + |
| 87 | + - name: 🏗 Build & install iOS app on simulator |
| 88 | + working-directory: ${{ env.EXAMPLE_DIR }} |
| 89 | + run: pnpm expo run:ios --configuration Release --no-bundler --device "${{ steps.boot-sim.outputs.device_udid }}" |
| 90 | + |
| 91 | + - name: 🧪 Run Maestro smoke flows |
| 92 | + working-directory: ${{ env.EXAMPLE_DIR }} |
| 93 | + run: | |
| 94 | + maestro test \ |
| 95 | + .maestro/smoke-launch.yaml \ |
| 96 | + .maestro/smoke-modal-open-close.yaml |
| 97 | +
|
| 98 | + - name: 📤 Upload Maestro debug output |
| 99 | + if: always() |
| 100 | + uses: actions/upload-artifact@v4 |
| 101 | + with: |
| 102 | + name: maestro-debug-output |
| 103 | + path: | |
| 104 | + ~/.maestro/tests/** |
| 105 | + ${{ env.EXAMPLE_DIR }}/.maestro/**/*.png |
| 106 | + if-no-files-found: ignore |
| 107 | + retention-days: 7 |
0 commit comments