Skip to content

feat: conditionally skip rebuilding on non app changes#16990

Merged
cmd-ob merged 27 commits into
mainfrom
e2e/reuse-pr-builds
Jul 10, 2025
Merged

feat: conditionally skip rebuilding on non app changes#16990
cmd-ob merged 27 commits into
mainfrom
e2e/reuse-pr-builds

Conversation

@cmd-ob

@cmd-ob cmd-ob commented Jul 8, 2025

Copy link
Copy Markdown
Contributor

Description

This PR implements conditional building for e2e test build when changes don't affect the app code.

Files/Patterns That Skip Rebuild

  • E2E test changes under /e2e
  • Documentation files (*.md, docs/)
  • Configuration files (*.json, *.yaml, *.yml)
  • GitHub workflows and templates

Testing

  • Verified that changes to app code still trigger builds
  • Tested edge cases with mixed file types
  • Validated CI/CD pipeline behaviour
  • Tested admin deleting cache

Related issues

Fixes:

Manual testing steps

  1. Go to this page...

Screenshots/Recordings

Before

After

Pre-merge author checklist

Pre-merge reviewer checklist

  • I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
  • I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.

@cmd-ob cmd-ob requested a review from a team July 8, 2025 17:01
@github-actions

github-actions Bot commented Jul 8, 2025

Copy link
Copy Markdown
Contributor

CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.

@metamaskbot metamaskbot added the team-qa QA team label Jul 8, 2025
@cmd-ob cmd-ob marked this pull request as draft July 8, 2025 17:01
@github-actions

github-actions Bot commented Jul 8, 2025

Copy link
Copy Markdown
Contributor

https://bitrise.io/ Bitrise

🔄🔄🔄 pr_smoke_e2e_pipeline started on Bitrise...🔄🔄🔄

Commit hash: 5ac8e3dd9a965b0a7f3a5d35406f16e1d1b32a27
Build link: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/6219ce56-1a87-44f9-bd27-e9a142268f50

Note

  • This comment will auto-update when build completes
  • You can kick off another pr_smoke_e2e_pipeline on Bitrise by removing and re-applying the Run Smoke E2E label on the pull request

@cmd-ob cmd-ob added the No QA Needed Apply this label when your PR does not need any QA effort. label Jul 8, 2025
cursor[bot]

This comment was marked as outdated.

@github-actions

github-actions Bot commented Jul 8, 2025

Copy link
Copy Markdown
Contributor

https://bitrise.io/ Bitrise

🔄🔄🔄 pr_smoke_e2e_pipeline started on Bitrise...🔄🔄🔄

Commit hash: adc6cd6473b2c6de8d7f885037e0c505fd610b56
Build link: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/fd458efe-3c4a-41a0-9cd6-b1b94a96166f

Note

  • This comment will auto-update when build completes
  • You can kick off another pr_smoke_e2e_pipeline on Bitrise by removing and re-applying the Run Smoke E2E label on the pull request

@cmd-ob

cmd-ob commented Jul 8, 2025

Copy link
Copy Markdown
Contributor Author

Bug: Build Skipping Fails Due to Timing and Platform Issues

The check-existing-pr-builds.sh script fails to enable build skipping due to two main issues:

  1. Timing/Circular Dependency: The script executes before the "Restore PR Build Cache" step. It checks for build artifact directories that would only exist after cache restoration. However, the cache restoration itself is conditional on SKIP_BUILD being true, which the script fails to set because the directories are not yet present. This creates a circular dependency, always resulting in SKIP_BUILD=false and preventing the build-skipping optimization.
  2. Platform Mismatch: The script requires both iOS and Android build artifacts to exist to skip a build. This condition is never met, as the Bitrise workflows (ios_e2e_build and _android_e2e_build_template) are platform-specific, meaning only one set of artifacts will ever be present.

scripts/check-existing-pr-builds.sh#L37-L56
bitrise.yml#L1169-L1213
Fix in CursorFix in Web

Was this report helpful? Give feedback by reacting with 👍 or 👎

fixed

@github-actions

github-actions Bot commented Jul 8, 2025

Copy link
Copy Markdown
Contributor

https://bitrise.io/ Bitrise

