Skip to content

Commit 454f971

Browse files
Merge b754aa3 into 3f05680
2 parents 3f05680 + b754aa3 commit 454f971

File tree

79 files changed

+4066
-830
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

79 files changed

+4066
-830
lines changed

.github/workflows/sample-application.yml

Lines changed: 171 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@ concurrency:
1414
env:
1515
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
1616
RN_SENTRY_POD_NAME: RNSentry
17+
IOS_APP_ARCHIVE_PATH: sentry-react-native-sample.app.zip
18+
ANDROID_APP_ARCHIVE_PATH: sentry-react-native-sample.apk.zip
19+
REACT_NATIVE_SAMPLE_PATH: samples/react-native
20+
IOS_DEVICE: 'iPhone 16'
21+
IOS_VERSION: '18.1'
22+
ANDROID_API_LEVEL: '30'
1723

1824
jobs:
1925
diff_check:
@@ -66,7 +72,7 @@ jobs:
6672
- uses: ruby/setup-ruby@v1
6773
if: ${{ matrix.platform == 'ios' || matrix.platform == 'macos' }}
6874
with:
69-
working-directory: ${{ matrix.platform == 'ios' && ' samples/react-native' || ' samples/react-native-macos' }}
75+
working-directory: ${{ matrix.platform == 'ios' && env.REACT_NATIVE_SAMPLE_PATH || ' samples/react-native-macos' }}
7076
ruby-version: '3.3.0' # based on what is used in the sample
7177
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
7278
cache-version: 1 # cache the installed gems
@@ -106,8 +112,10 @@ jobs:
106112
107113
- name: Build Android App
108114
if: ${{ matrix.platform == 'android' }}
109-
working-directory: samples/react-native/android
115+
working-directory: ${{ env.REACT_NATIVE_SAMPLE_PATH }}/android
110116
run: |
117+
../scripts/set-aos-dsn.mjs
118+
111119
if [[ ${{ matrix.rn-architecture }} == 'new' ]]; then
112120
perl -i -pe's/newArchEnabled=false/newArchEnabled=true/g' gradle.properties
113121
echo 'New Architecture enabled'
@@ -119,12 +127,17 @@ jobs:
119127
fi
120128
[[ "${{ matrix.build-type }}" == "production" ]] && CONFIG='Release' || CONFIG='Debug'
121129
echo "Building $CONFIG"
122-
./gradlew ":app:assemble$CONFIG" -PreactNativeArchitectures=x86
130+
[[ "${{ matrix.build-type }}" == "production" ]] && TEST_TYPE='release' || TEST_TYPE='debug'
131+
echo "Building $TEST_TYPE"
132+
133+
./gradlew ":app:assemble$CONFIG" app:assembleAndroidTest -DtestBuildType=$TEST_TYPE -PreactNativeArchitectures=x86
123134
124135
- name: Build iOS App
125136
if: ${{ matrix.platform == 'ios' }}
126-
working-directory: samples/react-native/ios
137+
working-directory: ${{ env.REACT_NATIVE_SAMPLE_PATH }}/ios
127138
run: |
139+
../scripts/set-ios-dsn.mjs
140+
128141
[[ "${{ matrix.build-type }}" == "production" ]] && CONFIG='Release' || CONFIG='Debug'
129142
echo "Building $CONFIG"
130143
mkdir -p "DerivedData"
@@ -160,9 +173,162 @@ jobs:
160173
| tee xcodebuild.log \
161174
| xcbeautify --quieter --is-ci --disable-colored-output
162175
176+
- name: Archive iOS App
177+
if: ${{ matrix.platform == 'ios' && matrix.rn-architecture == 'new' && matrix.build-type == 'production' && matrix.ios-use-frameworks == 'no-frameworks' }}
178+
run: |
179+
cd ${{ env.REACT_NATIVE_SAMPLE_PATH }}/ios/DerivedData/Build/Products/Release-iphonesimulator
180+
zip -r \
181+
${{ github.workspace }}/${{ env.IOS_APP_ARCHIVE_PATH }} \
182+
sentryreactnativesample.app
183+
184+
- name: Archive Android App
185+
if: ${{ matrix.platform == 'android' && matrix.rn-architecture == 'new' && matrix.build-type == 'production' }}
186+
run: |
187+
mv ${{ env.REACT_NATIVE_SAMPLE_PATH }}/android/app/build/outputs/apk/release/app-release.apk app.apk
188+
mv ${{ env.REACT_NATIVE_SAMPLE_PATH }}/android/app/build/outputs/apk/androidTest/release/app-release-androidTest.apk app-androidTest.apk
189+
zip -j \
190+
${{ env.ANDROID_APP_ARCHIVE_PATH }} \
191+
app.apk \
192+
app-androidTest.apk
193+
194+
- name: Upload iOS APP
195+
if: ${{ matrix.platform == 'ios' && matrix.rn-architecture == 'new' && matrix.build-type == 'production' && matrix.ios-use-frameworks == 'no-frameworks' }}
196+
uses: actions/upload-artifact@v4
197+
with:
198+
name: sample-rn-${{ matrix.rn-architecture }}-${{ matrix.build-type }}-${{ matrix.ios-use-frameworks}}-${{ matrix.platform }}
199+
path: ${{ env.IOS_APP_ARCHIVE_PATH }}
200+
retention-days: 1
201+
202+
- name: Upload Android APK
203+
if: ${{ matrix.platform == 'android' && matrix.rn-architecture == 'new' && matrix.build-type == 'production' }}
204+
uses: actions/upload-artifact@v4
205+
with:
206+
name: sample-rn-${{ matrix.rn-architecture }}-${{ matrix.build-type }}-${{ matrix.platform }}
207+
path: ${{ env.ANDROID_APP_ARCHIVE_PATH }}
208+
retention-days: 1
209+
163210
- name: Upload logs
164211
if: ${{ always() }}
165212
uses: actions/upload-artifact@v4
166213
with:
167214
name: build-sample-${{ matrix.rn-architecture }}-${{ matrix.platform }}-${{ matrix.build-type }}-${{ matrix.ios-use-frameworks}}-logs
168-
path: samples/react-native/${{ matrix.platform }}/*.log
215+
path: ${{ env.REACT_NATIVE_SAMPLE_PATH }}/${{ matrix.platform }}/*.log
216+
217+
test:
218+
name: Test ${{ matrix.platform }} ${{ matrix.build-type }}
219+
runs-on: ${{ matrix.runs-on }}
220+
needs: [diff_check, build]
221+
if: ${{ needs.diff_check.outputs.skip_ci != 'true' }}
222+
strategy:
223+
# we want that the matrix keeps running, default is to cancel them if it fails.
224+
fail-fast: false
225+
matrix:
226+
include:
227+
- platform: ios
228+
runs-on: macos-15
229+
rn-architecture: 'new'
230+
ios-use-frameworks: 'no-frameworks'
231+
build-type: 'production'
232+
233+
- platform: android
234+
runs-on: ubuntu-latest
235+
rn-architecture: 'new'
236+
build-type: 'production'
237+
238+
steps:
239+
- uses: actions/checkout@v4
240+
241+
- name: Download iOS App Archive
242+
if: ${{ matrix.platform == 'ios' }}
243+
uses: actions/download-artifact@v4
244+
with:
245+
name: sample-rn-${{ matrix.rn-architecture }}-${{ matrix.build-type }}-${{ matrix.ios-use-frameworks}}-${{ matrix.platform }}
246+
path: ${{ env.REACT_NATIVE_SAMPLE_PATH }}
247+
248+
- name: Download Android APK
249+
if: ${{ matrix.platform == 'android' }}
250+
uses: actions/download-artifact@v4
251+
with:
252+
name: sample-rn-${{ matrix.rn-architecture }}-${{ matrix.build-type }}-${{ matrix.platform }}
253+
path: ${{ env.REACT_NATIVE_SAMPLE_PATH }}
254+
255+
- name: Unzip iOS App Archive
256+
if: ${{ matrix.platform == 'ios' }}
257+
working-directory: ${{ env.REACT_NATIVE_SAMPLE_PATH }}
258+
run: unzip ${{ env.IOS_APP_ARCHIVE_PATH }}
259+
260+
- name: Unzip Android APK
261+
if: ${{ matrix.platform == 'android' }}
262+
working-directory: ${{ env.REACT_NATIVE_SAMPLE_PATH }}
263+
run: unzip ${{ env.ANDROID_APP_ARCHIVE_PATH }}
264+
265+
- name: Enable Corepack
266+
run: |
267+
npm install -g corepack@0.29.4
268+
corepack enable
269+
- uses: actions/setup-node@v4
270+
with:
271+
node-version: 18
272+
cache: 'yarn'
273+
cache-dependency-path: yarn.lock
274+
275+
- name: Install JS Dependencies
276+
run: yarn install
277+
278+
- name: Install Detox
279+
run: npm install -g detox-cli@20.0.0
280+
281+
- name: Install Apple Simulator Utilities
282+
if: ${{ matrix.platform == 'ios' }}
283+
run: |
284+
brew tap wix/brew
285+
brew install applesimutils
286+
287+
- name: Setup KVM
288+
if: ${{ matrix.platform == 'android' }}
289+
shell: bash
290+
run: |
291+
# check if virtualization is supported...
292+
sudo apt install -y --no-install-recommends cpu-checker coreutils && echo "CPUs=$(nproc --all)" && kvm-ok
293+
# allow access to KVM to run the emulator
294+
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' \
295+
| sudo tee /etc/udev/rules.d/99-kvm4all.rules
296+
sudo udevadm control --reload-rules
297+
sudo udevadm trigger --name-match=kvm
298+
299+
- uses: futureware-tech/simulator-action@dab10d813144ef59b48d401cd95da151222ef8cd # pin@v4
300+
if: ${{ matrix.platform == 'ios' }}
301+
with:
302+
# the same envs are used by Detox ci.sim configuration
303+
model: ${{ env.IOS_DEVICE }}
304+
os_version: ${{ env.IOS_VERSION }}
305+
306+
- name: Run Detox iOS Tests
307+
if: ${{ matrix.platform == 'ios' }}
308+
working-directory: ${{ env.REACT_NATIVE_SAMPLE_PATH }}
309+
run: detox test --configuration ci.sim
310+
311+
- name: Run tests on Android
312+
if: ${{ matrix.platform == 'android' }}
313+
env:
314+
# used by Detox ci.android configuration
315+
ANDROID_AVD_NAME: 'test' # test is default reactivecircus/android-emulator-runner name
316+
uses: reactivecircus/android-emulator-runner@62dbb605bba737720e10b196cb4220d374026a6d # pin@v2.33.0
317+
with:
318+
api-level: ${{ env.ANDROID_API_LEVEL }}
319+
force-avd-creation: false
320+
disable-animations: true
321+
disable-spellchecker: true
322+
target: 'aosp_atd'
323+
channel: canary # Necessary for ATDs
324+
emulator-options: >
325+
-no-window
326+
-no-snapshot-save
327+
-gpu swiftshader_indirect
328+
-noaudio
329+
-no-boot-anim
330+
-camera-back none
331+
-camera-front none
332+
-timezone US/Pacific
333+
working-directory: ${{ env.REACT_NATIVE_SAMPLE_PATH }}
334+
script: detox test --configuration ci.android

CHANGELOG.md

Lines changed: 53 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,59 @@
66
> make sure you follow our [migration guide](https://docs.sentry.io/platforms/react-native/migration/) first.
77
<!-- prettier-ignore-end -->
88
9-
## Unreleased
9+
## 6.7.0-alpha.0
10+
11+
### Features
12+
13+
- Capture App Start errors and crashes by initializing Sentry from `sentry.options.json` ([#4472](https://github.com/getsentry/sentry-react-native/pull/4472))
14+
15+
Create `sentry.options.json` in the React Native project root and set options the same as you currently have in `Sentry.init` in JS.
16+
17+
```json
18+
{
19+
"dsn": "https://key@example.io/value",
20+
}
21+
```
22+
23+
Initialize Sentry on the native layers by newly provided native methods.
24+
25+
```kotlin
26+
import io.sentry.react.RNSentrySDK
27+
28+
class MainApplication : Application(), ReactApplication {
29+
override fun onCreate() {
30+
super.onCreate()
31+
RNSentrySDK.init(this)
32+
}
33+
}
34+
```
35+
36+
```obj-c
37+
#import <RNSentry/RNSentry.h>
38+
39+
@implementation AppDelegate
40+
- (BOOL)application:(UIApplication *)application
41+
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
42+
{
43+
[RNSentrySDK start];
44+
return [super application:application didFinishLaunchingWithOptions:launchOptions];
45+
}
46+
@end
47+
```
48+
49+
### Changes
50+
51+
- Load `optionsFile` into the JS bundle during Metro bundle process ([#4476](https://github.com/getsentry/sentry-react-native/pull/4476))
52+
- Add experimental version of `startWithConfigureOptions` for Apple platforms ([#4444](https://github.com/getsentry/sentry-react-native/pull/4444))
53+
- Add experimental version of `init` with optional `OptionsConfiguration<SentryAndroidOptions>` for Android ([#4451](https://github.com/getsentry/sentry-react-native/pull/4451))
54+
- Add initialization using `sentry.options.json` for Apple platforms ([#4447](https://github.com/getsentry/sentry-react-native/pull/4447))
55+
- Add initialization using `sentry.options.json` for Android ([#4451](https://github.com/getsentry/sentry-react-native/pull/4451))
56+
- Merge options from file with `Sentry.init` options in JS ([#4510](https://github.com/getsentry/sentry-react-native/pull/4510))
57+
58+
### Internal
59+
60+
- Extract iOS native initialization to standalone structures ([#4442](https://github.com/getsentry/sentry-react-native/pull/4442))
61+
- Extract Android native initialization to standalone structures ([#4445](https://github.com/getsentry/sentry-react-native/pull/4445))
1062
1163
### Features
1264

lerna.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@
88
"performance-tests/*"
99
],
1010
"npmClient": "yarn"
11-
}
11+
}

packages/core/RNSentry.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ Pod::Spec.new do |s|
3333
s.preserve_paths = '*.js'
3434

3535
s.source_files = 'ios/**/*.{h,m,mm}'
36-
s.public_header_files = 'ios/RNSentry.h'
36+
s.public_header_files = 'ios/RNSentry.h', 'ios/RNSentrySDK.h'
3737

3838
s.compiler_flags = other_cflags
3939

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"dsn": "invalid-dsn"
3+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
invalid-options
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"dsn": "https://abcd@efgh.ingest.sentry.io/123456",
3+
"enableTracing": true,
4+
"tracesSampleRate": 1.0
5+
}

0 commit comments

Comments
 (0)