Skip to content

Commit e038f30

Browse files
chore: Upload source maps on gh actions builds (MetaMask#27099)
<!-- Please submit this PR as a draft initially. Do not mark it as "Ready for review" until the template has been completely filled out, and PR status checks have passed at least once. --> ## **Description** Uploading source maps for non debug builds so members can test performance with react native release profiler was missing when building with gh actions. https://github.com/MetaMask/metamask-mobile/actions/runs/22746710404 <!-- Write a short description of the changes included in this pull request, also include relevant motivation and context. Have in mind the following questions: 1. What is the reason for the change? 2. What is the improvement/solution? --> ## **Changelog** <!-- If this PR is not End-User-Facing and should not show up in the CHANGELOG, you can choose to either: 1. Write `CHANGELOG entry: null` 2. Label with `no-changelog` If this PR is End-User-Facing, please write a short User-Facing description in the past tense like: `CHANGELOG entry: Added a new tab for users to see their NFTs` `CHANGELOG entry: Fixed a bug that was causing some NFTs to flicker` (This helps the Release Engineer do their job more quickly and accurately) --> CHANGELOG entry: ## **Related issues** Fixes: ## **Manual testing steps** ```gherkin Feature: my feature name Scenario: user [verb for user action] Given [describe expected initial app state] When user [verb for user action] Then [describe expected outcome] ``` ## **Screenshots/Recordings** <!-- If applicable, add screenshots and/or recordings to visualize the before and after of your change. --> ### **Before** <!-- [screenshots/recordings] --> ### **After** <!-- [screenshots/recordings] --> ## **Pre-merge author checklist** - [ ] I've followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile Coding Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md). - [ ] I've completed the PR template to the best of my ability - [ ] I've included tests if applicable - [ ] I've documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [ ] I've applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. ## **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. <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Medium Risk** > Modifies the GitHub Actions build workflow and artifact renaming script; incorrect sourcemap paths or conditions could cause missing artifacts or noisy CI warnings in release builds. > > **Overview** > Adds **sourcemap artifact publishing** to the GitHub Actions `build` workflow: iOS device builds now upload `ios-sourcemaps-<build-name>`, and Android non-Debug builds upload `android-sourcemaps-<build-name>`. > > Updates `scripts/rename-artifacts.js` to expose `ios_sourcemap_path` and `android_sourcemap_dir` as step outputs used by the workflow, and refreshes profiling docs to point to sourcemaps from either Bitrise or GitHub Actions artifacts. > > Bumps build numbers from `3821` to `3911` in `bitrise.yml` and the iOS Xcode project. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 30d4239. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY --> --------- Co-authored-by: metamaskbot <metamaskbot@users.noreply.github.com>
1 parent c4ccc70 commit e038f30

5 files changed

Lines changed: 46 additions & 9 deletions

File tree

.github/workflows/build.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,14 @@ jobs:
330330
${{ steps.rename.outputs.ios_archive_path }}
331331
if-no-files-found: error
332332

333+
- name: Upload iOS sourcemap
334+
if: matrix.platform == 'ios' && env.IS_SIM_BUILD != 'true'
335+
uses: actions/upload-artifact@v4
336+
with:
337+
name: ios-sourcemaps-${{ inputs.build_name }}
338+
path: ${{ steps.rename.outputs.ios_sourcemap_path }}
339+
if-no-files-found: warn
340+
333341
# Dev builds (CONFIGURATION=Debug): APK only — mirrors Bitrise IS_DEV_BUILD behavior
334342
- name: Upload Android dev artifacts
335343
if: matrix.platform == 'android' && env.CONFIGURATION == 'Debug'
@@ -349,3 +357,12 @@ jobs:
349357
${{ steps.rename.outputs.android_apk_path }}
350358
${{ steps.rename.outputs.android_aab_path }}
351359
if-no-files-found: error
360+
361+
# Non-Debug builds (prod, RC, beta, test, e2e, exp): sourcemaps — mirrors Bitrise Deploy Android Sourcemaps step
362+
- name: Upload Android sourcemaps
363+
if: matrix.platform == 'android' && env.CONFIGURATION != 'Debug'
364+
uses: actions/upload-artifact@v4
365+
with:
366+
name: android-sourcemaps-${{ inputs.build_name }}
367+
path: ${{ steps.rename.outputs.android_sourcemap_dir }}
368+
if-no-files-found: warn

bitrise.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3534,13 +3534,13 @@ app:
35343534
VERSION_NAME: 7.70.0
35353535
- opts:
35363536
is_expand: false
3537-
VERSION_NUMBER: 3821
3537+
VERSION_NUMBER: 3911
35383538
- opts:
35393539
is_expand: false
35403540
FLASK_VERSION_NAME: 7.70.0
35413541
- opts:
35423542
is_expand: false
3543-
FLASK_VERSION_NUMBER: 3821
3543+
FLASK_VERSION_NUMBER: 3911
35443544
- opts:
35453545
is_expand: false
35463546
ANDROID_APK_LINK: ''

docs/readme/release-build-profiler.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,10 @@ To have sourcemaps on the tracing, to be easier to identify the processes that a
4343
yarn react-native-release-profiler --local /path/to/profile.cpuprofile --sourcemap-path /path/to/sourcemaps
4444
```
4545

46-
You can find the sourcemaps at the artifcacts generated when running `release_rc_builds_to_store_pipeline` in bitrise, under the name `Android_Sourcemaps_prodRelease.zip`, download and unzip it.
46+
You can find the sourcemaps in the artifacts of the build that produced the APK/IPA:
47+
48+
- **Bitrise**: artifacts generated by `release_rc_builds_to_store_pipeline`, under the name `Android_Sourcemaps_prodRelease.zip`. Download and unzip it.
49+
- **GitHub Actions**: artifacts uploaded by the `build` workflow, under the name `android-sourcemaps-<build-name>` (Android) or `ios-sourcemaps-<build-name>` (iOS). Download and unzip the artifact.
4750

4851
Then open Chrome and load the generated JSON:
4952

ios/MetaMask.xcodeproj/project.pbxproj

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1281,7 +1281,7 @@
12811281
CODE_SIGN_IDENTITY = "Apple Development";
12821282
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
12831283
CODE_SIGN_STYLE = Manual;
1284-
CURRENT_PROJECT_VERSION = 3821;
1284+
CURRENT_PROJECT_VERSION = 3911;
12851285
DEAD_CODE_STRIPPING = YES;
12861286
DEBUG_INFORMATION_FORMAT = dwarf;
12871287
DEVELOPMENT_TEAM = 48XVW22RCG;
@@ -1350,7 +1350,7 @@
13501350
CODE_SIGN_ENTITLEMENTS = MetaMask/MetaMask.entitlements;
13511351
CODE_SIGN_IDENTITY = "iPhone Distribution";
13521352
CODE_SIGN_STYLE = Manual;
1353-
CURRENT_PROJECT_VERSION = 3821;
1353+
CURRENT_PROJECT_VERSION = 3911;
13541354
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
13551355
DEVELOPMENT_TEAM = 48XVW22RCG;
13561356
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = 48XVW22RCG;
@@ -1416,7 +1416,7 @@
14161416
CODE_SIGN_IDENTITY = "Apple Development";
14171417
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
14181418
CODE_SIGN_STYLE = Manual;
1419-
CURRENT_PROJECT_VERSION = 3821;
1419+
CURRENT_PROJECT_VERSION = 3911;
14201420
DEAD_CODE_STRIPPING = YES;
14211421
DEBUG_INFORMATION_FORMAT = dwarf;
14221422
DEVELOPMENT_TEAM = 48XVW22RCG;
@@ -1483,7 +1483,7 @@
14831483
CODE_SIGN_ENTITLEMENTS = MetaMask/MetaMask.entitlements;
14841484
CODE_SIGN_IDENTITY = "iPhone Distribution";
14851485
CODE_SIGN_STYLE = Manual;
1486-
CURRENT_PROJECT_VERSION = 3821;
1486+
CURRENT_PROJECT_VERSION = 3911;
14871487
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
14881488
DEVELOPMENT_TEAM = 48XVW22RCG;
14891489
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = 48XVW22RCG;
@@ -1646,7 +1646,7 @@
16461646
CODE_SIGN_IDENTITY = "Apple Development";
16471647
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
16481648
CODE_SIGN_STYLE = Manual;
1649-
CURRENT_PROJECT_VERSION = 3821;
1649+
CURRENT_PROJECT_VERSION = 3911;
16501650
DEAD_CODE_STRIPPING = YES;
16511651
DEBUG_INFORMATION_FORMAT = dwarf;
16521652
DEVELOPMENT_TEAM = 48XVW22RCG;
@@ -1716,7 +1716,7 @@
17161716
CODE_SIGN_ENTITLEMENTS = MetaMask/MetaMask.entitlements;
17171717
CODE_SIGN_IDENTITY = "iPhone Distribution";
17181718
CODE_SIGN_STYLE = Manual;
1719-
CURRENT_PROJECT_VERSION = 3821;
1719+
CURRENT_PROJECT_VERSION = 3911;
17201720
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
17211721
DEVELOPMENT_TEAM = 48XVW22RCG;
17221722
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = 48XVW22RCG;

scripts/rename-artifacts.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,16 @@ function renameAndroid() {
132132
}
133133
}
134134

135+
// Expose sourcemap directory for all non-Debug builds (prod, RC, beta, test, e2e, exp)
136+
if (buildConfig === 'release') {
137+
const sourcemapDir = path.join(
138+
__dirname,
139+
`../android/app/build/generated/sourcemaps/react/${appFlavor}Release`,
140+
);
141+
setGithubOutput('android_sourcemap_dir', sourcemapDir);
142+
console.log(`✅ Sourcemap dir: ${sourcemapDir}`);
143+
}
144+
135145
// List final artifacts
136146
console.log('📦 Final artifacts:');
137147
const outputDir = path.join(__dirname, '../android/app/build/outputs');
@@ -230,6 +240,13 @@ function renameIos() {
230240
console.log(`⚠️ Binary not found: ${oldBinary}`);
231241
}
232242

243+
// Expose sourcemap path for device builds (mirrors Bitrise's Deploy Source Map step)
244+
if (!isSimBuild) {
245+
const sourcemapPath = path.join(__dirname, '../sourcemaps/ios/index.js.map');
246+
setGithubOutput('ios_sourcemap_path', sourcemapPath);
247+
console.log(`✅ Sourcemap path: ${sourcemapPath}`);
248+
}
249+
233250
// Rename xcarchive (only for device builds)
234251
if (!isSimBuild) {
235252
const oldArchive = path.join(__dirname, `../ios/build/${appName}.xcarchive`);

0 commit comments

Comments
 (0)