diff --git a/.github/workflows/sample-application.yml b/.github/workflows/sample-application.yml index 603cafa619..3bfa290fe3 100644 --- a/.github/workflows/sample-application.yml +++ b/.github/workflows/sample-application.yml @@ -186,7 +186,7 @@ jobs: path: ${{ env.REACT_NATIVE_SAMPLE_PATH }}/${{ matrix.platform }}/*.log test: - name: Test ${{ matrix.platform }} ${{ matrix.build-type }} + name: ${{ matrix.job-name }} runs-on: ${{ matrix.runs-on }} needs: [diff_check, build] if: ${{ needs.diff_check.outputs.skip_ci != 'true' }} @@ -195,16 +195,28 @@ jobs: fail-fast: false matrix: include: - - platform: ios + - job-name: 'Test iOS Release Auto Init' + platform: ios runs-on: macos-15 rn-architecture: 'new' ios-use-frameworks: 'no-frameworks' build-type: 'production' + test-command: 'yarn test-ios-auto' # tests native auto init from JS - - platform: android + - job-name: 'Test iOS Release Manual Init' + platform: ios + runs-on: macos-15 + rn-architecture: 'new' + ios-use-frameworks: 'no-frameworks' + build-type: 'production' + test-command: 'yarn test-ios' + + - job-name: 'Test Android Release Manual Init' + platform: android runs-on: ubuntu-latest rn-architecture: 'new' build-type: 'production' + test-command: 'yarn test-android' steps: - uses: actions/checkout@v4 @@ -277,7 +289,7 @@ jobs: - name: Run Detox iOS Tests if: ${{ matrix.platform == 'ios' }} working-directory: ${{ env.REACT_NATIVE_SAMPLE_PATH }} - run: yarn test-ios + run: ${{ matrix.test-command }} - name: Run tests on Android if: ${{ matrix.platform == 'android' }} @@ -303,4 +315,4 @@ jobs: -camera-front none -timezone US/Pacific working-directory: ${{ env.REACT_NATIVE_SAMPLE_PATH }} - script: yarn test-android + script: ${{ matrix.test-command }} diff --git a/samples/react-native/package.json b/samples/react-native/package.json index fb1ddbcd67..a5b36afd9d 100644 --- a/samples/react-native/package.json +++ b/samples/react-native/package.json @@ -16,6 +16,7 @@ "set-test-dsn-ios": "scripts/set-dsn-ios.mjs", "test-android": "scripts/test-android.sh", "test-ios": "scripts/test-ios.sh", + "test-ios-auto": "scripts/test-ios-auto.sh", "lint": "npx eslint . --ext .js,.jsx,.ts,.tsx", "fix": "eslint . --ext .js,.jsx,.ts,.tsx --fix", "pod-install-debug-static": "scripts/pod-install-debug-static.sh", diff --git a/samples/react-native/scripts/detect-ios-sim.sh b/samples/react-native/scripts/detect-ios-sim.sh new file mode 100755 index 0000000000..1ba6d3b98c --- /dev/null +++ b/samples/react-native/scripts/detect-ios-sim.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +# Exit on error and print commands +set -xe + +if [ -z "$IOS_DEVICE" ]; then + # Get the first booted simulator device type and version + BOOTED_DEVICE=$(xcrun simctl list devices | grep "Booted" | head -n 1) + + if [ -z "$BOOTED_DEVICE" ]; then + echo "No booted iOS simulator found" + exit 1 + fi + + # Extract device type from booted device + export IOS_DEVICE=$(echo "$BOOTED_DEVICE" | cut -d "(" -f1 | xargs) + echo "Using booted iOS simulator: $IOS_DEVICE" +fi diff --git a/samples/react-native/scripts/test-ios-auto.sh b/samples/react-native/scripts/test-ios-auto.sh new file mode 100755 index 0000000000..5798457ec2 --- /dev/null +++ b/samples/react-native/scripts/test-ios-auto.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +# Exit on error and print commands +set -xe + +thisFilePath=$(dirname "$0") + +cd "${thisFilePath}/.." + +"${thisFilePath}/detect-ios-sim.sh" + +detox test --configuration ci.sim --app-launch-args="--sentry-disable-native-start" diff --git a/samples/react-native/scripts/test-ios.sh b/samples/react-native/scripts/test-ios.sh index ee9b1bb83f..3e8d8c64a3 100755 --- a/samples/react-native/scripts/test-ios.sh +++ b/samples/react-native/scripts/test-ios.sh @@ -7,18 +7,6 @@ thisFilePath=$(dirname "$0") cd "${thisFilePath}/.." -if [ -z "$IOS_DEVICE" ]; then - # Get the first booted simulator device type and version - BOOTED_DEVICE=$(xcrun simctl list devices | grep "Booted" | head -n 1) - - if [ -z "$BOOTED_DEVICE" ]; then - echo "No booted iOS simulator found" - exit 1 - fi - - # Extract device type from booted device - export IOS_DEVICE=$(echo "$BOOTED_DEVICE" | cut -d "(" -f1 | xargs) - echo "Using booted iOS simulator: $IOS_DEVICE" -fi +"${thisFilePath}/detect-ios-sim.sh" detox test --configuration ci.sim