🔄🔄🔄 pr_smoke_e2e_pipeline started on Bitrise...🔄🔄🔄

Commit hash: ee55ededce7bde2e8c2d7a41200805645074afbc
Build link: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/4811026b-dacc-4dda-aab2-9362950f4cae

Note

  • This comment will auto-update when build completes
  • You can kick off another pr_smoke_e2e_pipeline on Bitrise by removing and re-applying the Run Smoke E2E label on the pull request

@github-actions

github-actions Bot commented Jul 8, 2025

Copy link
Copy Markdown
Contributor

https://bitrise.io/ Bitrise

❌❌❌ pr_smoke_e2e_pipeline failed on Bitrise! ❌❌❌

Commit hash: 4167bc7a561d3420a065302a089e868cff7eaad9
Build link: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/bd86affb-2ce9-4c1f-b519-a251bcc4996b

Note

  • You can kick off another pr_smoke_e2e_pipeline on Bitrise by removing and re-applying the Run Smoke E2E label on the pull request

Tip

  • Check the documentation if you have any doubts on how to understand the failure on bitrise

@github-actions

github-actions Bot commented Jul 8, 2025

Copy link
Copy Markdown
Contributor

https://bitrise.io/ Bitrise

🔄🔄🔄 pr_smoke_e2e_pipeline started on Bitrise...🔄🔄🔄

Commit hash: 0f79edc67a943cc8299cbff5e250057b44195bff
Build link: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/83cd4909-71c8-4663-a8cc-13d16a664106

Note

  • This comment will auto-update when build completes
  • You can kick off another pr_smoke_e2e_pipeline on Bitrise by removing and re-applying the Run Smoke E2E label on the pull request

@github-actions

github-actions Bot commented Jul 9, 2025

Copy link
Copy Markdown
Contributor

https://bitrise.io/ Bitrise

🔄🔄🔄 pr_smoke_e2e_pipeline started on Bitrise...🔄🔄🔄

Commit hash: b2a7065
Build link: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/40c7b3af-557b-4199-b254-f0579a6b52bf

Note

  • This comment will auto-update when build completes
  • You can kick off another pr_smoke_e2e_pipeline on Bitrise by removing and re-applying the Run Smoke E2E label on the pull request

@github-actions

github-actions Bot commented Jul 9, 2025

Copy link
Copy Markdown
Contributor

https://bitrise.io/ Bitrise

🔄🔄🔄 pr_smoke_e2e_pipeline started on Bitrise...🔄🔄🔄

Commit hash: 6417335
Build link: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/7a7a7a62-3ebd-40b8-83d3-4b8c6c4f27e1

Note

  • This comment will auto-update when build completes
  • You can kick off another pr_smoke_e2e_pipeline on Bitrise by removing and re-applying the Run Smoke E2E label on the pull request

@github-actions

github-actions Bot commented Jul 9, 2025

Copy link
Copy Markdown
Contributor

https://bitrise.io/ Bitrise

🔄🔄🔄 pr_smoke_e2e_pipeline started on Bitrise...🔄🔄🔄

Commit hash: dd62ed2
Build link: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/32efd16a-10b7-45ec-8a9c-1096443f859c

Note

  • This comment will auto-update when build completes
  • You can kick off another pr_smoke_e2e_pipeline on Bitrise by removing and re-applying the Run Smoke E2E label on the pull request

@metamaskbot

metamaskbot commented Jul 9, 2025

Copy link
Copy Markdown
Collaborator

https://bitrise.io/ Bitrise

🔄🔄🔄 pr_smoke_e2e_pipeline started on Bitrise...🔄🔄🔄

Commit hash: dd62ed2
Build link: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/09407621-55dc-41e6-bbdc-86324405c446

Note

  • This comment will auto-update when build completes
  • You can kick off another pr_smoke_e2e_pipeline on Bitrise by removing and re-applying the Run Smoke E2E label on the pull request

@github-actions

github-actions Bot commented Jul 9, 2025

Copy link
Copy Markdown
Contributor

https://bitrise.io/ Bitrise

🔄🔄🔄 pr_smoke_e2e_pipeline started on Bitrise...🔄🔄🔄

