diff --git a/.github/workflows/sample-application.yml b/.github/workflows/sample-application.yml index 0c697f22e5..fd96e31d60 100644 --- a/.github/workflows/sample-application.yml +++ b/.github/workflows/sample-application.yml @@ -26,7 +26,7 @@ jobs: uses: ./.github/workflows/skip-ci.yml build: - name: Build ${{ matrix.rn-architecture }} ${{ matrix.platform }} ${{ matrix.build-type }} ${{ matrix.ios-use-frameworks}} + name: ${{ matrix.job-name }} runs-on: ${{ matrix.runs-on }} needs: [diff_check] if: ${{ needs.diff_check.outputs.skip_ci != 'true' }} @@ -36,26 +36,96 @@ jobs: # we want that the matrix keeps running, default is to cancel them if it fails. fail-fast: false matrix: - rn-architecture: ['legacy', 'new'] - ios-use-frameworks: ['no-frameworks', 'dynamic-frameworks'] - platform: ['android', 'ios', 'macos'] - build-type: ['dev', 'production'] include: - - platform: ios + # macOS builds + - job-name: Build macOS Legacy Dev + platform: macos runs-on: macos-15 - - platform: macos + rn-architecture: legacy + build-type: dev + + - job-name: Build macOS Legacy Release + platform: macos runs-on: macos-15 - - platform: android - runs-on: ubuntu-latest - exclude: - - platform: 'android' + rn-architecture: legacy + build-type: production + + # iOS builds + - job-name: Build iOS Legacy Dev + platform: ios + runs-on: macos-15 + rn-architecture: legacy + build-type: dev + + - job-name: Build iOS Legacy Prod + platform: ios + runs-on: macos-15 + rn-architecture: legacy + build-type: production + + - job-name: Build iOS New Arch Dev Static + platform: ios + runs-on: macos-15 + rn-architecture: new + build-type: dev + ios-use-frameworks: 'no-frameworks' + + - job-name: Build iOS New Arch Prod Static + platform: ios + runs-on: macos-15 + rn-architecture: new + build-type: production + ios-use-frameworks: 'no-frameworks' + + - job-name: Build iOS New Arch Dev Dynamic + platform: ios + runs-on: macos-15 + rn-architecture: new + build-type: dev ios-use-frameworks: 'dynamic-frameworks' - - rn-architecture: 'new' + + - job-name: Build iOS New Arch Prod Dynamic + platform: ios + runs-on: macos-15 + rn-architecture: new + build-type: production ios-use-frameworks: 'dynamic-frameworks' - - rn-architecture: 'new' - platform: 'macos' - - ios-use-frameworks: 'dynamic-frameworks' - platform: 'macos' + + # Android builds + - job-name: Build Android Legacy Dev Manual + platform: android + runs-on: ubuntu-latest + rn-architecture: legacy + build-type: dev + init-type: manual + + - job-name: Build Android Legacy Prod Manual + platform: android + runs-on: ubuntu-latest + rn-architecture: legacy + build-type: production + init-type: manual + + - job-name: Build Android New Arch Dev Manual + platform: android + runs-on: ubuntu-latest + rn-architecture: new + build-type: dev + init-type: manual + + - job-name: Build Android New Arch Prod Manual + platform: android + runs-on: ubuntu-latest + rn-architecture: new + build-type: production + init-type: manual + + - job-name: Build Android New Arch Prod Auto + platform: android + runs-on: ubuntu-latest + rn-architecture: new + build-type: production + init-type: auto steps: - uses: actions/checkout@v4 @@ -114,6 +184,7 @@ jobs: run: | export RN_ARCHITECTURE="${{ matrix.rn-architecture }}" [[ "${{ matrix.build-type }}" == "production" ]] && export CONFIG='release' || export CONFIG='debug' + [[ "${{ matrix.init-type }}" == "auto" ]] && export SENTRY_DISABLE_NATIVE_START='true' || export SENTRY_DISABLE_NATIVE_START='false' ./scripts/set-dsn-aos.mjs ./scripts/build-android.sh -PreactNativeArchitectures=x86 @@ -174,7 +245,7 @@ jobs: if: ${{ matrix.platform == 'android' && matrix.rn-architecture == 'new' && matrix.build-type == 'production' }} uses: actions/upload-artifact@v4 with: - name: sample-rn-${{ matrix.rn-architecture }}-${{ matrix.build-type }}-${{ matrix.platform }} + name: sample-rn-${{ matrix.rn-architecture }}-${{ matrix.build-type }}-${{ matrix.platform }}-${{ matrix.init-type }} path: ${{ env.ANDROID_APP_ARCHIVE_PATH }} retention-days: 1 @@ -195,7 +266,7 @@ jobs: fail-fast: false matrix: include: - - job-name: 'Test iOS Release Auto Init' + - job-name: 'Test iOS Prod New Arch Auto Init' platform: ios runs-on: macos-15 rn-architecture: 'new' @@ -203,7 +274,7 @@ jobs: build-type: 'production' test-command: 'yarn test-ios-auto' # tests native auto init from JS - - job-name: 'Test iOS Release Manual Init' + - job-name: 'Test iOS Prod New Arch Manual Init' platform: ios runs-on: macos-15 rn-architecture: 'new' @@ -211,12 +282,21 @@ jobs: build-type: 'production' test-command: 'yarn test-ios-manual' - - job-name: 'Test Android Release Manual Init' + - job-name: 'Test Android Prod New Arch Manual Init' + platform: android + runs-on: ubuntu-latest + rn-architecture: 'new' + build-type: 'production' + init-type: manual + test-command: 'yarn test-android-manual' + + - job-name: 'Test Android Prod New Arch Auto Init' platform: android runs-on: ubuntu-latest rn-architecture: 'new' build-type: 'production' - test-command: 'yarn test-android' + init-type: auto + test-command: 'yarn test-android-auto' steps: - uses: actions/checkout@v4 @@ -232,7 +312,7 @@ jobs: if: ${{ matrix.platform == 'android' }} uses: actions/download-artifact@v4 with: - name: sample-rn-${{ matrix.rn-architecture }}-${{ matrix.build-type }}-${{ matrix.platform }} + name: sample-rn-${{ matrix.rn-architecture }}-${{ matrix.build-type }}-${{ matrix.platform }}-${{ matrix.init-type }} path: ${{ env.REACT_NATIVE_SAMPLE_PATH }} - name: Unzip iOS App Archive diff --git a/samples/react-native/.detoxrc.js b/samples/react-native/.detoxrc.js index a3501515a9..a984f40945 100644 --- a/samples/react-native/.detoxrc.js +++ b/samples/react-native/.detoxrc.js @@ -1,5 +1,27 @@ const process = require('process'); +const baseConfig = jestConfig => ({ + testRunner: { + args: { + $0: 'jest', + config: jestConfig, + }, + jest: { + setupTimeout: 120000, + }, + }, +}); + +const androidConfig = () => ({ + device: 'ci.emulator', + app: 'ci.android', +}); + +const iosConfig = () => ({ + device: 'ci.simulator', + app: 'ci.ios', +}); + /** @type {Detox.DetoxConfig} */ module.exports = { testRunner: {}, @@ -31,44 +53,21 @@ module.exports = { }, }, configurations: { - 'ci.android': { - device: 'ci.emulator', - app: 'ci.android', - testRunner: { - args: { - $0: 'jest', - config: 'e2e/jest.config.android.js', - }, - jest: { - setupTimeout: 120000, - }, - }, + 'ci.android.auto': { + ...baseConfig('e2e/jest.config.android.auto.js'), + ...androidConfig(), + }, + 'ci.android.manual': { + ...baseConfig('e2e/jest.config.android.manual.js'), + ...androidConfig(), }, 'ci.sim.auto': { - device: 'ci.simulator', - app: 'ci.ios', - testRunner: { - args: { - $0: 'jest', - config: 'e2e/jest.config.ios.auto.js', - }, - jest: { - setupTimeout: 120000, - }, - }, + ...baseConfig('e2e/jest.config.ios.auto.js'), + ...iosConfig(), }, 'ci.sim.manual': { - device: 'ci.simulator', - app: 'ci.ios', - testRunner: { - args: { - $0: 'jest', - config: 'e2e/jest.config.ios.manual.js', - }, - jest: { - setupTimeout: 120000, - }, - }, + ...baseConfig('e2e/jest.config.ios.manual.js'), + ...iosConfig(), }, }, }; diff --git a/samples/react-native/e2e/jest.config.android.js b/samples/react-native/e2e/jest.config.android.auto.js similarity index 51% rename from samples/react-native/e2e/jest.config.android.js rename to samples/react-native/e2e/jest.config.android.auto.js index a07210b212..6fd21728be 100644 --- a/samples/react-native/e2e/jest.config.android.js +++ b/samples/react-native/e2e/jest.config.android.auto.js @@ -3,5 +3,9 @@ const baseConfig = require('./jest.config.base'); /** @type {import('@jest/types').Config.InitialOptions} */ module.exports = { ...baseConfig, - testMatch: [...baseConfig.testMatch, '/e2e/**/*.test.android.ts'], + testMatch: [ + ...baseConfig.testMatch, + '/e2e/**/*.test.android.ts', + '/e2e/**/*.test.android.auto.ts', + ], }; diff --git a/samples/react-native/e2e/jest.config.android.manual.js b/samples/react-native/e2e/jest.config.android.manual.js new file mode 100644 index 0000000000..89d80d3fc7 --- /dev/null +++ b/samples/react-native/e2e/jest.config.android.manual.js @@ -0,0 +1,11 @@ +const baseConfig = require('./jest.config.base'); + +/** @type {import('@jest/types').Config.InitialOptions} */ +module.exports = { + ...baseConfig, + testMatch: [ + ...baseConfig.testMatch, + '/e2e/**/*.test.android.ts', + '/e2e/**/*.test.android.manual.ts', + ], +}; diff --git a/samples/react-native/package.json b/samples/react-native/package.json index 8e80a5d598..55431c6409 100644 --- a/samples/react-native/package.json +++ b/samples/react-native/package.json @@ -5,16 +5,21 @@ "scripts": { "postinstall": "patch-package", "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-android-release-manual": "scripts/build-android-release-manual.sh", + "build-android-release-legacy-manual": "scripts/build-android-release-legacy-manual.sh", + "build-android-debug-manual": "scripts/build-android-debug-manual.sh", + "build-android-debug-legacy-manual": "scripts/build-android-debug-legacy-manual.sh", + "build-android-release-auto": "scripts/build-android-release-auto.sh", + "build-android-release-legacy-auto": "scripts/build-android-release-legacy-auto.sh", + "build-android-debug-auto": "scripts/build-android-debug-auto.sh", + "build-android-debug-legacy-auto": "scripts/build-android-debug-legacy-auto.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-android-auto": "scripts/test-android-auto.sh", + "test-android-manual": "scripts/test-android-manual.sh", "test-ios-manual": "scripts/test-ios-manual.sh", "test-ios-auto": "scripts/test-ios-auto.sh", "lint": "npx eslint . --ext .js,.jsx,.ts,.tsx", diff --git a/samples/react-native/scripts/build-android-debug.sh b/samples/react-native/scripts/build-android-debug-auto.sh similarity index 78% rename from samples/react-native/scripts/build-android-debug.sh rename to samples/react-native/scripts/build-android-debug-auto.sh index 89f9ae626c..85b2f4bb88 100755 --- a/samples/react-native/scripts/build-android-debug.sh +++ b/samples/react-native/scripts/build-android-debug-auto.sh @@ -7,5 +7,6 @@ thisFilePath=$(dirname "$0") export RN_ARCHITECTURE="new" export CONFIG="debug" +export SENTRY_DISABLE_NATIVE_START="true" "${thisFilePath}/build-android.sh" diff --git a/samples/react-native/scripts/build-android-debug-legacy.sh b/samples/react-native/scripts/build-android-debug-legacy-auto.sh similarity index 78% rename from samples/react-native/scripts/build-android-debug-legacy.sh rename to samples/react-native/scripts/build-android-debug-legacy-auto.sh index ac0952892d..fbe8501a64 100755 --- a/samples/react-native/scripts/build-android-debug-legacy.sh +++ b/samples/react-native/scripts/build-android-debug-legacy-auto.sh @@ -7,5 +7,6 @@ thisFilePath=$(dirname "$0") export RN_ARCHITECTURE="legacy" export CONFIG="debug" +export SENTRY_DISABLE_NATIVE_START="true" "${thisFilePath}/build-android.sh" diff --git a/samples/react-native/scripts/build-android-debug-legacy-manual.sh b/samples/react-native/scripts/build-android-debug-legacy-manual.sh new file mode 100755 index 0000000000..84b2347f22 --- /dev/null +++ b/samples/react-native/scripts/build-android-debug-legacy-manual.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +# Exit on error +set -e + +thisFilePath=$(dirname "$0") + +export RN_ARCHITECTURE="legacy" +export CONFIG="debug" +export SENTRY_DISABLE_NATIVE_START="false" + +"${thisFilePath}/build-android.sh" diff --git a/samples/react-native/scripts/build-android-debug-manual.sh b/samples/react-native/scripts/build-android-debug-manual.sh new file mode 100755 index 0000000000..42514ca164 --- /dev/null +++ b/samples/react-native/scripts/build-android-debug-manual.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +# Exit on error +set -e + +thisFilePath=$(dirname "$0") + +export RN_ARCHITECTURE="new" +export CONFIG="debug" +export SENTRY_DISABLE_NATIVE_START="false" + +"${thisFilePath}/build-android.sh" diff --git a/samples/react-native/scripts/build-android-release.sh b/samples/react-native/scripts/build-android-release-auto.sh similarity index 78% rename from samples/react-native/scripts/build-android-release.sh rename to samples/react-native/scripts/build-android-release-auto.sh index 3403a3c1bb..150152b64c 100755 --- a/samples/react-native/scripts/build-android-release.sh +++ b/samples/react-native/scripts/build-android-release-auto.sh @@ -7,5 +7,6 @@ thisFilePath=$(dirname "$0") export RN_ARCHITECTURE="new" export CONFIG="release" +export SENTRY_DISABLE_NATIVE_START="true" "${thisFilePath}/build-android.sh" diff --git a/samples/react-native/scripts/build-android-release-legacy.sh b/samples/react-native/scripts/build-android-release-legacy-auto.sh similarity index 79% rename from samples/react-native/scripts/build-android-release-legacy.sh rename to samples/react-native/scripts/build-android-release-legacy-auto.sh index cf853c15cc..23b262fd13 100755 --- a/samples/react-native/scripts/build-android-release-legacy.sh +++ b/samples/react-native/scripts/build-android-release-legacy-auto.sh @@ -7,5 +7,6 @@ thisFilePath=$(dirname "$0") export RN_ARCHITECTURE="legacy" export CONFIG="release" +export SENTRY_DISABLE_NATIVE_START="true" "${thisFilePath}/build-android.sh" diff --git a/samples/react-native/scripts/build-android-release-legacy-manual.sh b/samples/react-native/scripts/build-android-release-legacy-manual.sh new file mode 100755 index 0000000000..94a1ac82b4 --- /dev/null +++ b/samples/react-native/scripts/build-android-release-legacy-manual.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +# Exit on error +set -e + +thisFilePath=$(dirname "$0") + +export RN_ARCHITECTURE="legacy" +export CONFIG="release" +export SENTRY_DISABLE_NATIVE_START="false" + +"${thisFilePath}/build-android.sh" diff --git a/samples/react-native/scripts/build-android-release-manual.sh b/samples/react-native/scripts/build-android-release-manual.sh new file mode 100755 index 0000000000..58d2c80aac --- /dev/null +++ b/samples/react-native/scripts/build-android-release-manual.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +# Exit on error +set -e + +thisFilePath=$(dirname "$0") + +export RN_ARCHITECTURE="new" +export CONFIG="release" +export SENTRY_DISABLE_NATIVE_START="false" + +"${thisFilePath}/build-android.sh" diff --git a/samples/react-native/scripts/test-android.sh b/samples/react-native/scripts/detect-aos-emu.sh similarity index 89% rename from samples/react-native/scripts/test-android.sh rename to samples/react-native/scripts/detect-aos-emu.sh index bbef32a81f..962d97ded0 100755 --- a/samples/react-native/scripts/test-android.sh +++ b/samples/react-native/scripts/detect-aos-emu.sh @@ -3,10 +3,6 @@ # Exit on error and print commands set -xe -thisFilePath=$(dirname "$0") - -cd "${thisFilePath}/.." - if [ -z "$ANDROID_AVD_NAME" ]; then # Get the name of the first booted or connected Android device DEVICE_NAME=$(adb devices | grep -w "device" | head -n 1 | cut -f 1) @@ -38,6 +34,3 @@ if [ -z "$ANDROID_AVD_NAME" ]; then echo "Using Android device: $DEVICE_NAME" fi fi - -# Run the tests -detox test --configuration ci.android diff --git a/samples/react-native/scripts/test-android-auto.sh b/samples/react-native/scripts/test-android-auto.sh new file mode 100755 index 0000000000..e6930dc60b --- /dev/null +++ b/samples/react-native/scripts/test-android-auto.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +# Exit on error and print commands +set -xe + +thisFilePath=$(dirname "$0") + +cd "${thisFilePath}/.." + +source "${thisFilePath}/detect-aos-emu.sh" + +# Run the tests +detox test --configuration ci.android.auto diff --git a/samples/react-native/scripts/test-android-manual.sh b/samples/react-native/scripts/test-android-manual.sh new file mode 100755 index 0000000000..33a27e90cd --- /dev/null +++ b/samples/react-native/scripts/test-android-manual.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +# Exit on error and print commands +set -xe + +thisFilePath=$(dirname "$0") + +cd "${thisFilePath}/.." + +source "${thisFilePath}/detect-aos-emu.sh" + +# Run the tests +detox test --configuration ci.android.manual diff --git a/samples/react-native/scripts/test-ios-auto.sh b/samples/react-native/scripts/test-ios-auto.sh index 9192a9619e..8e07b19824 100755 --- a/samples/react-native/scripts/test-ios-auto.sh +++ b/samples/react-native/scripts/test-ios-auto.sh @@ -7,6 +7,6 @@ thisFilePath=$(dirname "$0") cd "${thisFilePath}/.." -"${thisFilePath}/detect-ios-sim.sh" +source "${thisFilePath}/detect-ios-sim.sh" detox test --configuration ci.sim.auto --app-launch-args="--sentry-disable-native-start" diff --git a/samples/react-native/scripts/test-ios-manual.sh b/samples/react-native/scripts/test-ios-manual.sh index b1c295edda..6602f9f626 100755 --- a/samples/react-native/scripts/test-ios-manual.sh +++ b/samples/react-native/scripts/test-ios-manual.sh @@ -7,6 +7,6 @@ thisFilePath=$(dirname "$0") cd "${thisFilePath}/.." -"${thisFilePath}/detect-ios-sim.sh" +source "${thisFilePath}/detect-ios-sim.sh" detox test --configuration ci.sim.manual