feat: add Maestro E2E tests #7
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: E2E | |
| on: | |
| workflow_dispatch: | |
| pull_request: | |
| branches: | |
| - main | |
| push: | |
| branches: | |
| - main | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| permissions: | |
| contents: write | |
| jobs: | |
| android: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | |
| - name: Setup | |
| uses: ./.github/actions/setup | |
| - name: Install JDK | |
| uses: actions/setup-java@c5195efecf7bdfc987ee8bae7a71cb8b11521c00 # v4.7.1 | |
| with: | |
| distribution: 'zulu' | |
| java-version: '17' | |
| - name: Finalize Android SDK | |
| run: | | |
| /bin/bash -c "yes | $ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager --licenses > /dev/null" | |
| - name: Install Maestro | |
| run: | | |
| curl -Ls "https://get.maestro.mobile.dev" | bash | |
| echo "$HOME/.maestro/bin" >> $GITHUB_PATH | |
| - name: Enable KVM | |
| run: | | |
| echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules | |
| sudo udevadm control --reload-rules | |
| sudo udevadm trigger --name-match=kvm | |
| - name: Build and run Maestro tests | |
| uses: reactivecircus/android-emulator-runner@v2 | |
| env: | |
| GITHUB_TOKEN: ${{ github.token }} | |
| JAVA_OPTS: "-XX:MaxHeapSize=6g" | |
| with: | |
| api-level: 31 | |
| arch: x86_64 | |
| script: | | |
| cd example/expo && npx expo prebuild --platform android --clean && npx expo run:android --no-install --no-bundler --variant release && cd ../.. | |
| adb install example/expo/android/app/build/outputs/apk/release/app-release.apk | |
| maestro test .maestro/ --format junit --output report.xml | |
| - name: Upload test report | |
| if: always() | |
| uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 | |
| with: | |
| name: e2e-android-report | |
| path: report.xml | |
| ios: | |
| runs-on: macos-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | |
| - name: Setup | |
| uses: ./.github/actions/setup | |
| - name: Use appropriate Xcode version | |
| uses: maxim-lobanov/setup-xcode@60606e260d2fc5762a71e64e74b2174e8ea3c8bd # v1.6.0 | |
| with: | |
| xcode-version: latest-stable | |
| - name: Build example for iOS | |
| env: | |
| GITHUB_TOKEN: ${{ github.token }} | |
| run: | | |
| cd example/expo | |
| npx expo prebuild --platform ios --clean | |
| npx expo run:ios --no-install --no-bundler --configuration Release | |
| - name: Install Maestro | |
| run: | | |
| curl -Ls "https://get.maestro.mobile.dev" | bash | |
| echo "$HOME/.maestro/bin" >> $GITHUB_PATH | |
| - name: Boot iOS Simulator | |
| run: | | |
| DEVICE=$(xcrun simctl list devices available -j | jq -r '[.devices[] | .[] | select(.name | contains("iPhone"))][0].udid') | |
| xcrun simctl boot "$DEVICE" | |
| - name: Install app on Simulator | |
| run: | | |
| APP_PATH=$(find example/expo/ios/build -name "*.app" -path "*/Release-iphonesimulator/*" | head -1) | |
| xcrun simctl install booted "$APP_PATH" | |
| - name: Run Maestro tests | |
| run: maestro test .maestro/ --format junit --output report.xml | |
| - name: Upload test report | |
| if: always() | |
| uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 | |
| with: | |
| name: e2e-ios-report | |
| path: report.xml |