Commit hash: ab1d1db
Build link: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/df8d83e2-47f5-4a4e-9a52-14ce4c239a87

Note

  • This comment will auto-update when build completes
  • You can kick off another pr_smoke_e2e_pipeline on Bitrise by removing and re-applying the Run Smoke E2E label on the pull request

@github-actions

github-actions Bot commented Jul 9, 2025

Copy link
Copy Markdown
Contributor

https://bitrise.io/ Bitrise

🔄🔄🔄 pr_smoke_e2e_pipeline started on Bitrise...🔄🔄🔄

Commit hash: 09f5c09
Build link: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/b728842f-cd6b-4788-a3ab-757478147a7c

Note

  • This comment will auto-update when build completes
  • You can kick off another pr_smoke_e2e_pipeline on Bitrise by removing and re-applying the Run Smoke E2E label on the pull request

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 73.13%. Comparing base (0385ea0) to head (09f5c09).

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #16990      +/-   ##
==========================================
- Coverage   73.13%   73.13%   -0.01%     
==========================================
  Files        2749     2749              
  Lines       59917    59917              
  Branches     9473     9473              
==========================================
- Hits        43819    43818       -1     
- Misses      13349    13350       +1     
  Partials     2749     2749              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions

github-actions Bot commented Jul 9, 2025

Copy link
Copy Markdown
Contributor

https://bitrise.io/ Bitrise

🔄🔄🔄 pr_smoke_e2e_pipeline started on Bitrise...🔄🔄🔄

Commit hash: fdf3d28
Build link: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/eda9545e-8407-4615-b276-36a715ccf6ec

Note

  • This comment will auto-update when build completes
  • You can kick off another pr_smoke_e2e_pipeline on Bitrise by removing and re-applying the Run Smoke E2E label on the pull request

@metamaskbot

Copy link
Copy Markdown
Collaborator

https://bitrise.io/ Bitrise

✅✅✅ pr_smoke_e2e_pipeline passed on Bitrise! ✅✅✅

Commit hash: fdf3d28
Build link: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/eda9545e-8407-4615-b276-36a715ccf6ec

Note

  • You can kick off another pr_smoke_e2e_pipeline on Bitrise by removing and re-applying the Run Smoke E2E label on the pull request

@github-actions

github-actions Bot commented Jul 9, 2025

Copy link
Copy Markdown
Contributor

https://bitrise.io/ Bitrise

🔄🔄🔄 pr_smoke_e2e_pipeline started on Bitrise...🔄🔄🔄

Commit hash: 4d978b1
Build link: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/29f6b419-73f0-48f8-8b4a-8623affc1734

Note

  • This comment will auto-update when build completes
  • You can kick off another pr_smoke_e2e_pipeline on Bitrise by removing and re-applying the Run Smoke E2E label on the pull request

@christopherferreira9 christopherferreira9 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! 🚀 🦊

cursor[bot]

This comment was marked as outdated.

@cortisiko cortisiko left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

small feedback! other wise 🌮 🌮 🌮

Comment thread .gitignore Outdated
Comment thread bitrise.yml
cursor[bot]

This comment was marked as outdated.

@github-actions

github-actions Bot commented Jul 9, 2025

Copy link
Copy Markdown
Contributor

https://bitrise.io/ Bitrise

🔄🔄🔄 pr_smoke_e2e_pipeline started on Bitrise...🔄🔄🔄

Commit hash: e65fac1
Build link: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/0113f381-b638-4e3a-bd5b-2da1b74f64af

Note

  • This comment will auto-update when build completes
  • You can kick off another pr_smoke_e2e_pipeline on Bitrise by removing and re-applying the Run Smoke E2E label on the pull request

Comment thread bitrise.yml
@github-actions

github-actions Bot commented Jul 9, 2025

Copy link
Copy Markdown
Contributor

https://bitrise.io/ Bitrise

🔄🔄🔄 pr_smoke_e2e_pipeline started on Bitrise...🔄🔄🔄

Commit hash: b9981bc
Build link: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/bcaab23f-2e35-479d-836b-901e4bb39b4b

