Skip to content

Commit f26d7a8

Browse files
authored
Merge 23c6824 into 60cd796
2 parents 60cd796 + 23c6824 commit f26d7a8

File tree

104 files changed

+5211
-899
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

+5211
-899
lines changed

.github/workflows/sample-application.yml

Lines changed: 155 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -112,62 +112,39 @@ jobs:
112112
if: ${{ matrix.platform == 'ios' || matrix.platform == 'macos' }}
113113
working-directory: samples
114114
run: |
115-
[[ "${{ matrix.platform }}" == "ios" ]] && cd react-native/ios
116-
[[ "${{ matrix.platform }}" == "macos" ]] && cd react-native-macos/macos
115+
[[ "${{ matrix.platform }}" == "ios" ]] && cd react-native
116+
[[ "${{ matrix.platform }}" == "macos" ]] && cd react-native-macos
117117
118-
[[ "${{ matrix.build-type }}" == "production" ]] && ENABLE_PROD=1 || ENABLE_PROD=0
119-
[[ "${{ matrix.rn-architecture }}" == "new" ]] && ENABLE_NEW_ARCH=1 || ENABLE_NEW_ARCH=0
118+
[[ "${{ matrix.build-type }}" == "production" ]] && export ENABLE_PROD=1 || export ENABLE_PROD=0
119+
[[ "${{ matrix.rn-architecture }}" == "new" ]] && export ENABLE_NEW_ARCH=1 || export ENABLE_NEW_ARCH=0
120120
[[ "${{ matrix.ios-use-frameworks }}" == "dynamic-frameworks" ]] && export USE_FRAMEWORKS=dynamic
121-
echo "ENABLE_PROD=$ENABLE_PROD"
122-
echo "ENABLE_NEW_ARCH=$ENABLE_NEW_ARCH"
123-
PRODUCTION=$ENABLE_PROD RCT_NEW_ARCH_ENABLED=$ENABLE_NEW_ARCH bundle exec pod install
124-
cat Podfile.lock | grep $RN_SENTRY_POD_NAME
121+
122+
./scripts/pod-install.sh
125123
126124
- name: Build Android App
127125
if: ${{ matrix.platform == 'android' }}
128-
working-directory: ${{ env.REACT_NATIVE_SAMPLE_PATH }}/android
126+
working-directory: ${{ env.REACT_NATIVE_SAMPLE_PATH }}
129127
run: |
130-
if [[ ${{ matrix.rn-architecture }} == 'new' ]]; then
131-
perl -i -pe's/newArchEnabled=false/newArchEnabled=true/g' gradle.properties
132-
echo 'New Architecture enabled'
133-
elif [[ ${{ matrix.rn-architecture }} == 'legacy' ]]; then
134-
perl -i -pe's/newArchEnabled=true/newArchEnabled=false/g' gradle.properties
135-
echo 'Legacy Architecture enabled'
136-
else
137-
echo 'No changes for architecture: ${{ matrix.rn-architecture }}'
138-
fi
139-
[[ "${{ matrix.build-type }}" == "production" ]] && CONFIG='Release' || CONFIG='Debug'
140-
echo "Building $CONFIG"
141-
[[ "${{ matrix.build-type }}" == "production" ]] && TEST_TYPE='release' || TEST_TYPE='debug'
142-
echo "Building $TEST_TYPE"
128+
export RN_ARCHITECTURE="${{ matrix.rn-architecture }}"
129+
[[ "${{ matrix.build-type }}" == "production" ]] && export CONFIG='release' || export CONFIG='debug'
143130
144-
./gradlew ":app:assemble$CONFIG" -PreactNativeArchitectures=x86
131+
./scripts/detox/set-dsn-aos.mjs
132+
./scripts/build-android.sh -PreactNativeArchitectures=x86
145133
146134
- name: Build iOS App
147135
if: ${{ matrix.platform == 'ios' }}
148-
working-directory: ${{ env.REACT_NATIVE_SAMPLE_PATH }}/ios
136+
working-directory: ${{ env.REACT_NATIVE_SAMPLE_PATH }}
149137
run: |
150-
[[ "${{ matrix.build-type }}" == "production" ]] && CONFIG='Release' || CONFIG='Debug'
151-
echo "Building $CONFIG"
152-
mkdir -p "DerivedData"
153-
derivedData="$(cd "DerivedData" ; pwd -P)"
154-
set -o pipefail && xcodebuild \
155-
-workspace sentryreactnativesample.xcworkspace \
156-
-configuration "$CONFIG" \
157-
-scheme sentryreactnativesample \
158-
-sdk 'iphonesimulator' \
159-
-destination 'generic/platform=iOS Simulator' \
160-
ONLY_ACTIVE_ARCH=yes \
161-
-derivedDataPath "$derivedData" \
162-
build \
163-
| tee xcodebuild.log \
164-
| xcbeautify --quieter --is-ci --disable-colored-output
138+
[[ "${{ matrix.build-type }}" == "production" ]] && export CONFIG='Release' || export CONFIG='Debug'
139+
140+
./scripts/detox/set-dsn-ios.mjs
141+
./scripts/build-ios.sh
165142
166143
- name: Build macOS App
167144
if: ${{ matrix.platform == 'macos' }}
168145
working-directory: samples/react-native-macos/macos
169146
run: |
170-
[[ "${{ matrix.build-type }}" == "production" ]] && CONFIG='Release' || CONFIG='Debug'
147+
[[ "${{ matrix.build-type }}" == "production" ]] && export CONFIG='Release' || export CONFIG='Debug'
171148
echo "Building $CONFIG"
172149
mkdir -p "DerivedData"
173150
derivedData="$(cd "DerivedData" ; pwd -P)"
@@ -184,19 +161,19 @@ jobs:
184161
185162
- name: Archive iOS App
186163
if: ${{ matrix.platform == 'ios' && matrix.rn-architecture == 'new' && matrix.build-type == 'production' && matrix.ios-use-frameworks == 'no-frameworks' }}
164+
working-directory: ${{ env.REACT_NATIVE_SAMPLE_PATH }}
187165
run: |
188-
cd ${{ env.REACT_NATIVE_SAMPLE_PATH }}/ios/DerivedData/Build/Products/Release-iphonesimulator
189166
zip -r \
190167
${{ github.workspace }}/${{ env.IOS_APP_ARCHIVE_PATH }} \
191168
sentryreactnativesample.app
192169
193170
- name: Archive Android App
194171
if: ${{ matrix.platform == 'android' && matrix.rn-architecture == 'new' && matrix.build-type == 'production' }}
195172
run: |
196-
mv ${{ env.REACT_NATIVE_SAMPLE_PATH }}/android/app/build/outputs/apk/release/app-release.apk app.apk
197173
zip -j \
198174
${{ env.ANDROID_APP_ARCHIVE_PATH }} \
199-
app.apk
175+
${{ env.REACT_NATIVE_SAMPLE_PATH }}/app.apk \
176+
${{ env.REACT_NATIVE_SAMPLE_PATH }}/app-androidTest.apk
200177
201178
- name: Upload iOS APP
202179
if: ${{ matrix.platform == 'ios' && matrix.rn-architecture == 'new' && matrix.build-type == 'production' && matrix.ios-use-frameworks == 'no-frameworks' }}
@@ -221,6 +198,138 @@ jobs:
221198
name: build-sample-${{ matrix.rn-architecture }}-${{ matrix.platform }}-${{ matrix.build-type }}-${{ matrix.ios-use-frameworks}}-logs
222199
path: ${{ env.REACT_NATIVE_SAMPLE_PATH }}/${{ matrix.platform }}/*.log
223200

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

CHANGELOG.md

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1248,6 +1248,61 @@ We apologize for any inconvenience caused!
12481248
- [changelog](https://github.com/getsentry/sentry-javascript-bundler-plugins/blob/main/CHANGELOG.md#320)
12491249
- [diff](https://github.com/getsentry/sentry-javascript-bundler-plugins/compare/3.1.2...3.2.0)
12501250
1251+
1252+
## 6.7.0-alpha.0
1253+
1254+
### Features
1255+
1256+
- Capture App Start errors and crashes by initializing Sentry from `sentry.options.json` ([#4472](https://github.com/getsentry/sentry-react-native/pull/4472))
1257+
1258+
Create `sentry.options.json` in the React Native project root and set options the same as you currently have in `Sentry.init` in JS.
1259+
1260+
```json
1261+
{
1262+
"dsn": "https://key@example.io/value",
1263+
}
1264+
```
1265+
1266+
Initialize Sentry on the native layers by newly provided native methods.
1267+
1268+
```kotlin
1269+
import io.sentry.react.RNSentrySDK
1270+
1271+
class MainApplication : Application(), ReactApplication {
1272+
override fun onCreate() {
1273+
super.onCreate()
1274+
RNSentrySDK.init(this)
1275+
}
1276+
}
1277+
```
1278+
1279+
```obj-c
1280+
#import <RNSentry/RNSentry.h>
1281+
1282+
@implementation AppDelegate
1283+
- (BOOL)application:(UIApplication *)application
1284+
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
1285+
{
1286+
[RNSentrySDK start];
1287+
return [super application:application didFinishLaunchingWithOptions:launchOptions];
1288+
}
1289+
@end
1290+
```
1291+
1292+
### Changes
1293+
1294+
- Load `optionsFile` into the JS bundle during Metro bundle process ([#4476](https://github.com/getsentry/sentry-react-native/pull/4476))
1295+
- Add experimental version of `startWithConfigureOptions` for Apple platforms ([#4444](https://github.com/getsentry/sentry-react-native/pull/4444))
1296+
- Add experimental version of `init` with optional `OptionsConfiguration<SentryAndroidOptions>` for Android ([#4451](https://github.com/getsentry/sentry-react-native/pull/4451))
1297+
- Add initialization using `sentry.options.json` for Apple platforms ([#4447](https://github.com/getsentry/sentry-react-native/pull/4447))
1298+
- Add initialization using `sentry.options.json` for Android ([#4451](https://github.com/getsentry/sentry-react-native/pull/4451))
1299+
- Merge options from file with `Sentry.init` options in JS ([#4510](https://github.com/getsentry/sentry-react-native/pull/4510))
1300+
1301+
### Internal
1302+
1303+
- Extract iOS native initialization to standalone structures ([#4442](https://github.com/getsentry/sentry-react-native/pull/4442))
1304+
- Extract Android native initialization to standalone structures ([#4445](https://github.com/getsentry/sentry-react-native/pull/4445))
1305+
12511306
## 6.7.0
12521307
12531308
> [!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
@@ -42,7 +42,7 @@ Pod::Spec.new do |s|
4242
s.preserve_paths = '*.js'
4343

4444
s.source_files = 'ios/**/*.{h,m,mm}'
45-
s.public_header_files = 'ios/RNSentry.h'
45+
s.public_header_files = 'ios/RNSentry.h', 'ios/RNSentrySDK.h', 'ios/RNSentryStart.h', 'ios/RNSentryVersion.h', 'ios/RNSentryBreadcrumb.h', 'ios/RNSentryReplay.h', 'ios/RNSentryReplayBreadcrumbConverter.h', 'ios/Replay/RNSentryReplayMask.h', 'ios/Replay/RNSentryReplayUnmask.h', 'ios/RNSentryTimeToDisplay.h'
4646

4747
s.compiler_flags = other_cflags
4848

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)