Add smoke E2E test workflow that ensures typical user-experience work #9
Workflow file for this run
This file contains 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 test | |
on: | |
workflow_dispatch: | |
pull_request: | |
jobs: | |
build: | |
runs-on: macos-latest | |
if: github.repository == 'mobile-dev-inc/maestro' | |
steps: | |
- name: Clone repository | |
uses: actions/checkout@v4 | |
- name: Set up JDK | |
uses: actions/setup-java@v4 | |
with: | |
distribution: zulu | |
java-version: 17 | |
- name: Set up Gradle | |
uses: gradle/actions/setup-gradle@v3 | |
- name: Build xctest-runner | |
run: ./maestro-ios-xctest-runner/build-maestro-ios-runner.sh | |
- name: Build Maestro CLI | |
run: ./gradlew :maestro-cli:distZip | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: maestro-cli | |
path: maestro-cli/build/distributions/maestro.zip | |
retention-days: 1 | |
test-local: | |
runs-on: ubuntu-latest | |
if: github.repository == 'mobile-dev-inc/maestro' | |
needs: build | |
env: | |
EMULATOR_API_LEVEL: 33 | |
EMULATOR_TARGET: google_apis | |
EMULATOR_ARCH: x86_64 | |
steps: | |
- name: Set up JDK | |
uses: actions/setup-java@v4 | |
with: | |
distribution: zulu | |
java-version: 8 | |
- name: Download artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
# Name of the artifact to download. | |
# If unspecified, all artifacts for the run are downloaded. | |
# Optional. | |
name: maestro-cli | |
- name: Add Maestro CLI executable to PATH | |
run: | | |
unzip maestro.zip | |
echo "$PWD/maestro/bin" >> $GITHUB_PATH | |
- name: Check if Maestro CLI executable starts up | |
run: | | |
printf "e2e" > "$HOME/.maestro/uuid" | |
maestro --help | |
- name: Start emulator and run a Flow | |
uses: reactivecircus/android-emulator-runner@v2 | |
with: | |
api-level: ${{ env.EMULATOR_API_LEVEL }} | |
target: ${{ env.EMULATOR_TARGET }} | |
arch: ${{ env.EMULATOR_ARCH }} | |
force-avd-creation: false | |
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none | |
disable-animations: false | |
working-directory: ${{ github.workspace }}/packages/patrol/example/android | |
script: | | |
maestro test | |
test-cloud: | |
runs-on: ubuntu-latest | |
if: github.repository == 'mobile-dev-inc/maestro' | |
needs: build | |
steps: | |
- name: Download artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
# Name of the artifact to download. | |
# If unspecified, all artifacts for the run are downloaded. | |
# Optional. | |
name: maestro-cli | |
- name: Set up JDK | |
uses: actions/setup-java@v4 | |
with: | |
distribution: zulu | |
java-version: 8 | |
- name: Check if Maestro CLI executable starts up | |
run: | | |
printf "e2e" > "$HOME/.maestro/uuid" | |
maestro --help | |
- name: maestro download-samples | |
run: maestro download-samples | |
- name: Run Android test | |
run: | | |
maestro cloud \ | |
--apiKey ${{secrets.E2E_MOBILE_DEV_API_KEY}} \ | |
--fail-on-cancellation \ | |
--include-tags advanced \ | |
samples/sample.apk \ | |
samples | |
- name: Run iOS test | |
run: | | |
maestro cloud \ | |
--apiKey=${{secrets.E2E_MOBILE_DEV_API_KEY}} \ | |
--timeout 180 \ | |
--fail-on-cancellation \ | |
--include-tags advanced \ | |
samples/sample.zip \ | |
samples | |
- name: Trigger alert on failure | |
if: ${{ false }} | |
# if: failure() | |
run: | | |
curl --request POST \ | |
--url "https://events.pagerduty.com/v2/enqueue" \ | |
--header 'Content-Type: application/json' \ | |
--data '{ | |
"payload": { | |
"summary": "E2E test failed", | |
"source": "E2E test", | |
"severity": "critical" | |
}, | |
"routing_key": "${{ secrets.E2E_PAGER_DUTY_INTEGRATION_KEY }}", | |
"event_action": "trigger", | |
"links": [ | |
{ | |
"href": "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}", | |
"text": "Failed E2E test - Github Action" | |
} | |
] | |
}' |