Note

  • This comment will auto-update when build completes
  • You can kick off another pr_smoke_e2e_pipeline on Bitrise by removing and re-applying the Run Smoke E2E label on the pull request

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Conditional Artifact Retrieval

The pull-intermediate-files steps in the android_e2e_test, ios_api_specs, and ios_e2e_test workflows run unconditionally. When the corresponding Android or iOS build is skipped (e.g., SKIP_ANDROID_BUILD or SKIP_IOS_BUILD is true), no intermediate files are saved by the build stage. This causes the pull-intermediate-files step to fail as it attempts to retrieve non-existent artifacts. These steps should be made conditional to run only when the build was not skipped.

bitrise.yml#L1037-L1041

metamask-mobile/bitrise.yml

Lines 1037 to 1041 in b9981bc

fi
- pull-intermediate-files@1:
inputs:
- artifact_sources: .*
title: Pull Android build

bitrise.yml#L1164-L1168

metamask-mobile/bitrise.yml

Lines 1164 to 1168 in b9981bc

echo "iOS build artifacts restored from cache"
- pull-intermediate-files@1:
inputs:
- artifact_sources: .*
title: Pull iOS build

bitrise.yml#L1466-L1470

metamask-mobile/bitrise.yml

Lines 1466 to 1470 in b9981bc

echo "iOS build artifacts restored from cache"
- pull-intermediate-files@1:
inputs:
- artifact_sources: .*
title: Pull iOS build

Fix in CursorFix in Web


Bug: Build Cache Overwrite and Logging Issues

Both iOS and Android build workflows save their "last successful build commit marker" to the same cache key last-e2e-build-commit-pr-{{ getenv "GITHUB_PR_NUMBER" }}. This creates a race condition where the last build to complete overwrites the marker, leading to inconsistent cache state and potentially incorrect build skipping decisions, especially if one platform's build fails.

Separately, the iOS cache restoration script misleadingly logs "iOS build artifacts restored from cache" even when the cache directories are not found and only empty directories are created.

bitrise.yml#L1408-L1834

metamask-mobile/bitrise.yml

Lines 1408 to 1834 in b9981bc

