remove process.env.METAMASK_ENVIRONMENT == 'e2e' #6
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
| # This workflow creates two iOS Builds and uploads to BrowserStack using GitHub Actions. | ||
|
Check failure on line 1 in .github/workflows/build-ios-upload-to-browserstack.yml
|
||
| # Build 1: With ADDITIONAL_SRP_1 and PREDEFINED_PASSWORD (pre-imported wallet) — e2e-bs-with-srp | ||
| # Build 2: With E2E_MOCK_OAUTH (seedless onboarding) — e2e-bs-without-srp | ||
| name: Build iOS Dual Versions and Upload to BrowserStack | ||
| on: | ||
| workflow_call: | ||
| inputs: | ||
| browserstack_app_url_ios_onboarding: | ||
| required: false | ||
| type: string | ||
| description: 'BrowserStack iOS Onboarding App URL (bs://...)' | ||
| browserstack_app_url_ios_imported_wallet: | ||
| required: false | ||
| type: string | ||
| description: 'BrowserStack iOS Imported Wallet App URL (bs://...)' | ||
| branch_name: | ||
| required: false | ||
| type: string | ||
| description: 'Branch name to use for builds (defaults to github.ref_name)' | ||
| build_variant: | ||
| required: false | ||
| type: string | ||
| description: 'Build variant for Bitrise (rc = release, exp = experimental)' | ||
| default: 'e2e' | ||
| runner_provider: | ||
| description: Runner provider forwarded from the caller | ||
| required: false | ||
| type: string | ||
| default: current | ||
| outputs: | ||
| with-srp-ipa-uploaded: | ||
| description: 'Whether the with-SRP IPA was successfully uploaded' | ||
| value: ${{ jobs.upload-to-browserstack.outputs.with-srp-ipa-uploaded }} | ||
| without-srp-ipa-uploaded: | ||
| description: 'Whether the without-SRP IPA was successfully uploaded' | ||
| value: ${{ jobs.upload-to-browserstack.outputs.without-srp-ipa-uploaded }} | ||
| with-srp-browserstack-url: | ||
| description: 'BrowserStack URL for with-SRP version' | ||
| value: ${{ jobs.upload-to-browserstack.outputs.with-srp-browserstack-url }} | ||
| without-srp-browserstack-url: | ||
| description: 'BrowserStack URL for without-SRP version' | ||
| value: ${{ jobs.upload-to-browserstack.outputs.without-srp-browserstack-url }} | ||
| with-srp-version: | ||
| description: 'App version for with-SRP build' | ||
| value: ${{ jobs.upload-to-browserstack.outputs.with-srp-version }} | ||
| without-srp-version: | ||
| description: 'App version for without-SRP build' | ||
| value: ${{ jobs.upload-to-browserstack.outputs.without-srp-version }} | ||
| workflow_dispatch: | ||
| inputs: | ||
| description: | ||
| description: 'Optional description for this build run' | ||
| required: false | ||
| type: string | ||
| runner_provider: | ||
| description: Runner provider for this manual trial run | ||
| required: false | ||
| type: choice | ||
| options: | ||
| - current | ||
| - namespace | ||
| default: current | ||
| permissions: | ||
| contents: write | ||
| id-token: write | ||
| jobs: | ||
| check-builds-needed: | ||
| name: Check if iOS builds are needed | ||
| runs-on: ${{ inputs.runner_provider == 'namespace' && 'namespace-profile-metamask-ci-linux' || 'ubuntu-latest' }} | ||
| outputs: | ||
| builds-needed: ${{ steps.check-builds.outputs.builds-needed }} | ||
| steps: | ||
| - name: Check if builds are needed | ||
| id: check-builds | ||
| run: | | ||
| if [ -n "${{ inputs.browserstack_app_url_ios_onboarding }}" ] || [ -n "${{ inputs.browserstack_app_url_ios_imported_wallet }}" ]; then | ||
| echo "builds-needed=false" >> "$GITHUB_OUTPUT" | ||
| echo "Skipping iOS builds - BS URLs provided via workflow inputs" | ||
| else | ||
| echo "builds-needed=true" >> "$GITHUB_OUTPUT" | ||
| echo "iOS builds needed - no BS URLs provided" | ||
| fi | ||
| trigger-ios-with-srp-build: | ||
| name: Trigger iOS with-SRP Build on Bitrise | ||
| runs-on: ${{ inputs.runner_provider == 'namespace' && 'namespace-profile-metamask-ci-linux' || 'ubuntu-latest' }} | ||
| needs: [check-builds-needed] | ||
| if: needs.check-builds-needed.outputs.builds-needed == 'true' | ||
| uses: ./.github/workflows/build.yml | ||
| with: | ||
| build_name: ${{ inputs.build_variant == 'exp' && 'main-exp-with-srp' || inputs.build_variant == 'rc' && 'main-rc-with-srp' || 'main-e2e-bs-with-srp' }} | ||
| platform: ios | ||
| skip_version_bump: true | ||
| source_branch: ${{ inputs.branch_name || github.ref_name }} | ||
| secrets: inherit | ||
| trigger-ios-without-srp-build: | ||
| name: Trigger iOS without-SRP Build on Bitrise | ||
| runs-on: ${{ inputs.runner_provider == 'namespace' && 'namespace-profile-metamask-ci-linux' || 'ubuntu-latest' }} | ||
| needs: [check-builds-needed] | ||
| if: needs.check-builds-needed.outputs.builds-needed == 'true' | ||
| uses: ./.github/workflows/build.yml | ||
| with: | ||
| build_name: ${{ inputs.build_variant == 'exp' && 'main-exp-without-srp' || inputs.build_variant == 'rc' && 'main-rc-without-srp' || 'main-e2e-bs-without-srp' }} | ||
| platform: ios | ||
| skip_version_bump: true | ||
| source_branch: ${{ inputs.branch_name || github.ref_name }} | ||
| secrets: inherit | ||
| download-and-upload-to-browserstack: | ||
| name: Download IPAs and Upload to BrowserStack | ||
| runs-on: ${{ inputs.runner_provider == 'namespace' && 'namespace-profile-metamask-ci-linux' || 'ubuntu-latest' }} | ||
| needs: [check-builds-needed, trigger-ios-with-srp-build, trigger-ios-without-srp-build] | ||
| if: (needs.trigger-ios-with-srp-build.result == 'success' || needs.trigger-ios-with-srp-build.result == 'partial_success') && (needs.trigger-ios-without-srp-build.result == 'success' || needs.trigger-ios-without-srp-build.result == 'partial_success') | ||
| outputs: | ||
| with-srp-ipa-uploaded: ${{ steps.browserstack-upload.outputs.with-srp-ipa-uploaded }} | ||
| without-srp-ipa-uploaded: ${{ steps.browserstack-upload.outputs.without-srp-ipa-uploaded }} | ||
| with-srp-browserstack-url: ${{ steps.browserstack-upload.outputs.with-srp-browserstack-url }} | ||
| without-srp-browserstack-url: ${{ steps.browserstack-upload.outputs.without-srp-browserstack-url }} | ||
| with-srp-app-id: ${{ steps.browserstack-upload.outputs.with-srp-app-id }} | ||
| without-srp-app-id: ${{ steps.browserstack-upload.outputs.without-srp-app-id }} | ||
| with-srp-version: ${{ steps.browserstack-upload.outputs.with-srp-version }} | ||
| without-srp-version: ${{ steps.browserstack-upload.outputs.without-srp-version }} | ||
| steps: | ||
| - name: Download with-SRP IPA | ||
| uses: actions/download-artifact@v4 | ||
| with: | ||
| name: ios-ipa-${{ inputs.build_variant == 'exp' && 'main-exp-with-srp' || inputs.build_variant == 'rc' && 'main-rc-with-srp' || 'main-e2e-bs-with-srp' }} | ||
| path: artifacts/with-srp | ||
| - name: Download without-SRP IPA | ||
| uses: actions/download-artifact@v4 | ||
| with: | ||
| name: ios-ipa-${{ inputs.build_variant == 'exp' && 'main-exp-without-srp' || inputs.build_variant == 'rc' && 'main-rc-without-srp' || 'main-e2e-bs-without-srp' }} | ||
| path: artifacts/without-srp | ||
| - name: Upload IPAs to BrowserStack | ||
| id: browserstack-upload | ||
| env: | ||
| BROWSERSTACK_USERNAME: ${{ secrets.BROWSERSTACK_USERNAME }} | ||
| BROWSERSTACK_ACCESS_KEY: ${{ secrets.BROWSERSTACK_ACCESS_KEY }} | ||
| run: | | ||
| set +e # Don't exit on error — attempt both uploads independently | ||
| echo "Uploading IPAs to BrowserStack..." | ||
| # Initialize outputs | ||
| { | ||
| echo "with-srp-ipa-uploaded=false" | ||
| echo "without-srp-ipa-uploaded=false" | ||
| } >> "$GITHUB_OUTPUT" | ||
| WITH_SRP_APP_URL="" | ||
| WITHOUT_SRP_APP_URL="" | ||
| WITH_SRP_ERROR="" | ||
| WITHOUT_SRP_ERROR="" | ||
| # Find the IPA files (build.yml renames them; find the single .ipa in each directory) | ||
| WITH_SRP_IPA=$(find artifacts/with-srp -name "*.ipa" | head -1) | ||
| WITHOUT_SRP_IPA=$(find artifacts/without-srp -name "*.ipa" | head -1) | ||
| # Upload with-SRP IPA | ||
| if [ -n "$WITH_SRP_IPA" ]; then | ||
| echo "Uploading with-SRP IPA: $WITH_SRP_IPA" | ||
| WITH_SRP_RESPONSE=$(curl -u "$BROWSERSTACK_USERNAME:$BROWSERSTACK_ACCESS_KEY" \ | ||
| -X POST "https://api-cloud.browserstack.com/app-automate/upload" \ | ||
| -F "file=@$WITH_SRP_IPA" \ | ||
| -F "custom_id=MetaMask-iOS-With-SRP-${{ github.run_id }}") | ||
| WITH_SRP_APP_URL=$(echo "$WITH_SRP_RESPONSE" | jq -r '.app_url // empty') | ||
| WITH_SRP_APP_ID=$(echo "$WITH_SRP_RESPONSE" | jq -r '.app_id // empty') | ||
| if [ -n "$WITH_SRP_APP_URL" ]; then | ||
| echo "✅ With-SRP IPA uploaded" | ||
| echo " App URL: $WITH_SRP_APP_URL" | ||
| echo " App ID: $WITH_SRP_APP_ID" | ||
| { | ||
| echo "with-srp-browserstack-url=$WITH_SRP_APP_URL" | ||
| echo "with-srp-app-id=$WITH_SRP_APP_ID" | ||
| echo "with-srp-version=${{ needs.build-with-srp.outputs.semantic_version }}" | ||
| echo "with-srp-ipa-uploaded=true" | ||
| } >> "$GITHUB_OUTPUT" | ||
| else | ||
| WITH_SRP_ERROR="BrowserStack upload failed" | ||
| echo "❌ With-SRP: $WITH_SRP_ERROR" | ||
| echo "Response: $WITH_SRP_RESPONSE" | ||
| fi | ||
| else | ||
| WITH_SRP_ERROR="IPA not found in artifacts/with-srp" | ||
| echo "❌ With-SRP: $WITH_SRP_ERROR" | ||
| fi | ||
| # Upload without-SRP IPA | ||
| if [ -n "$WITHOUT_SRP_IPA" ]; then | ||
| echo "Uploading without-SRP IPA: $WITHOUT_SRP_IPA" | ||
| WITHOUT_SRP_RESPONSE=$(curl -u "$BROWSERSTACK_USERNAME:$BROWSERSTACK_ACCESS_KEY" \ | ||
| -X POST "https://api-cloud.browserstack.com/app-automate/upload" \ | ||
| -F "file=@$WITHOUT_SRP_IPA" \ | ||
| -F "custom_id=MetaMask-iOS-Without-SRP-${{ github.run_id }}") | ||
| WITHOUT_SRP_APP_URL=$(echo "$WITHOUT_SRP_RESPONSE" | jq -r '.app_url // empty') | ||
| WITHOUT_SRP_APP_ID=$(echo "$WITHOUT_SRP_RESPONSE" | jq -r '.app_id // empty') | ||
| if [ -n "$WITHOUT_SRP_APP_URL" ]; then | ||
| echo "✅ Without-SRP IPA uploaded" | ||
| echo " App URL: $WITHOUT_SRP_APP_URL" | ||
| echo " App ID: $WITHOUT_SRP_APP_ID" | ||
| { | ||
| echo "without-srp-browserstack-url=$WITHOUT_SRP_APP_URL" | ||
| echo "without-srp-app-id=$WITHOUT_SRP_APP_ID" | ||
| echo "without-srp-version=${{ needs.build-without-srp.outputs.semantic_version }}" | ||
| echo "without-srp-ipa-uploaded=true" | ||
| } >> "$GITHUB_OUTPUT" | ||
| else | ||
| WITHOUT_SRP_ERROR="BrowserStack upload failed" | ||
| echo "❌ Without-SRP: $WITHOUT_SRP_ERROR" | ||
| echo "Response: $WITHOUT_SRP_RESPONSE" | ||
| fi | ||
| else | ||
| WITHOUT_SRP_ERROR="IPA not found in artifacts/without-srp" | ||
| echo "❌ Without-SRP: $WITHOUT_SRP_ERROR" | ||
| fi | ||
| # Summary | ||
| echo "" | ||
| echo "=== BrowserStack Upload Summary ===" | ||
| if [ -n "$WITH_SRP_APP_URL" ]; then | ||
| echo "✅ With-SRP URL: $WITH_SRP_APP_URL" | ||
| else | ||
| echo "❌ With-SRP: FAILED — ${WITH_SRP_ERROR:-unknown error}" | ||
| fi | ||
| if [ -n "$WITHOUT_SRP_APP_URL" ]; then | ||
| echo "✅ Without-SRP URL: $WITHOUT_SRP_APP_URL" | ||
| else | ||
| echo "❌ Without-SRP: FAILED — ${WITHOUT_SRP_ERROR:-unknown error}" | ||
| fi | ||
| # Fail only if BOTH uploads failed | ||
| if [ -z "$WITH_SRP_APP_URL" ] && [ -z "$WITHOUT_SRP_APP_URL" ]; then | ||
| echo "" | ||
| echo "❌ Both IPA uploads failed. Failing step." | ||
| exit 1 | ||
| fi | ||