Skip to content

Commit 482b3fb

Browse files
Merge d05e789 into f2c6fa5
2 parents f2c6fa5 + d05e789 commit 482b3fb

File tree

104 files changed

+4747
-727
lines changed

Some content is hidden

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

104 files changed

+4747
-727
lines changed

.github/workflows/sample-application.yml

Lines changed: 152 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -98,62 +98,39 @@ jobs:
9898
if: ${{ matrix.platform == 'ios' || matrix.platform == 'macos' }}
9999
working-directory: samples
100100
run: |
101-
[[ "${{ matrix.platform }}" == "ios" ]] && cd react-native/ios
102-
[[ "${{ matrix.platform }}" == "macos" ]] && cd react-native-macos/macos
101+
[[ "${{ matrix.platform }}" == "ios" ]] && cd react-native
102+
[[ "${{ matrix.platform }}" == "macos" ]] && cd react-native-macos
103103
104-
[[ "${{ matrix.build-type }}" == "production" ]] && ENABLE_PROD=1 || ENABLE_PROD=0
105-
[[ "${{ matrix.rn-architecture }}" == "new" ]] && ENABLE_NEW_ARCH=1 || ENABLE_NEW_ARCH=0
104+
[[ "${{ matrix.build-type }}" == "production" ]] && export ENABLE_PROD=1 || export ENABLE_PROD=0
105+
[[ "${{ matrix.rn-architecture }}" == "new" ]] && export ENABLE_NEW_ARCH=1 || export ENABLE_NEW_ARCH=0
106106
[[ "${{ matrix.ios-use-frameworks }}" == "dynamic-frameworks" ]] && export USE_FRAMEWORKS=dynamic
107-
echo "ENABLE_PROD=$ENABLE_PROD"
108-
echo "ENABLE_NEW_ARCH=$ENABLE_NEW_ARCH"
109-
PRODUCTION=$ENABLE_PROD RCT_NEW_ARCH_ENABLED=$ENABLE_NEW_ARCH bundle exec pod install
110-
cat Podfile.lock | grep $RN_SENTRY_POD_NAME
107+
108+
./scripts/pod-install.sh
111109
112110
- name: Build Android App
113111
if: ${{ matrix.platform == 'android' }}
114-
working-directory: ${{ env.REACT_NATIVE_SAMPLE_PATH }}/android
112+
working-directory: ${{ env.REACT_NATIVE_SAMPLE_PATH }}
115113
run: |
116-
if [[ ${{ matrix.rn-architecture }} == 'new' ]]; then
117-
perl -i -pe's/newArchEnabled=false/newArchEnabled=true/g' gradle.properties
118-
echo 'New Architecture enabled'
119-
elif [[ ${{ matrix.rn-architecture }} == 'legacy' ]]; then
120-
perl -i -pe's/newArchEnabled=true/newArchEnabled=false/g' gradle.properties
121-
echo 'Legacy Architecture enabled'
122-
else
123-
echo 'No changes for architecture: ${{ matrix.rn-architecture }}'
124-
fi
125-
[[ "${{ matrix.build-type }}" == "production" ]] && CONFIG='Release' || CONFIG='Debug'
126-
echo "Building $CONFIG"
127-
[[ "${{ matrix.build-type }}" == "production" ]] && TEST_TYPE='release' || TEST_TYPE='debug'
128-
echo "Building $TEST_TYPE"
114+
export RN_ARCHITECTURE="${{ matrix.rn-architecture }}"
115+
[[ "${{ matrix.build-type }}" == "production" ]] && export CONFIG='release' || export CONFIG='debug'
129116
130-
./gradlew ":app:assemble$CONFIG" -PreactNativeArchitectures=x86
117+
./scripts/detox/set-dsn-aos.mjs
118+
./scripts/build-android.sh -PreactNativeArchitectures=x86
131119
132120
- name: Build iOS App
133121
if: ${{ matrix.platform == 'ios' }}
134-
working-directory: ${{ env.REACT_NATIVE_SAMPLE_PATH }}/ios
122+
working-directory: ${{ env.REACT_NATIVE_SAMPLE_PATH }}
135123
run: |
136-
[[ "${{ matrix.build-type }}" == "production" ]] && CONFIG='Release' || CONFIG='Debug'
137-
echo "Building $CONFIG"
138-
mkdir -p "DerivedData"
139-
derivedData="$(cd "DerivedData" ; pwd -P)"
140-
set -o pipefail && xcodebuild \
141-
-workspace sentryreactnativesample.xcworkspace \
142-
-configuration "$CONFIG" \
143-
-scheme sentryreactnativesample \
144-
-sdk 'iphonesimulator' \
145-
-destination 'generic/platform=iOS Simulator' \
146-
ONLY_ACTIVE_ARCH=yes \
147-
-derivedDataPath "$derivedData" \
148-
build \
149-
| tee xcodebuild.log \
150-
| xcbeautify --quieter --is-ci --disable-colored-output
124+
[[ "${{ matrix.build-type }}" == "production" ]] && export CONFIG='Release' || export CONFIG='Debug'
125+
126+
./scripts/detox/set-dsn-ios.mjs
127+
./scripts/build-ios.sh
151128
152129
- name: Build macOS App
153130
if: ${{ matrix.platform == 'macos' }}
154131
working-directory: samples/react-native-macos/macos
155132
run: |
156-
[[ "${{ matrix.build-type }}" == "production" ]] && CONFIG='Release' || CONFIG='Debug'
133+
[[ "${{ matrix.build-type }}" == "production" ]] && export CONFIG='Release' || export CONFIG='Debug'
157134
echo "Building $CONFIG"
158135
mkdir -p "DerivedData"
159136
derivedData="$(cd "DerivedData" ; pwd -P)"
@@ -170,19 +147,19 @@ jobs:
170147
171148
- name: Archive iOS App
172149
if: ${{ matrix.platform == 'ios' && matrix.rn-architecture == 'new' && matrix.build-type == 'production' && matrix.ios-use-frameworks == 'no-frameworks' }}
150+
working-directory: ${{ env.REACT_NATIVE_SAMPLE_PATH }}
173151
run: |
174-
cd ${{ env.REACT_NATIVE_SAMPLE_PATH }}/ios/DerivedData/Build/Products/Release-iphonesimulator
175152
zip -r \
176153
${{ github.workspace }}/${{ env.IOS_APP_ARCHIVE_PATH }} \
177154
sentryreactnativesample.app
178155
179156
- name: Archive Android App
180157
if: ${{ matrix.platform == 'android' && matrix.rn-architecture == 'new' && matrix.build-type == 'production' }}
181158
run: |
182-
mv ${{ env.REACT_NATIVE_SAMPLE_PATH }}/android/app/build/outputs/apk/release/app-release.apk app.apk
183159
zip -j \
184160
${{ env.ANDROID_APP_ARCHIVE_PATH }} \
185-
app.apk
161+
${{ env.REACT_NATIVE_SAMPLE_PATH }}/app.apk \
162+
${{ env.REACT_NATIVE_SAMPLE_PATH }}/app-androidTest.apk
186163
187164
- name: Upload iOS APP
188165
if: ${{ matrix.platform == 'ios' && matrix.rn-architecture == 'new' && matrix.build-type == 'production' && matrix.ios-use-frameworks == 'no-frameworks' }}
@@ -207,6 +184,138 @@ jobs:
207184
name: build-sample-${{ matrix.rn-architecture }}-${{ matrix.platform }}-${{ matrix.build-type }}-${{ matrix.ios-use-frameworks}}-logs
208185
path: ${{ env.REACT_NATIVE_SAMPLE_PATH }}/${{ matrix.platform }}/*.log
209186

187+
test-detox:
188+
name: ${{ matrix.job-name }}
189+
runs-on: ${{ matrix.runs-on }}
190+
needs: [diff_check, build]
191+
if: ${{ needs.diff_check.outputs.skip_ci != 'true' }}
192+
strategy:
193+
# we want that the matrix keeps running, default is to cancel them if it fails.
194+
fail-fast: false
195+
matrix:
196+
include:
197+
- job-name: 'Test iOS Release Auto Init'
198+
platform: ios
199+
runs-on: macos-15
200+
rn-architecture: 'new'
201+
ios-use-frameworks: 'no-frameworks'
202+
build-type: 'production'
203+
test-command: 'yarn test-ios-auto' # tests native auto init from JS
204+
205+
- job-name: 'Test iOS Release Manual Init'
206+
platform: ios
207+
runs-on: macos-15
208+
rn-architecture: 'new'
209+
ios-use-frameworks: 'no-frameworks'
210+
build-type: 'production'
211+
test-command: 'yarn test-ios-manual'
212+
213+
- job-name: 'Test Android Release Manual Init'
214+
platform: android
215+
runs-on: ubuntu-latest
216+
rn-architecture: 'new'
217+
build-type: 'production'
218+
test-command: 'yarn test-android'
219+
220+
steps:
221+
- uses: actions/checkout@v4
222+
223+
- name: Download iOS App Archive
224+
if: ${{ matrix.platform == 'ios' }}
225+
uses: actions/download-artifact@v4
226+
with:
227+
name: sample-rn-${{ matrix.rn-architecture }}-${{ matrix.build-type }}-${{ matrix.ios-use-frameworks}}-${{ matrix.platform }}
228+
path: ${{ env.REACT_NATIVE_SAMPLE_PATH }}
229+
230+
- name: Download Android APK
231+
if: ${{ matrix.platform == 'android' }}
232+
uses: actions/download-artifact@v4
233+
with:
234+
name: sample-rn-${{ matrix.rn-architecture }}-${{ matrix.build-type }}-${{ matrix.platform }}
235+
path: ${{ env.REACT_NATIVE_SAMPLE_PATH }}
236+
237+
- name: Unzip iOS App Archive
238+
if: ${{ matrix.platform == 'ios' }}
239+
working-directory: ${{ env.REACT_NATIVE_SAMPLE_PATH }}
240+
run: unzip ${{ env.IOS_APP_ARCHIVE_PATH }}
241+
242+
- name: Unzip Android APK
243+
if: ${{ matrix.platform == 'android' }}
244+
working-directory: ${{ env.REACT_NATIVE_SAMPLE_PATH }}
245+
run: unzip ${{ env.ANDROID_APP_ARCHIVE_PATH }}
246+
247+
- name: Enable Corepack
248+
run: |
249+
npm install -g [email protected]
250+
corepack enable
251+
- uses: actions/setup-node@v4
252+
with:
253+
node-version: 18
254+
cache: 'yarn'
255+
cache-dependency-path: yarn.lock
256+
257+
- name: Install JS Dependencies
258+
run: yarn install
259+
260+
- name: Install Detox
261+
run: npm install -g [email protected]
262+
263+
- name: Install Apple Simulator Utilities
264+
if: ${{ matrix.platform == 'ios' }}
265+
run: |
266+
brew tap wix/brew
267+
brew install applesimutils
268+
269+
- name: Setup KVM
270+
if: ${{ matrix.platform == 'android' }}
271+
shell: bash
272+
run: |
273+
# check if virtualization is supported...
274+
sudo apt install -y --no-install-recommends cpu-checker coreutils && echo "CPUs=$(nproc --all)" && kvm-ok
275+
# allow access to KVM to run the emulator
276+
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' \
277+
| sudo tee /etc/udev/rules.d/99-kvm4all.rules
278+
sudo udevadm control --reload-rules
279+
sudo udevadm trigger --name-match=kvm
280+
281+
- uses: futureware-tech/simulator-action@dab10d813144ef59b48d401cd95da151222ef8cd # pin@v4
282+
if: ${{ matrix.platform == 'ios' }}
283+
with:
284+
# the same envs are used by Detox ci.sim configuration
285+
model: ${{ env.IOS_DEVICE }}
286+
os_version: ${{ env.IOS_VERSION }}
287+
288+
- name: Run Detox iOS Tests
289+
if: ${{ matrix.platform == 'ios' }}
290+
working-directory: ${{ env.REACT_NATIVE_SAMPLE_PATH }}
291+
run: ${{ matrix.test-command }}
292+
293+
- name: Run tests on Android
294+
if: ${{ matrix.platform == 'android' }}
295+
env:
296+
# used by Detox ci.android configuration
297+
ANDROID_AVD_NAME: 'test' # test is default reactivecircus/android-emulator-runner name
298+
ANDROID_TYPE: 'android.emulator'
299+
uses: reactivecircus/android-emulator-runner@62dbb605bba737720e10b196cb4220d374026a6d # [email protected]
300+
with:
301+
api-level: ${{ env.ANDROID_API_LEVEL }}
302+
force-avd-creation: false
303+
disable-animations: true
304+
disable-spellchecker: true
305+
target: 'aosp_atd'
306+
channel: canary # Necessary for ATDs
307+
emulator-options: >
308+
-no-window
309+
-no-snapshot-save
310+
-gpu swiftshader_indirect
311+
-noaudio
312+
-no-boot-anim
313+
-camera-back none
314+
-camera-front none
315+
-timezone US/Pacific
316+
working-directory: ${{ env.REACT_NATIVE_SAMPLE_PATH }}
317+
script: ${{ matrix.test-command }}
318+
210319
test:
211320
name: Test ${{ matrix.platform }} ${{ matrix.build-type }} REV2
212321
runs-on: ${{ matrix.runs-on }}

CHANGELOG.md

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -364,6 +364,61 @@
364364
- [changelog](https://github.com/getsentry/sentry-javascript-bundler-plugins/blob/main/CHANGELOG.md#320)
365365
- [diff](https://github.com/getsentry/sentry-javascript-bundler-plugins/compare/3.1.2...3.2.0)
366366

367+
368+
## 6.7.0-alpha.0
369+
370+
### Features
371+
372+
- Capture App Start errors and crashes by initializing Sentry from `sentry.options.json` ([#4472](https://github.com/getsentry/sentry-react-native/pull/4472))
373+
374+
Create `sentry.options.json` in the React Native project root and set options the same as you currently have in `Sentry.init` in JS.
375+
376+
```json
377+
{
378+
"dsn": "https://[email protected]/value",
379+
}
380+
```
381+
382+
Initialize Sentry on the native layers by newly provided native methods.
383+
384+
```kotlin
385+
import io.sentry.react.RNSentrySDK
386+
387+
class MainApplication : Application(), ReactApplication {
388+
override fun onCreate() {
389+
super.onCreate()
390+
RNSentrySDK.init(this)
391+
}
392+
}
393+
```
394+
395+
```obj-c
396+
#import <RNSentry/RNSentry.h>
397+
398+
@implementation AppDelegate
399+
- (BOOL)application:(UIApplication *)application
400+
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
401+
{
402+
[RNSentrySDK start];
403+
return [super application:application didFinishLaunchingWithOptions:launchOptions];
404+
}
405+
@end
406+
```
407+
408+
### Changes
409+
410+
- Load `optionsFile` into the JS bundle during Metro bundle process ([#4476](https://github.com/getsentry/sentry-react-native/pull/4476))
411+
- Add experimental version of `startWithConfigureOptions` for Apple platforms ([#4444](https://github.com/getsentry/sentry-react-native/pull/4444))
412+
- Add experimental version of `init` with optional `OptionsConfiguration<SentryAndroidOptions>` for Android ([#4451](https://github.com/getsentry/sentry-react-native/pull/4451))
413+
- Add initialization using `sentry.options.json` for Apple platforms ([#4447](https://github.com/getsentry/sentry-react-native/pull/4447))
414+
- Add initialization using `sentry.options.json` for Android ([#4451](https://github.com/getsentry/sentry-react-native/pull/4451))
415+
- Merge options from file with `Sentry.init` options in JS ([#4510](https://github.com/getsentry/sentry-react-native/pull/4510))
416+
417+
### Internal
418+
419+
- Extract iOS native initialization to standalone structures ([#4442](https://github.com/getsentry/sentry-react-native/pull/4442))
420+
- Extract Android native initialization to standalone structures ([#4445](https://github.com/getsentry/sentry-react-native/pull/4445))
421+
367422
## 6.7.0
368423
369424
> [!WARNING]

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://[email protected]/123456",
3+
"enableTracing": true,
4+
"tracesSampleRate": 1.0
5+
}

0 commit comments

Comments
 (0)