- save-cache@1:
title: Save last successful build commit marker
run_if: '{{getenv "GITHUB_PR_NUMBER" | ne ""}}'
inputs:
- key: 'last-e2e-build-commit-pr-{{ getenv "GITHUB_PR_NUMBER" }}'
- paths: /tmp/last-build-commit
- deploy-to-bitrise-io@2.2.3:
inputs:
- pipeline_intermediate_files: |-
ios/build/Build/Products/Release-iphonesimulator:INTERMEDIATE_IOS_BUILD_DIR
../Library/Detox/ios:INTERMEDIATE_IOS_DETOX_DIR
title: Save iOS build
- save-cache@1:
title: Save node_modules
inputs:
- key: node_modules-{{ .OS }}-{{ .Arch }}-{{ getenv "BRANCH_COMMIT_HASH" }}
- paths: node_modules
ios_e2e_test:
before_run:
- setup
- install_applesimutils
- prep_environment
after_run:
- notify_failure
steps:
- restore-cache@2:
title: Restore iOS PR Build Cache (if build was skipped)
run_if: '{{getenv "SKIP_IOS_BUILD" | eq "true"}}'
inputs:
- key: '{{ getenv "IOS_PR_BUILD_CACHE_KEY" }}'
- script@1:
title: Copy iOS build from cache (if build was skipped)
run_if: '{{getenv "SKIP_IOS_BUILD" | eq "true"}}'
inputs:
- content: |-
#!/usr/bin/env bash
echo "Copying iOS build from cache..."
# Check if cached build products exist
if [ -d "ios/build/Build/Products/Release-iphonesimulator" ]; then
echo "✅ iOS build artifacts found in cache"
echo "Build products directory contents:"
ls -la ios/build/Build/Products/Release-iphonesimulator/ | head -5
else
echo "❌ iOS build products not found in cache"
mkdir -p ios/build/Build/Products/Release-iphonesimulator
fi
# Check if cached Detox artifacts exist
if [ -d "../Library/Detox/ios" ]; then
echo "✅ Detox iOS artifacts found in cache"
echo "Detox directory contents:"
ls -la ../Library/Detox/ios/ | head -5
else
echo "❌ Detox iOS artifacts not found in cache"
mkdir -p ../Library/Detox/ios
fi
echo "iOS build artifacts restored from cache"
- pull-intermediate-files@1:
inputs:
- artifact_sources: .*
title: Pull iOS build
- script@1:
title: Copy iOS build for Detox
run_if: '{{getenv "SKIP_IOS_BUILD" | eq "false"}}'
inputs:
- content: |-
#!/usr/bin/env bash
set -ex
# Create directories for Detox
mkdir -p "$BITRISE_SOURCE_DIR/ios/build/Build/Products"
mkdir -p "$BITRISE_SOURCE_DIR/../Library/Detox/ios"
# Copy saved files for Detox usage
# INTERMEDIATE_IOS_BUILD_DIR & INTERMEDIATE_IOS_DETOX_DIR are the cached directories by ios_e2e_build's "Save iOS build" step
cp -r "$INTERMEDIATE_IOS_BUILD_DIR" "$BITRISE_SOURCE_DIR/ios/build/Build/Products"
cp -r "$INTERMEDIATE_IOS_DETOX_DIR" "$BITRISE_SOURCE_DIR/../Library/Detox"
# - restore-cocoapods-cache@2: {}
- restore-cache@2:
title: Restore cache node_modules
inputs:
- key: node_modules-{{ .OS }}-{{ .Arch }}-{{ getenv "BRANCH_COMMIT_HASH" }}
- script@1:
title: Install foundry
inputs:
- content: |-
#!/bin/bash
yarn install:foundryup
- certificate-and-profile-installer@1: {}
- set-xcode-build-number@1:
inputs:
- build_short_version_string: $VERSION_NAME
- plist_path: $PROJECT_LOCATION_IOS/MetaMask/MetaMask-QA-Info.plist
- script:
inputs:
- content: |-
# Add cache directory to environment variable
envman add --key BREW_APPLESIMUTILS --value "$(brew --cellar)/applesimutils"
envman add --key BREW_OPT_APPLESIMUTILS --value "/usr/local/opt/applesimutils"
brew tap wix/brew
title: Set Env Path for caching deps
- script@1:
title: Boot up simulator
inputs:
- content: |-
#!/usr/bin/env bash
xcrun simctl boot "iPhone 15 Pro" || true
xcrun simctl list | grep Booted
- script@1:
title: Run detox test
timeout: 1200
is_always_run: false
inputs:
- content: |-
#!/usr/bin/env bash
# node -v
export METAMASK_ENVIRONMENT='local'
export METAMASK_BUILD_TYPE=${METAMASK_BUILD_TYPE:-'main'}
# if [ "$METAMASK_BUILD_TYPE" = "flask" ]; then
# IS_TEST='true' METAMASK_BUILD_TYPE='flask' yarn test:e2e:ios:run:qa-release e2e/specs/flask/
# else
# ./scripts/run-e2e-tags.sh
# fi
if [ -n "${E2E_TEST_FILE:-}" ]; then
echo "[INFO] Running only specified E2E_TEST_FILE(s): $E2E_TEST_FILE"
IGNORE_BOXLOGS_DEVELOPMENT="true" yarn test:e2e:ios:run:qa-release $E2E_TEST_FILE
elif [ -n "${TEST_SUITE_TAG:-}" ]; then
echo "[INFO] Running tests matching TEST_SUITE_TAG: $TEST_SUITE_TAG"
./scripts/run-e2e-tags.sh
fi
- custom-test-results-export@1:
is_always_run: true
is_skippable: false
title: Export test results
inputs:
- base_path: $BITRISE_SOURCE_DIR/e2e/reports/
- test_name: E2E Tests
- search_pattern: $BITRISE_SOURCE_DIR/e2e/reports/junit.xml
- deploy-to-bitrise-io@2.2.3:
is_always_run: true
is_skippable: true
title: Deploy test report files
- script@1:
is_always_run: true
run_if: .IsBuildFailed
title: Copy screenshot files
inputs:
- content: |-
#!/usr/bin/env bash
set -ex
cp -r "$BITRISE_SOURCE_DIR/artifacts" "$BITRISE_DEPLOY_DIR"
- deploy-to-bitrise-io@2.3:
is_always_run: true
run_if: .IsBuildFailed
title: Deploy test screenshots
inputs:
- deploy_path: $BITRISE_DEPLOY_DIR
- is_compress: true
- zip_name: 'E2E_IOS_Failure_Artifacts'
start_e2e_tests:
steps:
- build-router-start@0:
inputs:
- workflows: |-
ios_e2e_test
wdio_android_e2e_test
- wait_for_builds: 'true'
- access_token: $BITRISE_START_BUILD_ACCESS_TOKEN
- build-router-wait@0:
inputs:
- abort_on_fail: 'yes'
- access_token: $BITRISE_START_BUILD_ACCESS_TOKEN
# Runway Workflow for Release Candidate Builds
runway_build_release_candidate:
before_run:
- bump_version_code
after_run:
- build_ios_release_and_upload_sourcemaps
- build_android_release_and_upload_sourcemaps
# Android Builds
_android_build_template:
before_run:
- code_setup
after_run:
- notify_failure
steps:
- change-android-versioncode-and-versionname@1:
inputs:
- new_version_name: $NAME
- new_version_code: $NUMBER
- build_gradle_path: $PROJECT_LOCATION_ANDROID/app/build.gradle
- file-downloader@1:
inputs:
- source: $BITRISEIO_ANDROID_KEYSTORE_URL
- destination: $KEYSTORE_PATH
run_if: '{{not (enveq "IS_DEV_BUILD" "true")}}'
- restore-gradle-cache@2: {}
- install-missing-android-tools@3:
inputs:
- ndk_version: $NDK_VERSION
- gradlew_path: $PROJECT_LOCATION/gradlew
- script@1:
title: Build Android Pre-Release Bundle
is_always_run: false
inputs:
- content: |-
#!/usr/bin/env bash
node -v
if [ -n "$YARN_COMMAND" ]; then
GIT_BRANCH=$BITRISE_GIT_BRANCH yarn "$YARN_COMMAND"
elif [ "$IS_DEV_BUILD" = "true" ]; then #EXPO BUILD
GIT_BRANCH=$BITRISE_GIT_BRANCH yarn build:android:devbuild
elif [ "$METAMASK_BUILD_TYPE" = "main" ]; then
yarn build:android:pre-release:bundle
elif [ "$METAMASK_BUILD_TYPE" = "beta" ]; then
yarn build:android:pre-release:bundle:beta
elif [ "$METAMASK_BUILD_TYPE" = "flask" ]; then
yarn build:android:pre-release:bundle:flask
else
echo "Error: Invalid build type specified: $METAMASK_BUILD_TYPE"
exit 1
fi
- save-gradle-cache@1: {}
- script@1:
title: Rename release files
inputs:
- content: |-
#!/usr/bin/env bash
# Set base paths for release builds
if [ "$IS_DEV_BUILD" = "true" ]; then
APK_DIR="$PROJECT_LOCATION/app/build/outputs/apk/$APP_NAME/debug"
else
APK_DIR="$PROJECT_LOCATION/app/build/outputs/apk/$APP_NAME/release"
BUNDLE_DIR="$PROJECT_LOCATION/app/build/outputs/bundle/$OUTPUT_PATH"
fi
# Generate new names based on build type and version
if [ -n "$YARN_COMMAND" ]; then
NAME_FROM_YARN_COMMAND="$(cut -d':' -f3- <<< "$YARN_COMMAND" | sed 's/:/-/g')"
NEW_BASE_NAME="metamask-${NAME_FROM_YARN_COMMAND}-${NUMBER}"
else
NEW_BASE_NAME="metamask-${METAMASK_ENVIRONMENT}-${METAMASK_BUILD_TYPE}-${NAME}-${NUMBER}"
fi
# Rename APK
if [ "$IS_DEV_BUILD" = "true" ]; then
OLD_APK="$APK_DIR/app-$APP_NAME-debug.apk"
OLD_AAB="$BUNDLE_DIR/app-$APP_NAME-debug.aab"
else
OLD_APK="$APK_DIR/app-$APP_NAME-release.apk"
OLD_AAB="$BUNDLE_DIR/app-$APP_NAME-release.aab"
fi
NEW_APK="$APK_DIR/$NEW_BASE_NAME.apk"
mv "$OLD_APK" "$NEW_APK"
# Rename AAB
NEW_AAB="$BUNDLE_DIR/$NEW_BASE_NAME.aab"
mv "$OLD_AAB" "$NEW_AAB"
# Export new names as environment variables
envman add --key RENAMED_APK_FILE --value "$NEW_BASE_NAME.apk"
envman add --key RENAMED_AAB_FILE --value "$NEW_BASE_NAME.aab"
envman add --key APK_DEPLOY_PATH --value "$APK_DIR/$NEW_BASE_NAME.apk"
- deploy-to-bitrise-io@2.2.3:
is_always_run: false
is_skippable: true
inputs:
- deploy_path: $APK_DEPLOY_PATH
title: Bitrise Deploy APK
- deploy-to-bitrise-io@2.2.3:
is_always_run: false
is_skippable: true
run_if: '{{not (enveq "IS_DEV_BUILD" "true")}}'
inputs:
- pipeline_intermediate_files: $PROJECT_LOCATION/app/build/outputs/apk/$APP_NAME/release/sha512sums.txt:BITRISE_PLAY_STORE_SHA512SUMS_PATH
- deploy_path: $PROJECT_LOCATION/app/build/outputs/apk/$APP_NAME/release/sha512sums.txt
title: Bitrise Deploy Checksum
- deploy-to-bitrise-io@2.2.3:
is_always_run: false
is_skippable: true
run_if: '{{not (enveq "IS_DEV_BUILD" "true")}}'
inputs:
- pipeline_intermediate_files: $PROJECT_LOCATION/app/build/outputs/mapping/$OUTPUT_PATH/mapping.txt:BITRISE_PLAY_STORE_MAPPING_PATH
- deploy_path: $PROJECT_LOCATION/app/build/outputs/mapping/$OUTPUT_PATH/mapping.txt
title: Bitrise ProGuard Map Files
- deploy-to-bitrise-io@2.2.3:
is_always_run: false
is_skippable: true
run_if: '{{not (enveq "IS_DEV_BUILD" "true")}}'
inputs:
- pipeline_intermediate_files: $PROJECT_LOCATION/app/build/outputs/bundle/$OUTPUT_PATH/$RENAMED_AAB_FILE:BITRISE_PLAY_STORE_ABB_PATH
- deploy_path: $PROJECT_LOCATION/app/build/outputs/bundle/$OUTPUT_PATH/$RENAMED_AAB_FILE
title: Bitrise Deploy AAB
# Template for E2E Android builds
_android_e2e_build_template:
before_run:
- code_setup
- set_commit_hash
after_run:
- notify_failure
steps:
- script@1:
title: Generating ccache key using native folder checksum
inputs:
- content: |-
#!/usr/bin/env bash
./scripts/cache/set-cache-envs.sh android
- restore-gradle-cache@2: {}
- install-missing-android-tools@3:
inputs:
- ndk_version: $NDK_VERSION
- gradlew_path: $PROJECT_LOCATION/gradlew
- file-downloader@1:
inputs:
- source: $KEYSTORE_URL
- destination: android/keystores/internalRelease.keystore
run_if: '{{not (enveq "IS_DEV_BUILD" "true")}}'
- script@1:
title: Install CCache & symlink
inputs:
- content: |-
#!/usr/bin/env bash
sudo apt update
sudo apt install ccache -y
- restore-cache@2:
title: Restore CCache
inputs:
- key: '{{ getenv "CCACHE_KEY" }}'
- script@1:
title: Set skip ccache upload
run_if: '{{ enveq "BITRISE_CACHE_HIT" "exact" }}'
inputs:
- content: |-
#!/usr/bin/env bash
envman add --key SKIP_CCACHE_UPLOAD --value "true"
- script@1:
title: Run detox build
timeout: 1200
is_always_run: true
inputs:
- content: |-
#!/usr/bin/env bash
./scripts/cache/setup-ccache.sh
node -v
export METAMASK_ENVIRONMENT='local'
export METAMASK_BUILD_TYPE=${METAMASK_BUILD_TYPE:-'main'}
IGNORE_BOXLOGS_DEVELOPMENT="true" $BUILD_COMMAND
- save-gradle-cache@1: {}
- save-cache@1:
title: Save CCache
run_if: '{{not (enveq "SKIP_CCACHE_UPLOAD" "true")}}'
inputs:
- key: '{{ getenv "CCACHE_KEY" }}'
- paths: |-
ccache
- script@1:
title: Debug Android build outputs before caching
inputs:
- content: |-
#!/usr/bin/env bash
echo "=== Android Build Output Debug ==="
echo "Checking for Android build outputs to cache..."
if [ -d "android/app/build/outputs" ]; then
echo "✅ android/app/build/outputs directory exists"
echo "Directory size: $(du -sh android/app/build/outputs 2>/dev/null || echo 'Could not calculate')"
echo "Contents:"
find android/app/build/outputs -type f -name "*.apk" -o -name "*.aab" | head -10
echo "Total files: $(find android/app/build/outputs -type f | wc -l)"
else
echo "❌ android/app/build/outputs directory does not exist!"
echo "This means the Android build failed or output path is incorrect"
fi
echo "Current working directory: $(pwd)"
echo "Listing android/app/build directory:"
ls -la android/app/build/ 2>/dev/null || echo "android/app/build does not exist"
- script@1:
title: Prepare Android build outputs for caching
inputs:
- content: |-
#!/usr/bin/env bash
echo "=== Preparing Android cache with proper paths ==="
echo "Current working directory: $(pwd)"
# Create a clean cache directory structure
mkdir -p /tmp/android-cache/build/outputs
if [ -d "android/app/build/outputs" ]; then
echo "Copying Android build outputs to cache staging area..."
cp -r android/app/build/outputs/* /tmp/android-cache/build/outputs/
echo "Cache staging completed"
echo "Cache contents:"
find /tmp/android-cache -type f | head -10
echo "Total cache size: $(du -sh /tmp/android-cache 2>/dev/null || echo 'Unknown')"
else
echo "Warning: android/app/build/outputs not found!"
fi
- save-cache@1:
title: Save Android PR Build Cache
inputs:
- key: '{{ getenv "ANDROID_PR_BUILD_CACHE_KEY" }}'
- paths: |-
/tmp/android-cache
- script@1:
title: Save last successful build commit (Android)
run_if: '{{getenv "GITHUB_PR_NUMBER" | ne ""}}'
inputs:
- content: |-
#!/usr/bin/env bash
# Create a marker file with the current commit
mkdir -p /tmp/last-build-commit
echo "$(git rev-parse HEAD 2>/dev/null || echo ${BITRISE_GIT_COMMIT})" > /tmp/last-build-commit/commit
echo "Android build completed successfully at $(date)" >> /tmp/last-build-commit/commit
- save-cache@1:
title: Save last successful build commit marker (Android)
run_if: '{{getenv "GITHUB_PR_NUMBER" | ne ""}}'
inputs:
- key: 'last-e2e-build-commit-pr-{{ getenv "GITHUB_PR_NUMBER" }}'
- paths: /tmp/last-build-commit

Fix in CursorFix in Web


Was this report helpful? Give feedback by reacting with 👍 or 👎

@sonarqubecloud

sonarqubecloud Bot commented Jul 9, 2025

Copy link
Copy Markdown

@metamaskbot

Copy link
Copy Markdown
Collaborator

https://bitrise.io/ Bitrise

✅✅✅ pr_smoke_e2e_pipeline passed on Bitrise! ✅✅✅

Commit hash: b9981bc
Build link: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/bcaab23f-2e35-479d-836b-901e4bb39b4b

Note

  • You can kick off another pr_smoke_e2e_pipeline on Bitrise by removing and re-applying the Run Smoke E2E label on the pull request

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

INVALID-PR-TEMPLATE PR's body doesn't match template No QA Needed Apply this label when your PR does not need any QA effort. release-7.52.0 Issue or pull request that will be included in release 7.52.0 team-qa QA team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants