From 58b921b688b93799f338203fbf806700c3d6ec20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hanno=20J=2E=20G=C3=B6decke?= Date: Wed, 19 Jun 2024 11:15:18 +0200 Subject: [PATCH 1/3] Revert "Revert "fix: CI upload source maps when deploying a new app version"" This reverts commit fb23d524c293cd563e56b15c180100728430efbb. --- .github/workflows/platformDeploy.yml | 2 +- ios/.xcode.env | 5 +++++ workflow_tests/assertions/platformDeployAssertions.ts | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/platformDeploy.yml b/.github/workflows/platformDeploy.yml index 5ceb760a452b..20bf0d257a9b 100644 --- a/.github/workflows/platformDeploy.yml +++ b/.github/workflows/platformDeploy.yml @@ -97,7 +97,7 @@ jobs: uses: actions/upload-artifact@v3 with: name: android-sourcemap - path: android/app/build/generated/sourcemaps/react/release/*.map + path: android/app/build/generated/sourcemaps/react/productionRelease/index.android.bundle.map - name: Upload Android version to GitHub artifacts if: ${{ !fromJSON(env.SHOULD_DEPLOY_PRODUCTION) }} diff --git a/ios/.xcode.env b/ios/.xcode.env index 3d5782c71568..0ef3f59d606a 100644 --- a/ios/.xcode.env +++ b/ios/.xcode.env @@ -9,3 +9,8 @@ # For example, to use nvm with brew, add the following line # . "$(brew --prefix nvm)/nvm.sh" --no-use export NODE_BINARY=$(command -v node) + +# Provide a sourcemap path so that in release builds a source map file will be +# created at the specified location. +# (RN's default behaviour on iOS is to skip creating a sourcemap file): +export SOURCEMAP_FILE="$(pwd)/../main.jsbundle.map"; diff --git a/workflow_tests/assertions/platformDeployAssertions.ts b/workflow_tests/assertions/platformDeployAssertions.ts index 24bb91f001f6..03fdcc86ee94 100644 --- a/workflow_tests/assertions/platformDeployAssertions.ts +++ b/workflow_tests/assertions/platformDeployAssertions.ts @@ -64,7 +64,7 @@ function assertAndroidJobExecuted(workflowResult: Step[], didExecute = true, isP steps.push( createStepAssertion('Archive Android sourcemaps', true, null, 'ANDROID', 'Archiving Android sourcemaps', [ {key: 'name', value: 'android-sourcemap'}, - {key: 'path', value: 'android/app/build/generated/sourcemaps/react/release/*.map'}, + {key: 'path', value: 'android/app/build/generated/sourcemaps/react/productionRelease/index.android.bundle.map'}, ]), ); if (!isProduction) { From 6ed05f6fa188fe6382c078aac68e1c15c63d1bc7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hanno=20J=2E=20G=C3=B6decke?= Date: Wed, 19 Jun 2024 15:47:27 +0200 Subject: [PATCH 2/3] apply patch for fixing whitespace support in sourcemap path on iOS The patch is part of react-native 0.75 in this commit: https://github.com/facebook/react-native/commit/e25a9b4c5d0e4c32dbc1eca071911e34faa177ce --- ...iOS-fix-whitespace-support-sourcemap.patch | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 patches/react-native+0.73.4+017+iOS-fix-whitespace-support-sourcemap.patch diff --git a/patches/react-native+0.73.4+017+iOS-fix-whitespace-support-sourcemap.patch b/patches/react-native+0.73.4+017+iOS-fix-whitespace-support-sourcemap.patch new file mode 100644 index 000000000000..e8ca87026282 --- /dev/null +++ b/patches/react-native+0.73.4+017+iOS-fix-whitespace-support-sourcemap.patch @@ -0,0 +1,37 @@ +diff --git a/node_modules/react-native/scripts/react-native-xcode.sh b/node_modules/react-native/scripts/react-native-xcode.sh +index d6c382b..3e1742c 100755 +--- a/node_modules/react-native/scripts/react-native-xcode.sh ++++ b/node_modules/react-native/scripts/react-native-xcode.sh +@@ -104,7 +104,7 @@ fi + + BUNDLE_FILE="$CONFIGURATION_BUILD_DIR/main.jsbundle" + +-EXTRA_ARGS= ++EXTRA_ARGS=() + + case "$PLATFORM_NAME" in + "macosx") +@@ -131,12 +131,12 @@ if [[ $EMIT_SOURCEMAP == true ]]; then + else + PACKAGER_SOURCEMAP_FILE="$SOURCEMAP_FILE" + fi +- EXTRA_ARGS="$EXTRA_ARGS --sourcemap-output $PACKAGER_SOURCEMAP_FILE" ++ EXTRA_ARGS+=("--sourcemap-output" "$PACKAGER_SOURCEMAP_FILE") + fi + + # Hermes doesn't require JS minification. + if [[ $USE_HERMES != false && $DEV == false ]]; then +- EXTRA_ARGS="$EXTRA_ARGS --minify false" ++ EXTRA_ARGS+=("--minify" "false") + fi + + "$NODE_BINARY" $NODE_ARGS "$CLI_PATH" $BUNDLE_COMMAND \ +@@ -147,7 +147,7 @@ fi + --reset-cache \ + --bundle-output "$BUNDLE_FILE" \ + --assets-dest "$DEST" \ +- $EXTRA_ARGS \ ++ "${EXTRA_ARGS[@]}" \ + $EXTRA_PACKAGER_ARGS + + if [[ $USE_HERMES == false ]]; then From c2ff42f4a8006550b3ce5a63204a4a0a97e55dab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hanno=20J=2E=20G=C3=B6decke?= Date: Wed, 19 Jun 2024 16:31:21 +0200 Subject: [PATCH 3/3] uploaded sourcemap names contain app version --- .github/workflows/platformDeploy.yml | 4 ++-- workflow_tests/assertions/platformDeployAssertions.ts | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/platformDeploy.yml b/.github/workflows/platformDeploy.yml index 20bf0d257a9b..91203a65b5ce 100644 --- a/.github/workflows/platformDeploy.yml +++ b/.github/workflows/platformDeploy.yml @@ -96,7 +96,7 @@ jobs: - name: Archive Android sourcemaps uses: actions/upload-artifact@v3 with: - name: android-sourcemap + name: android-sourcemap-${{ github.ref_name }} path: android/app/build/generated/sourcemaps/react/productionRelease/index.android.bundle.map - name: Upload Android version to GitHub artifacts @@ -248,7 +248,7 @@ jobs: - name: Archive iOS sourcemaps uses: actions/upload-artifact@v3 with: - name: ios-sourcemap + name: ios-sourcemap-${{ github.ref_name }} path: main.jsbundle.map - name: Upload iOS version to GitHub artifacts diff --git a/workflow_tests/assertions/platformDeployAssertions.ts b/workflow_tests/assertions/platformDeployAssertions.ts index 03fdcc86ee94..0df3e46d9b81 100644 --- a/workflow_tests/assertions/platformDeployAssertions.ts +++ b/workflow_tests/assertions/platformDeployAssertions.ts @@ -63,7 +63,8 @@ function assertAndroidJobExecuted(workflowResult: Step[], didExecute = true, isP } steps.push( createStepAssertion('Archive Android sourcemaps', true, null, 'ANDROID', 'Archiving Android sourcemaps', [ - {key: 'name', value: 'android-sourcemap'}, + // Note 1.2.3 comes from the ref name that we are on, which is the version we are deploying + {key: 'name', value: 'android-sourcemap-1.2.3'}, {key: 'path', value: 'android/app/build/generated/sourcemaps/react/productionRelease/index.android.bundle.map'}, ]), ); @@ -187,7 +188,8 @@ function assertIOSJobExecuted(workflowResult: Step[], didExecute = true, isProdu } steps.push( createStepAssertion('Archive iOS sourcemaps', true, null, 'IOS', 'Archiving sourcemaps', [ - {key: 'name', value: 'ios-sourcemap'}, + // Note 1.2.3 comes from the ref name that we are on, which is the version we are deploying + {key: 'name', value: 'ios-sourcemap-1.2.3'}, {key: 'path', value: 'main.jsbundle.map'}, ]), );