Skip to content

Commit c8578fb

Browse files
Merge e935360 into 05b43ab
2 parents 05b43ab + e935360 commit c8578fb

File tree

100 files changed

+4341
-870
lines changed

Some content is hidden

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

100 files changed

+4341
-870
lines changed

.github/workflows/sample-application.yml

Lines changed: 178 additions & 40 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
@@ -93,59 +99,39 @@ jobs:
9399
if: ${{ matrix.platform == 'ios' || matrix.platform == 'macos' }}
94100
working-directory: samples
95101
run: |
96-
[[ "${{ matrix.platform }}" == "ios" ]] && cd react-native/ios
97-
[[ "${{ matrix.platform }}" == "macos" ]] && cd react-native-macos/macos
102+
[[ "${{ matrix.platform }}" == "ios" ]] && cd react-native
103+
[[ "${{ matrix.platform }}" == "macos" ]] && cd react-native-macos
98104
99-
[[ "${{ matrix.build-type }}" == "production" ]] && ENABLE_PROD=1 || ENABLE_PROD=0
100-
[[ "${{ matrix.rn-architecture }}" == "new" ]] && ENABLE_NEW_ARCH=1 || ENABLE_NEW_ARCH=0
105+
[[ "${{ matrix.build-type }}" == "production" ]] && export ENABLE_PROD=1 || export ENABLE_PROD=0
106+
[[ "${{ matrix.rn-architecture }}" == "new" ]] && export ENABLE_NEW_ARCH=1 || export ENABLE_NEW_ARCH=0
101107
[[ "${{ matrix.ios-use-frameworks }}" == "dynamic-frameworks" ]] && export USE_FRAMEWORKS=dynamic
102-
echo "ENABLE_PROD=$ENABLE_PROD"
103-
echo "ENABLE_NEW_ARCH=$ENABLE_NEW_ARCH"
104-
PRODUCTION=$ENABLE_PROD RCT_NEW_ARCH_ENABLED=$ENABLE_NEW_ARCH bundle exec pod install
105-
cat Podfile.lock | grep $RN_SENTRY_POD_NAME
108+
109+
./scripts/pod-install.sh
106110
107111
- name: Build Android App
108112
if: ${{ matrix.platform == 'android' }}
109-
working-directory: samples/react-native/android
113+
working-directory: ${{ env.REACT_NATIVE_SAMPLE_PATH }}
110114
run: |
111-
if [[ ${{ matrix.rn-architecture }} == 'new' ]]; then
112-
perl -i -pe's/newArchEnabled=false/newArchEnabled=true/g' gradle.properties
113-
echo 'New Architecture enabled'
114-
elif [[ ${{ matrix.rn-architecture }} == 'legacy' ]]; then
115-
perl -i -pe's/newArchEnabled=true/newArchEnabled=false/g' gradle.properties
116-
echo 'Legacy Architecture enabled'
117-
else
118-
echo 'No changes for architecture: ${{ matrix.rn-architecture }}'
119-
fi
120-
[[ "${{ matrix.build-type }}" == "production" ]] && CONFIG='Release' || CONFIG='Debug'
121-
echo "Building $CONFIG"
122-
./gradlew ":app:assemble$CONFIG" -PreactNativeArchitectures=x86
115+
export RN_ARCHITECTURE="${{ matrix.rn-architecture }}"
116+
[[ "${{ matrix.build-type }}" == "production" ]] && export CONFIG='release' || export CONFIG='debug'
117+
118+
./scripts/set-dsn-aos.mjs
119+
./scripts/build-android.sh -PreactNativeArchitectures=x86
123120
124121
- name: Build iOS App
125122
if: ${{ matrix.platform == 'ios' }}
126-
working-directory: samples/react-native/ios
123+
working-directory: ${{ env.REACT_NATIVE_SAMPLE_PATH }}
127124
run: |
128-
[[ "${{ matrix.build-type }}" == "production" ]] && CONFIG='Release' || CONFIG='Debug'
129-
echo "Building $CONFIG"
130-
mkdir -p "DerivedData"
131-
derivedData="$(cd "DerivedData" ; pwd -P)"
132-
set -o pipefail && xcodebuild \
133-
-workspace sentryreactnativesample.xcworkspace \
134-
-configuration "$CONFIG" \
135-
-scheme sentryreactnativesample \
136-
-sdk 'iphonesimulator' \
137-
-destination 'generic/platform=iOS Simulator' \
138-
ONLY_ACTIVE_ARCH=yes \
139-
-derivedDataPath "$derivedData" \
140-
build \
141-
| tee xcodebuild.log \
142-
| xcbeautify --quieter --is-ci --disable-colored-output
125+
[[ "${{ matrix.build-type }}" == "production" ]] && export CONFIG='Release' || export CONFIG='Debug'
126+
127+
./scripts/set-dsn-ios.mjs
128+
./scripts/build-ios.sh
143129
144130
- name: Build macOS App
145131
if: ${{ matrix.platform == 'macos' }}
146132
working-directory: samples/react-native-macos/macos
147133
run: |
148-
[[ "${{ matrix.build-type }}" == "production" ]] && CONFIG='Release' || CONFIG='Debug'
134+
[[ "${{ matrix.build-type }}" == "production" ]] && export CONFIG='Release' || export CONFIG='Debug'
149135
echo "Building $CONFIG"
150136
mkdir -p "DerivedData"
151137
derivedData="$(cd "DerivedData" ; pwd -P)"
@@ -160,9 +146,161 @@ jobs:
160146
| tee xcodebuild.log \
161147
| xcbeautify --quieter --is-ci --disable-colored-output
162148
149+
- name: Archive iOS App
150+
if: ${{ matrix.platform == 'ios' && matrix.rn-architecture == 'new' && matrix.build-type == 'production' && matrix.ios-use-frameworks == 'no-frameworks' }}
151+
working-directory: ${{ env.REACT_NATIVE_SAMPLE_PATH }}
152+
run: |
153+
zip -r \
154+
${{ github.workspace }}/${{ env.IOS_APP_ARCHIVE_PATH }} \
155+
sentryreactnativesample.app
156+
157+
- name: Archive Android App
158+
if: ${{ matrix.platform == 'android' && matrix.rn-architecture == 'new' && matrix.build-type == 'production' }}
159+
run: |
160+
zip -j \
161+
${{ env.ANDROID_APP_ARCHIVE_PATH }} \
162+
${{ env.REACT_NATIVE_SAMPLE_PATH }}/app.apk \
163+
${{ env.REACT_NATIVE_SAMPLE_PATH }}/app-androidTest.apk
164+
165+
- name: Upload iOS APP
166+
if: ${{ matrix.platform == 'ios' && matrix.rn-architecture == 'new' && matrix.build-type == 'production' && matrix.ios-use-frameworks == 'no-frameworks' }}
167+
uses: actions/upload-artifact@v4
168+
with:
169+
name: sample-rn-${{ matrix.rn-architecture }}-${{ matrix.build-type }}-${{ matrix.ios-use-frameworks}}-${{ matrix.platform }}
170+
path: ${{ env.IOS_APP_ARCHIVE_PATH }}
171+
retention-days: 1
172+
173+
- name: Upload Android APK
174+
if: ${{ matrix.platform == 'android' && matrix.rn-architecture == 'new' && matrix.build-type == 'production' }}
175+
uses: actions/upload-artifact@v4
176+
with:
177+
name: sample-rn-${{ matrix.rn-architecture }}-${{ matrix.build-type }}-${{ matrix.platform }}
178+
path: ${{ env.ANDROID_APP_ARCHIVE_PATH }}
179+
retention-days: 1
180+
163181
- name: Upload logs
164182
if: ${{ always() }}
165183
uses: actions/upload-artifact@v4
166184
with:
167185
name: build-sample-${{ matrix.rn-architecture }}-${{ matrix.platform }}-${{ matrix.build-type }}-${{ matrix.ios-use-frameworks}}-logs
168-
path: samples/react-native/${{ matrix.platform }}/*.log
186+
path: ${{ env.REACT_NATIVE_SAMPLE_PATH }}/${{ matrix.platform }}/*.log
187+
188+
test:
189+
name: Test ${{ matrix.platform }} ${{ matrix.build-type }}
190+
runs-on: ${{ matrix.runs-on }}
191+
needs: [diff_check, build]
192+
if: ${{ needs.diff_check.outputs.skip_ci != 'true' }}
193+
strategy:
194+
# we want that the matrix keeps running, default is to cancel them if it fails.
195+
fail-fast: false
196+
matrix:
197+
include:
198+
- platform: ios
199+
runs-on: macos-15
200+
rn-architecture: 'new'
201+
ios-use-frameworks: 'no-frameworks'
202+
build-type: 'production'
203+
204+
- platform: android
205+
runs-on: ubuntu-latest
206+
rn-architecture: 'new'
207+
build-type: 'production'
208+
209+
steps:
210+
- uses: actions/checkout@v4
211+
212+
- name: Download iOS App Archive
213+
if: ${{ matrix.platform == 'ios' }}
214+
uses: actions/download-artifact@v4
215+
with:
216+
name: sample-rn-${{ matrix.rn-architecture }}-${{ matrix.build-type }}-${{ matrix.ios-use-frameworks}}-${{ matrix.platform }}
217+
path: ${{ env.REACT_NATIVE_SAMPLE_PATH }}
218+
219+
- name: Download Android APK
220+
if: ${{ matrix.platform == 'android' }}
221+
uses: actions/download-artifact@v4
222+
with:
223+
name: sample-rn-${{ matrix.rn-architecture }}-${{ matrix.build-type }}-${{ matrix.platform }}
224+
path: ${{ env.REACT_NATIVE_SAMPLE_PATH }}
225+
226+
- name: Unzip iOS App Archive
227+
if: ${{ matrix.platform == 'ios' }}
228+
working-directory: ${{ env.REACT_NATIVE_SAMPLE_PATH }}
229+
run: unzip ${{ env.IOS_APP_ARCHIVE_PATH }}
230+
231+
- name: Unzip Android APK
232+
if: ${{ matrix.platform == 'android' }}
233+
working-directory: ${{ env.REACT_NATIVE_SAMPLE_PATH }}
234+
run: unzip ${{ env.ANDROID_APP_ARCHIVE_PATH }}
235+
236+
- name: Enable Corepack
237+
run: |
238+
npm install -g corepack@0.29.4
239+
corepack enable
240+
- uses: actions/setup-node@v4
241+
with:
242+
node-version: 18
243+
cache: 'yarn'
244+
cache-dependency-path: yarn.lock
245+
246+
- name: Install JS Dependencies
247+
run: yarn install
248+
249+
- name: Install Detox
250+
run: npm install -g detox-cli@20.0.0
251+
252+
- name: Install Apple Simulator Utilities
253+
if: ${{ matrix.platform == 'ios' }}
254+
run: |
255+
brew tap wix/brew
256+
brew install applesimutils
257+
258+
- name: Setup KVM
259+
if: ${{ matrix.platform == 'android' }}
260+
shell: bash
261+
run: |
262+
# check if virtualization is supported...
263+
sudo apt install -y --no-install-recommends cpu-checker coreutils && echo "CPUs=$(nproc --all)" && kvm-ok
264+
# allow access to KVM to run the emulator
265+
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' \
266+
| sudo tee /etc/udev/rules.d/99-kvm4all.rules
267+
sudo udevadm control --reload-rules
268+
sudo udevadm trigger --name-match=kvm
269+
270+
- uses: futureware-tech/simulator-action@dab10d813144ef59b48d401cd95da151222ef8cd # pin@v4
271+
if: ${{ matrix.platform == 'ios' }}
272+
with:
273+
# the same envs are used by Detox ci.sim configuration
274+
model: ${{ env.IOS_DEVICE }}
275+
os_version: ${{ env.IOS_VERSION }}
276+
277+
- name: Run Detox iOS Tests
278+
if: ${{ matrix.platform == 'ios' }}
279+
working-directory: ${{ env.REACT_NATIVE_SAMPLE_PATH }}
280+
run: yarn test-ios
281+
282+
- name: Run tests on Android
283+
if: ${{ matrix.platform == 'android' }}
284+
env:
285+
# used by Detox ci.android configuration
286+
ANDROID_AVD_NAME: 'test' # test is default reactivecircus/android-emulator-runner name
287+
ANDROID_TYPE: 'android.emulator'
288+
uses: reactivecircus/android-emulator-runner@62dbb605bba737720e10b196cb4220d374026a6d # pin@v2.33.0
289+
with:
290+
api-level: ${{ env.ANDROID_API_LEVEL }}
291+
force-avd-creation: false
292+
disable-animations: true
293+
disable-spellchecker: true
294+
target: 'aosp_atd'
295+
channel: canary # Necessary for ATDs
296+
emulator-options: >
297+
-no-window
298+
-no-snapshot-save
299+
-gpu swiftshader_indirect
300+
-noaudio
301+
-no-boot-anim
302+
-camera-back none
303+
-camera-front none
304+
-timezone US/Pacific
305+
working-directory: ${{ env.REACT_NATIVE_SAMPLE_PATH }}
306+
script: yarn test-android

CHANGELOG.md

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

54+
55+
## 6.7.0-alpha.0
56+
57+
### Features
58+
59+
- Capture App Start errors and crashes by initializing Sentry from `sentry.options.json` ([#4472](https://github.com/getsentry/sentry-react-native/pull/4472))
60+
61+
Create `sentry.options.json` in the React Native project root and set options the same as you currently have in `Sentry.init` in JS.
62+
63+
```json
64+
{
65+
"dsn": "https://key@example.io/value",
66+
}
67+
```
68+
69+
Initialize Sentry on the native layers by newly provided native methods.
70+
71+
```kotlin
72+
import io.sentry.react.RNSentrySDK
73+
74+
class MainApplication : Application(), ReactApplication {
75+
override fun onCreate() {
76+
super.onCreate()
77+
RNSentrySDK.init(this)
78+
}
79+
}
80+
```
81+
82+
```obj-c
83+
#import <RNSentry/RNSentry.h>
84+
85+
@implementation AppDelegate
86+
- (BOOL)application:(UIApplication *)application
87+
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
88+
{
89+
[RNSentrySDK start];
90+
return [super application:application didFinishLaunchingWithOptions:launchOptions];
91+
}
92+
@end
93+
```
94+
95+
### Changes
96+
97+
- Load `optionsFile` into the JS bundle during Metro bundle process ([#4476](https://github.com/getsentry/sentry-react-native/pull/4476))
98+
- Add experimental version of `startWithConfigureOptions` for Apple platforms ([#4444](https://github.com/getsentry/sentry-react-native/pull/4444))
99+
- Add experimental version of `init` with optional `OptionsConfiguration<SentryAndroidOptions>` for Android ([#4451](https://github.com/getsentry/sentry-react-native/pull/4451))
100+
- Add initialization using `sentry.options.json` for Apple platforms ([#4447](https://github.com/getsentry/sentry-react-native/pull/4447))
101+
- Add initialization using `sentry.options.json` for Android ([#4451](https://github.com/getsentry/sentry-react-native/pull/4451))
102+
- Merge options from file with `Sentry.init` options in JS ([#4510](https://github.com/getsentry/sentry-react-native/pull/4510))
103+
104+
### Internal
105+
106+
- Extract iOS native initialization to standalone structures ([#4442](https://github.com/getsentry/sentry-react-native/pull/4442))
107+
- Extract Android native initialization to standalone structures ([#4445](https://github.com/getsentry/sentry-react-native/pull/4445))
108+
54109
## 6.7.0
55110
56111
### Features

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)