Skip to content
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 22 additions & 51 deletions .github/workflows/sample-application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,66 +99,39 @@ jobs:
if: ${{ matrix.platform == 'ios' || matrix.platform == 'macos' }}
working-directory: samples
run: |
[[ "${{ matrix.platform }}" == "ios" ]] && cd react-native/ios
[[ "${{ matrix.platform }}" == "macos" ]] && cd react-native-macos/macos
[[ "${{ matrix.platform }}" == "ios" ]] && cd react-native
[[ "${{ matrix.platform }}" == "macos" ]] && cd react-native-macos

[[ "${{ matrix.build-type }}" == "production" ]] && ENABLE_PROD=1 || ENABLE_PROD=0
[[ "${{ matrix.rn-architecture }}" == "new" ]] && ENABLE_NEW_ARCH=1 || ENABLE_NEW_ARCH=0
[[ "${{ matrix.build-type }}" == "production" ]] && export ENABLE_PROD=1 || export ENABLE_PROD=0
[[ "${{ matrix.rn-architecture }}" == "new" ]] && export ENABLE_NEW_ARCH=1 || export ENABLE_NEW_ARCH=0
[[ "${{ matrix.ios-use-frameworks }}" == "dynamic-frameworks" ]] && export USE_FRAMEWORKS=dynamic
echo "ENABLE_PROD=$ENABLE_PROD"
echo "ENABLE_NEW_ARCH=$ENABLE_NEW_ARCH"
PRODUCTION=$ENABLE_PROD RCT_NEW_ARCH_ENABLED=$ENABLE_NEW_ARCH bundle exec pod install
cat Podfile.lock | grep $RN_SENTRY_POD_NAME

./scripts/pod-install.sh

- name: Build Android App
if: ${{ matrix.platform == 'android' }}
working-directory: ${{ env.REACT_NATIVE_SAMPLE_PATH }}/android
working-directory: ${{ env.REACT_NATIVE_SAMPLE_PATH }}
run: |
../scripts/set-aos-dsn.mjs

if [[ ${{ matrix.rn-architecture }} == 'new' ]]; then
perl -i -pe's/newArchEnabled=false/newArchEnabled=true/g' gradle.properties
echo 'New Architecture enabled'
elif [[ ${{ matrix.rn-architecture }} == 'legacy' ]]; then
perl -i -pe's/newArchEnabled=true/newArchEnabled=false/g' gradle.properties
echo 'Legacy Architecture enabled'
else
echo 'No changes for architecture: ${{ matrix.rn-architecture }}'
fi
[[ "${{ matrix.build-type }}" == "production" ]] && CONFIG='Release' || CONFIG='Debug'
echo "Building $CONFIG"
[[ "${{ matrix.build-type }}" == "production" ]] && TEST_TYPE='release' || TEST_TYPE='debug'
echo "Building $TEST_TYPE"
export RN_ARCHITECTURE="${{ matrix.rn-architecture }}"
[[ "${{ matrix.build-type }}" == "production" ]] && export CONFIG='release' || export CONFIG='debug'

./gradlew ":app:assemble$CONFIG" app:assembleAndroidTest -DtestBuildType=$TEST_TYPE -PreactNativeArchitectures=x86
./scripts/set-dsn-aos.mjs
./scripts/build-android.sh -PreactNativeArchitectures=x86

- name: Build iOS App
if: ${{ matrix.platform == 'ios' }}
working-directory: ${{ env.REACT_NATIVE_SAMPLE_PATH }}/ios
working-directory: ${{ env.REACT_NATIVE_SAMPLE_PATH }}
run: |
../scripts/set-ios-dsn.mjs
[[ "${{ matrix.build-type }}" == "production" ]] && export CONFIG='Release' || export CONFIG='Debug'

[[ "${{ matrix.build-type }}" == "production" ]] && CONFIG='Release' || CONFIG='Debug'
echo "Building $CONFIG"
mkdir -p "DerivedData"
derivedData="$(cd "DerivedData" ; pwd -P)"
set -o pipefail && xcodebuild \
-workspace sentryreactnativesample.xcworkspace \
-configuration "$CONFIG" \
-scheme sentryreactnativesample \
-sdk 'iphonesimulator' \
-destination 'generic/platform=iOS Simulator' \
ONLY_ACTIVE_ARCH=yes \
-derivedDataPath "$derivedData" \
build \
| tee xcodebuild.log \
| xcbeautify --quieter --is-ci --disable-colored-output
./scripts/set-dsn-ios.mjs
./scripts/build-ios.sh

- name: Build macOS App
if: ${{ matrix.platform == 'macos' }}
working-directory: samples/react-native-macos/macos
run: |
[[ "${{ matrix.build-type }}" == "production" ]] && CONFIG='Release' || CONFIG='Debug'
[[ "${{ matrix.build-type }}" == "production" ]] && export CONFIG='Release' || export CONFIG='Debug'
echo "Building $CONFIG"
mkdir -p "DerivedData"
derivedData="$(cd "DerivedData" ; pwd -P)"
Expand All @@ -176,20 +149,17 @@ jobs:
- name: Archive iOS App
if: ${{ matrix.platform == 'ios' && matrix.rn-architecture == 'new' && matrix.build-type == 'production' && matrix.ios-use-frameworks == 'no-frameworks' }}
run: |
cd ${{ env.REACT_NATIVE_SAMPLE_PATH }}/ios/DerivedData/Build/Products/Release-iphonesimulator
zip -r \
${{ github.workspace }}/${{ env.IOS_APP_ARCHIVE_PATH }} \
sentryreactnativesample.app
${{ env.REACT_NATIVE_SAMPLE_PATH }}/sentryreactnativesample.app

- name: Archive Android App
if: ${{ matrix.platform == 'android' && matrix.rn-architecture == 'new' && matrix.build-type == 'production' }}
run: |
mv ${{ env.REACT_NATIVE_SAMPLE_PATH }}/android/app/build/outputs/apk/release/app-release.apk app.apk
mv ${{ env.REACT_NATIVE_SAMPLE_PATH }}/android/app/build/outputs/apk/androidTest/release/app-release-androidTest.apk app-androidTest.apk
zip -j \
${{ env.ANDROID_APP_ARCHIVE_PATH }} \
app.apk \
app-androidTest.apk
${{ env.REACT_NATIVE_SAMPLE_PATH }}/app.apk \
${{ env.REACT_NATIVE_SAMPLE_PATH }}/app-androidTest.apk

- name: Upload iOS APP
if: ${{ matrix.platform == 'ios' && matrix.rn-architecture == 'new' && matrix.build-type == 'production' && matrix.ios-use-frameworks == 'no-frameworks' }}
Expand Down Expand Up @@ -306,13 +276,14 @@ jobs:
- name: Run Detox iOS Tests
if: ${{ matrix.platform == 'ios' }}
working-directory: ${{ env.REACT_NATIVE_SAMPLE_PATH }}
run: detox test --configuration ci.sim
run: yarn test-ios

- name: Run tests on Android
if: ${{ matrix.platform == 'android' }}
env:
# used by Detox ci.android configuration
ANDROID_AVD_NAME: 'test' # test is default reactivecircus/android-emulator-runner name
ANDROID_TYPE: 'android.emulator'
uses: reactivecircus/android-emulator-runner@62dbb605bba737720e10b196cb4220d374026a6d # [email protected]
with:
api-level: ${{ env.ANDROID_API_LEVEL }}
Expand All @@ -331,4 +302,4 @@ jobs:
-camera-front none
-timezone US/Pacific
working-directory: ${{ env.REACT_NATIVE_SAMPLE_PATH }}
script: detox test --configuration ci.android
script: yarn test-android
18 changes: 18 additions & 0 deletions samples/react-native-macos/scripts/pod-install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/bash

# Exit on error
set -e

thisFilePath=$(dirname "$0")

echo "USE_FRAMEWORKS=$USE_FRAMEWORKS"
echo "ENABLE_PROD=$ENABLE_PROD"
echo "ENABLE_NEW_ARCH=$ENABLE_NEW_ARCH"

cd "${thisFilePath}/.."
bundle install

cd macos
PRODUCTION=$ENABLE_PROD RCT_NEW_ARCH_ENABLED=$ENABLE_NEW_ARCH bundle exec pod update

cat Podfile.lock | grep $RN_SENTRY_POD_NAME
124 changes: 23 additions & 101 deletions samples/react-native/.detoxrc.js
Original file line number Diff line number Diff line change
@@ -1,56 +1,9 @@
const process = require('process');

