Skip to content

Commit 553198a

Browse files
authored
Size analysis for React Native SDK (#5949)
* Size analysis for React Native SDK * fix(ci): Add missing RN_SENTRY_POD_NAME env var to size analysis workflow The pod-install.sh script greps Podfile.lock for $RN_SENTRY_POD_NAME to verify the Sentry pod was installed. Without this env var set, grep receives an empty pattern and exits with code 2, failing the iOS job. Set RN_SENTRY_POD_NAME=RNSentry in the workflow env block, matching the sample-application.yml workflow.
1 parent 7596131 commit 553198a

File tree

1 file changed

+165
-0
lines changed

1 file changed

+165
-0
lines changed
Lines changed: 165 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,165 @@
1+
name: Size Analysis
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- 'packages/**'
9+
- 'samples/react-native/**'
10+
- '.github/workflows/size-analysis.yml'
11+
pull_request:
12+
paths:
13+
- 'packages/**'
14+
- 'samples/react-native/**'
15+
- '.github/workflows/size-analysis.yml'
16+
17+
concurrency:
18+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
19+
cancel-in-progress: true
20+
21+
env:
22+
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
23+
SENTRY_ORG: sentry-sdks
24+
SENTRY_PROJECT: sentry-react-native
25+
REACT_NATIVE_SAMPLE_PATH: samples/react-native
26+
RN_SENTRY_POD_NAME: RNSentry
27+
28+
jobs:
29+
android:
30+
name: Android Size Analysis
31+
runs-on: ubuntu-latest
32+
timeout-minutes: 30
33+
34+
steps:
35+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
36+
37+
- name: Enable Corepack (NPM)
38+
run: npm i -g corepack
39+
40+
- uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6
41+
with:
42+
package-manager-cache: false
43+
node-version: 18
44+
cache: 'yarn'
45+
cache-dependency-path: yarn.lock
46+
47+
- uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5
48+
with:
49+
java-version: '17'
50+
distribution: 'adopt'
51+
52+
- name: Gradle cache
53+
uses: gradle/gradle-build-action@ac2d340dc04d9e1113182899e983b5400c17cda1 # v3.5.0
54+
55+
- name: Install SDK Dependencies
56+
run: yarn install
57+
58+
- name: Build SDK
59+
run: yarn build
60+
61+
- name: Build Android App Bundle (Release)
62+
working-directory: ${{ env.REACT_NATIVE_SAMPLE_PATH }}/android
63+
env:
64+
SENTRY_DISABLE_AUTO_UPLOAD: 'true'
65+
RN_ARCHITECTURE: 'new'
66+
run: |
67+
perl -i -pe's/newArchEnabled=false/newArchEnabled=true/g' gradle.properties
68+
./gradlew :app:bundleRelease -PreactNativeArchitectures=arm64-v8a
69+
70+
- name: Install Sentry CLI
71+
if: env.SENTRY_AUTH_TOKEN != ''
72+
run: curl -sL https://sentry.io/get-cli/ | sh
73+
74+
- name: Upload Android Bundle to Sentry Size Analysis
75+
if: env.SENTRY_AUTH_TOKEN != ''
76+
run: |
77+
sentry-cli build upload \
78+
"${{ env.REACT_NATIVE_SAMPLE_PATH }}/android/app/build/outputs/bundle/release/app-release.aab" \
79+
--org "${{ env.SENTRY_ORG }}" \
80+
--project "${{ env.SENTRY_PROJECT }}" \
81+
--build-configuration "Release"
82+
83+
ios:
84+
name: iOS Size Analysis
85+
runs-on: ["ghcr.io/cirruslabs/macos-tahoe-xcode:26.2.0", "runner_group_id:10"]
86+
timeout-minutes: 45
87+
88+
steps:
89+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
90+
91+
- name: Enable Corepack
92+
run: corepack enable
93+
94+
- uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6
95+
with:
96+
package-manager-cache: false
97+
node-version: 18
98+
cache: 'yarn'
99+
cache-dependency-path: yarn.lock
100+
101+
- uses: ruby/setup-ruby@v1
102+
with:
103+
working-directory: ${{ env.REACT_NATIVE_SAMPLE_PATH }}
104+
ruby-version: '3.3.0'
105+
bundler-cache: true
106+
cache-version: 1
107+
108+
- name: Setup Global Xcode Tools
109+
run: which xcbeautify || brew install xcbeautify
110+
111+
- name: Install SDK Dependencies
112+
run: yarn install
113+
114+
- name: Build SDK
115+
run: yarn build
116+
117+
- name: Install App Pods
118+
working-directory: ${{ env.REACT_NATIVE_SAMPLE_PATH }}
119+
run: |
120+
export ENABLE_PROD=1
121+
export ENABLE_NEW_ARCH=1
122+
./scripts/pod-install.sh
123+
124+
- name: Build iOS XCArchive
125+
working-directory: ${{ env.REACT_NATIVE_SAMPLE_PATH }}/ios
126+
env:
127+
SENTRY_DISABLE_AUTO_UPLOAD: 'true'
128+
# Fix for Xcode 26+ with MetalToolchain
129+
TOOLCHAINS: com.apple.dt.toolchain.XcodeDefault
130+
run: |
131+
mkdir -p "DerivedData"
132+
derivedData="$(cd "DerivedData" ; pwd -P)"
133+
set -o pipefail && xcodebuild \
134+
-workspace sentryreactnativesample.xcworkspace \
135+
-configuration Release \
136+
-scheme sentryreactnativesample \
137+
-sdk iphoneos \
138+
-destination 'generic/platform=iOS' \
139+
-archivePath "$derivedData/sentryreactnativesample.xcarchive" \
140+
ONLY_ACTIVE_ARCH=NO \
141+
CODE_SIGNING_ALLOWED=NO \
142+
archive \
143+
| tee xcodebuild-size-analysis.log \
144+
| xcbeautify --quieter --is-ci --disable-colored-output
145+
146+
- name: Install Sentry CLI
147+
if: env.SENTRY_AUTH_TOKEN != ''
148+
run: curl -sL https://sentry.io/get-cli/ | sh
149+
150+
- name: Upload iOS XCArchive to Sentry Size Analysis
151+
if: env.SENTRY_AUTH_TOKEN != ''
152+
working-directory: ${{ env.REACT_NATIVE_SAMPLE_PATH }}/ios
153+
run: |
154+
sentry-cli build upload \
155+
"DerivedData/sentryreactnativesample.xcarchive" \
156+
--org "${{ env.SENTRY_ORG }}" \
157+
--project "${{ env.SENTRY_PROJECT }}" \
158+
--build-configuration "Release"
159+
160+
- name: Upload logs
161+
if: ${{ always() }}
162+
uses: actions/upload-artifact@v7
163+
with:
164+
name: size-analysis-ios-logs
165+
path: ${{ env.REACT_NATIVE_SAMPLE_PATH }}/ios/xcodebuild-size-analysis.log

0 commit comments

Comments
 (0)