Ad-hoc Release Tests - Maestro Cloud #114
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: Release - Run E2E Maestro Tests | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| app-version: | |
| description: 'App Version for Testing' | |
| required: true | |
| default: 'PLACEHOLDER' | |
| test-tag: | |
| description: 'Maestro Tests tag to include' | |
| required: true | |
| default: 'releaseTest' | |
| env: | |
| ASANA_PAT: ${{ secrets.ASANA_ACCESS_TOKEN }} | |
| emoji_info: ":information_source:" # ℹ️ | |
| emoji_success: ":white_check_mark:" # ✅ | |
| emoji_failure: ":x:" # ❌ | |
| jobs: | |
| run-release-tests: | |
| name: Create release APK and run E2E Maestro tests | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| ref: 'feature/cris/anrs/move-getcustomheaders-to-io' | |
| - name: Set up JDK version | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version-file: .github/.java-version | |
| distribution: 'adopt' | |
| - name: Create folder | |
| if: always() | |
| run: mkdir apk | |
| - name: Decode keys | |
| uses: davidSchuppa/base64Secret-toFile-action@v2 | |
| with: | |
| secret: ${{ secrets.FAKE_RELEASE_PROPERTIES }} | |
| fileName: ddg_android_build.properties | |
| destination-path: $HOME/jenkins_static/com.duckduckgo.mobile.android/ | |
| - name: Decode key file | |
| uses: davidSchuppa/base64Secret-toFile-action@v2 | |
| with: | |
| secret: ${{ secrets.FAKE_RELEASE_KEY }} | |
| fileName: android | |
| destination-path: $HOME/jenkins_static/com.duckduckgo.mobile.android/ | |
| - name: Setup Gradle | |
| uses: gradle/actions/setup-gradle@v3 | |
| - name: Assemble release APK | |
| run: ./gradlew assemblePlayRelease -Pforce-default-variant -Pskip-onboarding | |
| - name: Move APK to new folder | |
| if: always() | |
| run: find . -name "*.apk" -exec mv '{}' apk/release.apk \; | |
| - name: Maestro tests flows | |
| id: release-tests | |
| uses: mobile-dev-inc/action-maestro-cloud@v1.9.8 | |
| timeout-minutes: 120 | |
| with: | |
| api-key: ${{ secrets.ROBIN_API_KEY }} | |
| project-id: ${{ vars.ROBIN_ANDROID_PROJECT_ID }} | |
| timeout: ${{ vars.ROBIN_TIMEOUT_MINUTES }} | |
| app-file: apk/release.apk | |
| android-api-level: 30 | |
| workspace: .maestro | |
| include-tags: ${{ github.event.inputs.test-tag }} | |
| - name: Analyze Maestro Flow Results | |
| id: analyze-flow-results | |
| if: always() | |
| run: | | |
| echo "Console URL: ${{ steps.release-tests.outputs.MAESTRO_CLOUD_CONSOLE_URL }}" | |
| echo "Upload Status: ${{ steps.release-tests.outputs.MAESTRO_CLOUD_UPLOAD_STATUS }}" | |
| echo "App Binary ID: ${{ steps.release-tests.outputs.MAESTRO_CLOUD_APP_BINARY_ID }}" | |
| flow_results_json='${{ steps.release-tests.outputs.MAESTRO_CLOUD_FLOW_RESULTS }}' | |
| echo "Raw Flow Results JSON: $flow_results_json" | |
| # Default to success, change if issues are found | |
| final_status="success" | |
| # Check for empty or invalid JSON (though Maestro action should provide valid JSON) | |
| if ! echo "$flow_results_json" | jq -e . > /dev/null 2>&1; then | |
| echo "::warning::MAESTRO_CLOUD_FLOW_RESULTS is not valid JSON or is empty." | |
| final_status="unknown_format" | |
| else | |
| # Check for any flow with status "ERROR" | |
| if echo "$flow_results_json" | jq -e '.[] | select(.status=="ERROR")' > /dev/null; then | |
| echo "::error::At least one Maestro flow has status: ERROR." | |
| final_status="failure" | |
| fi | |
| # Check for any flow with status "CANCELED" | |
| # You might decide if CANCELED flows also mean the overall status is a failure for your release | |
| if echo "$flow_results_json" | jq -e '.[] | select(.status=="CANCELED")' > /dev/null; then | |
| echo "::warning::At least one Maestro flow has status: CANCELED." | |
| # If any canceled flow makes the whole thing a failure: | |
| if [ "$final_status" != "failure" ]; then # Don't override if already a critical failure | |
| final_status="canceled_present" # Or treat as "failure" if preferred | |
| fi | |
| fi | |
| # If after all checks, final_status is still "success", it means no "ERROR" or "CANCELED" | |
| if [ "$final_status" == "success" ]; then | |
| # Additional check: ensure there's at least one flow and it's not empty array if that's a concern | |
| if echo "$flow_results_json" | jq -e '. | length > 0' > /dev/null; then | |
| echo "All flows appear to be successful (no ERROR or CANCELED statuses found that are treated as errors)." | |
| else | |
| echo "::warning::MAESTRO_CLOUD_FLOW_RESULTS is an empty array. No flows reported." | |
| final_status="empty_results" # Or "success" if empty results are acceptable | |
| fi | |
| fi | |
| fi | |
| echo "Final determined status: $final_status" | |
| echo "flow_summary_status=$final_status" >> $GITHUB_OUTPUT | |
| - name: Access Outputs (for debugging) | |
| if: always() | |
| run: | | |
| echo "Console URL: ${{ steps.release-tests.outputs.MAESTRO_CLOUD_CONSOLE_URL }}" | |
| echo 'Flow Results (JSON): ${{ steps.release-tests.outputs.MAESTRO_CLOUD_FLOW_RESULTS }}' | |
| echo "Release Tests Step Conclusion: ${{ steps.release-tests.conclusion }}" # From Maestro action itself | |
| echo "Analyzed Flow Summary Status: ${{ steps.analyze-flow-results.outputs.flow_summary_status }}" # From our script |