const testRunnerIos = {
args: {
$0: 'jest',
config: 'e2e/jest.config.ios.js',
},
jest: {
setupTimeout: 120000,
},
};

const testRunnerAos = {
args: {
$0: 'jest',
config: 'e2e/jest.config.android.js',
},
jest: {
setupTimeout: 120000,
},
};

/** @type {Detox.DetoxConfig} */
module.exports = {
testRunner: {},
apps: {
'ios.debug': {
type: 'ios.app',
binaryPath:
'ios/build/Build/Products/Debug-iphonesimulator/sentryreactnativesample.app',
build:
'xcodebuild -workspace ios/sentryreactnativesample.xcworkspace -scheme sentryreactnativesample -configuration Debug -sdk iphonesimulator -derivedDataPath ios/build',
},
'ios.release': {
type: 'ios.app',
binaryPath:
'ios/build/Build/Products/Release-iphonesimulator/sentryreactnativesample.app',
build:
'xcodebuild -workspace ios/sentryreactnativesample.xcworkspace -scheme sentryreactnativesample -configuration Release -sdk iphonesimulator -derivedDataPath ios/build',
},
'android.debug': {
type: 'android.apk',
binaryPath: 'android/app/build/outputs/apk/debug/app-debug.apk',
build:
'cd android && ./gradlew app:assembleDebug app:assembleAndroidTest -DtestBuildType=debug',
reversePorts: [8081],
},
'android.release': {
type: 'android.apk',
binaryPath: 'android/app/build/outputs/apk/release/app-release.apk',
build:
'cd android && ./gradlew app:assembleRelease app:assembleAndroidTest -DtestBuildType=release',
},
'ci.android': {
type: 'android.apk',
binaryPath: 'app.apk',
Expand All @@ -62,78 +15,47 @@ module.exports = {
},
},
devices: {
simulator: {
type: 'ios.simulator',
device: {
type: 'iPhone 16',
},
},
attached: {
type: 'android.attached',
device: {
adbName: '.*',
},
},
emulator: {
type: 'android.emulator',
device: {
avdName: 'Pixel_9_API_35',
},
},
'ci.emulator': {
type: 'android.emulator',
type: process.env.ANDROID_TYPE?.trim(),
device: {
avdName: process.env.ANDROID_AVD_NAME,
avdName: process.env.ANDROID_AVD_NAME?.trim(),
adbName: process.env.ANDROID_ADB_NAME?.trim(),
},
},
'ci.simulator': {
type: 'ios.simulator',
device: {
type: process.env.IOS_DEVICE,
os: process.env.IOS_VERSION,
type: process.env.IOS_DEVICE?.trim(),
os: process.env.IOS_VERSION?.trim(),
},
},
},
configurations: {
'ios.sim.debug': {
device: 'simulator',
app: 'ios.debug',
testRunner: testRunnerIos,
},
'ios.sim.release': {
device: 'simulator',
app: 'ios.release',
testRunner: testRunnerIos,
},
'android.att.debug': {
device: 'attached',
app: 'android.debug',
testRunner: testRunnerAos,
},
'android.att.release': {
device: 'attached',
app: 'android.release',
testRunner: testRunnerAos,
},
'android.emu.debug': {
device: 'emulator',
app: 'android.debug',
testRunner: testRunnerAos,
},
'android.emu.release': {
device: 'emulator',
app: 'android.release',
testRunner: testRunnerAos,
},
'ci.android': {
device: 'ci.emulator',
app: 'ci.android',
testRunner: testRunnerAos,
testRunner: {
args: {
$0: 'jest',
config: 'e2e/jest.config.android.js',
},
jest: {
setupTimeout: 120000,
},
},
},
'ci.sim': {
device: 'ci.simulator',
app: 'ci.ios',
testRunner: testRunnerIos,
testRunner: {
args: {
$0: 'jest',
config: 'e2e/jest.config.ios.js',
},
jest: {
setupTimeout: 120000,
},
},
},
},
};
2 changes: 2 additions & 0 deletions samples/react-native/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,5 @@ yarn-error.log
.metro-health-check*

*.xcarchive
*.apk
**/*.app
2 changes: 1 addition & 1 deletion samples/react-native/e2e/captureMessage.test.android.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { describe, it, beforeAll, expect } from '@jest/globals';
import { describe, it, beforeAll, expect, afterAll } from '@jest/globals';
import { Envelope } from '@sentry/core';
import { device } from 'detox';
import {
Expand Down
2 changes: 1 addition & 1 deletion samples/react-native/e2e/captureMessage.test.ios.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { describe, it, beforeAll, expect } from '@jest/globals';
import { describe, it, beforeAll, expect, afterAll } from '@jest/globals';
import { Envelope } from '@sentry/core';
import { device } from 'detox';
import {
Expand Down
2 changes: 1 addition & 1 deletion samples/react-native/e2e/envelopeHeader.test.android.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { describe, it, beforeAll, expect } from '@jest/globals';
import { describe, it, beforeAll, expect, afterAll } from '@jest/globals';
import { Envelope } from '@sentry/core';
import { device } from 'detox';
import {
Expand Down
2 changes: 1 addition & 1 deletion samples/react-native/e2e/envelopeHeader.test.ios.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { describe, it, beforeAll, expect } from '@jest/globals';
import { describe, it, beforeAll, expect, afterAll } from '@jest/globals';
import { Envelope } from '@sentry/core';
import { device } from 'detox';
import {
Expand Down
25 changes: 19 additions & 6 deletions samples/react-native/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,28 @@
"private": true,
"scripts": {
"postinstall": "patch-package",
"android": "react-native run-android",
"ios": "react-native run-ios",
"start": "react-native start",
"build-android-release": "scripts/build-android-release.sh",
"build-android-release-legacy": "scripts/build-android-release-legacy.sh",
"build-android-debug": "scripts/build-android-debug.sh",
"build-android-debug-legacy": "scripts/build-android-debug-legacy.sh",
"build-ios-release": "scripts/build-ios-release.sh",
"build-ios-debug": "scripts/build-ios-debug.sh",
"test": "jest",
"set-test-dsn-android": "scripts/set-dsn-aos.mjs",
"set-test-dsn-ios": "scripts/set-dsn-ios.mjs",
"test-android": "scripts/test-android.sh",
"test-ios": "scripts/test-ios.sh",
"lint": "npx eslint . --ext .js,.jsx,.ts,.tsx",
"fix": "eslint . --ext .js,.jsx,.ts,.tsx --fix",
"pod-install": "cd ios; RCT_NEW_ARCH_ENABLED=1 bundle exec pod install; cd ..",
"pod-install-production": "cd ios; PRODUCTION=1 RCT_NEW_ARCH_ENABLED=1 bundle exec pod install; cd ..",
"pod-install-legacy": "cd ios; bundle exec pod install; cd ..",
"pod-install-legacy-production": "cd ios; PRODUCTION=1 bundle exec pod install; cd ..",
"pod-install-debug-static": "scripts/pod-install-debug-static.sh",
"pod-install-debug-static-legacy": "scripts/pod-install-debug-static-legacy.sh",
"pod-install-debug-dynamic": "scripts/pod-install-debug-dynamic.sh",
"pod-install-debug-dynamic-legacy": "scripts/pod-install-debug-dynamic-legacy.sh",
"pod-install-release-static": "scripts/pod-install-release-static.sh",
"pod-install-release-static-legacy": "scripts/pod-install-release-static-legacy.sh",
"pod-install-release-dynamic": "scripts/pod-install-release-dynamic.sh",
"pod-install-release-dynamic-legacy": "scripts/pod-install-release-dynamic-legacy.sh",
"clean-ios": "cd ios; rm -rf Podfile.lock Pods build; cd ..",
"clean-watchman": "watchman watch-del-all",
"set-build-number": "npx react-native-version --skip-tag --never-amend --set-build",
Expand Down Expand Up @@ -53,6 +65,7 @@
"@react-native/metro-config": "0.77.0",
"@react-native/typescript-config": "0.77.0",
"@sentry/babel-plugin-component-annotate": "^3.1.2",
"@sentry/core": "8.54.0",
"@types/react": "^18.2.65",
"@types/react-native-vector-icons": "^6.4.18",
"@types/react-test-renderer": "^18.0.0",
Expand Down
11 changes: 11 additions & 0 deletions samples/react-native/scripts/build-android-debug-legacy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash

# Exit on error
set -e

thisFilePath=$(dirname "$0")

export RN_ARCHITECTURE="legacy"
export CONFIG="debug"

"${thisFilePath}/build-android.sh"
Loading
Loading