feat: v7: Capture app start errors before JS #10186
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Sample Application | |
| on: | |
| push: | |
| branches: | |
| - main | |
| - v5 | |
| pull_request: | |
| types: [opened, synchronize, reopened, labeled] | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} | |
| env: | |
| SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} | |
| MAESTRO_VERSION: '2.0.10' | |
| MAESTRO_DRIVER_STARTUP_TIMEOUT: 90000 # Increase timeout from default 30s to 90s for CI stability | |
| RN_SENTRY_POD_NAME: RNSentry | |
| IOS_APP_ARCHIVE_PATH: sentry-react-native-sample.app.zip | |
| ANDROID_APP_ARCHIVE_PATH: sentry-react-native-sample.apk.zip | |
| REACT_NATIVE_SAMPLE_PATH: samples/react-native | |
| IOS_DEVICE: 'iPhone 16' | |
| IOS_VERSION: '>=18.0' | |
| ANDROID_API_LEVEL: '30' | |
| jobs: | |
| ready-to-merge-gate: | |
| name: Ready-to-merge gate | |
| uses: ./.github/workflows/ready-to-merge-workflow.yml | |
| with: | |
| is-pr: ${{ github.event_name == 'pull_request' }} | |
| labels: ${{ toJson(github.event.pull_request.labels) }} | |
| diff_check: | |
| needs: [ready-to-merge-gate] | |
| uses: ./.github/workflows/skip-ci.yml | |
| build: | |
| name: Build ${{ matrix.rn-architecture }} ${{ matrix.platform }} ${{ matrix.build-type }} ${{ matrix.ios-use-frameworks}} | |
| runs-on: ${{ matrix.runs-on }} | |
| needs: [diff_check] | |
| if: ${{ needs.diff_check.outputs.skip_ci != 'true' }} | |
| env: | |
| SENTRY_DISABLE_AUTO_UPLOAD: 'true' | |
| strategy: | |
| # 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 | |
| xcode-version: '16.4' | |
| runs-on: macos-15 | |
| - platform: macos | |
| runs-on: macos-15 | |
| - platform: android | |
| runs-on: ubuntu-latest | |
| exclude: | |
| - platform: 'android' | |
| ios-use-frameworks: 'dynamic-frameworks' | |
| - rn-architecture: 'new' | |
| ios-use-frameworks: 'dynamic-frameworks' | |
| - rn-architecture: 'new' | |
| platform: 'macos' | |
| - ios-use-frameworks: 'dynamic-frameworks' | |
| platform: 'macos' | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Enable Corepack | |
| run: npm i -g corepack | |
| - uses: actions/setup-node@v6 | |
| with: | |
| package-manager-cache: false | |
| node-version: 18 | |
| cache: 'yarn' | |
| cache-dependency-path: yarn.lock | |
| - uses: ruby/setup-ruby@v1 | |
| if: ${{ matrix.platform == 'ios' || matrix.platform == 'macos' }} | |
| with: | |
| working-directory: ${{ matrix.platform == 'ios' && env.REACT_NATIVE_SAMPLE_PATH || 'samples/react-native-macos' }} | |
| ruby-version: '3.3.0' # based on what is used in the sample | |
| bundler-cache: true # runs 'bundle install' and caches installed gems automatically | |
| cache-version: 1 # cache the installed gems | |
| - uses: actions/setup-java@v5 | |
| with: | |
| java-version: '17' | |
| distribution: 'adopt' | |
| - name: Gradle cache | |
| uses: gradle/gradle-build-action@v3 | |
| - run: sudo xcode-select -s /Applications/Xcode_${{ matrix.xcode-version }}.app/Contents/Developer | |
| if: ${{ matrix.platform == 'ios' }} | |
| - name: Setup Global Xcode Tools | |
| if: ${{ matrix.platform == 'ios' }} | |
| run: which xcbeautify || brew install xcbeautify | |
| - name: Install SDK Dependencies | |
| run: yarn install | |
| - name: Build SDK | |
| run: yarn build | |
| - name: Install App Pods | |
| if: ${{ matrix.platform == 'ios' || matrix.platform == 'macos' }} | |
| working-directory: samples | |
| run: | | |
| [[ "${{ matrix.platform }}" == "ios" ]] && cd react-native | |
| [[ "${{ matrix.platform }}" == "macos" ]] && cd react-native-macos | |
| [[ "${{ 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 | |
| ./scripts/pod-install.sh | |
| - name: Build Android App | |
| if: ${{ matrix.platform == 'android' }} | |
| working-directory: ${{ env.REACT_NATIVE_SAMPLE_PATH }} | |
| run: | | |
| export RN_ARCHITECTURE="${{ matrix.rn-architecture }}" | |
| [[ "${{ matrix.build-type }}" == "production" ]] && export CONFIG='release' || export CONFIG='debug' | |
| ./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 }} | |
| run: | | |
| [[ "${{ matrix.build-type }}" == "production" ]] && export CONFIG='Release' || export CONFIG='Debug' | |
| ./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" ]] && export CONFIG='Release' || export CONFIG='Debug' | |
| echo "Building $CONFIG" | |
| mkdir -p "DerivedData" | |
| derivedData="$(cd "DerivedData" ; pwd -P)" | |
| set -o pipefail && xcodebuild \ | |
| -workspace sentry-react-native-sample.xcworkspace \ | |
| -configuration "$CONFIG" \ | |
| -scheme sentry-react-native-sample-macOS \ | |
| -destination 'platform=macOS' \ | |
| ONLY_ACTIVE_ARCH=yes \ | |
| -derivedDataPath "$derivedData" \ | |
| build \ | |
| | tee xcodebuild.log \ | |
| | xcbeautify --quieter --is-ci --disable-colored-output | |
| - name: Archive iOS App | |
| if: ${{ matrix.platform == 'ios' && matrix.rn-architecture == 'new' && matrix.build-type == 'production' && matrix.ios-use-frameworks == 'no-frameworks' }} | |
| working-directory: ${{ env.REACT_NATIVE_SAMPLE_PATH }} | |
| run: | | |
| zip -r \ | |
| ${{ github.workspace }}/${{ env.IOS_APP_ARCHIVE_PATH }} \ | |
| sentryreactnativesample.app | |
| - name: Archive Android App | |
| if: ${{ matrix.platform == 'android' && matrix.rn-architecture == 'new' && matrix.build-type == 'production' }} | |
| run: | | |
| zip -j \ | |
| ${{ env.ANDROID_APP_ARCHIVE_PATH }} \ | |
| ${{ 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' }} | |
| uses: actions/upload-artifact@v6 | |
| with: | |
| name: sample-rn-${{ matrix.rn-architecture }}-${{ matrix.build-type }}-${{ matrix.ios-use-frameworks}}-${{ matrix.platform }} | |
| path: ${{ env.IOS_APP_ARCHIVE_PATH }} | |
| retention-days: 1 | |
| - name: Upload Android APK | |
| if: ${{ matrix.platform == 'android' && matrix.rn-architecture == 'new' && matrix.build-type == 'production' }} | |
| uses: actions/upload-artifact@v6 | |
| with: | |
| name: sample-rn-${{ matrix.rn-architecture }}-${{ matrix.build-type }}-${{ matrix.platform }} | |
| path: ${{ env.ANDROID_APP_ARCHIVE_PATH }} | |
| retention-days: 1 | |
| - name: Upload logs | |
| if: ${{ always() }} | |
| uses: actions/upload-artifact@v6 | |
| with: | |
| name: build-sample-${{ matrix.rn-architecture }}-${{ matrix.platform }}-${{ matrix.build-type }}-${{ matrix.ios-use-frameworks}}-logs | |
| path: ${{ env.REACT_NATIVE_SAMPLE_PATH }}/${{ matrix.platform }}/*.log | |
| test: | |
| name: Test ${{ matrix.platform }} ${{ matrix.build-type }} REV2 | |
| runs-on: ${{ matrix.runs-on }} | |
| needs: [diff_check, build] | |
| if: ${{ needs.diff_check.outputs.skip_ci != 'true' }} | |
| strategy: | |
| # we want that the matrix keeps running, default is to cancel them if it fails. | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - platform: ios | |
| runs-on: macos-15 | |
| rn-architecture: 'new' | |
| ios-use-frameworks: 'no-frameworks' | |
| build-type: 'production' | |
| - platform: android | |
| runs-on: ubuntu-latest | |
| rn-architecture: 'new' | |
| build-type: 'production' | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Install Maestro | |
| uses: dniHze/maestro-test-action@bda8a93211c86d0a05b7a4597c5ad134566fbde4 # [email protected] | |
| with: | |
| version: ${{env.MAESTRO_VERSION}} | |
| - name: Download iOS App Archive | |
| if: ${{ matrix.platform == 'ios' }} | |
| uses: actions/download-artifact@v7 | |
| with: | |
| name: sample-rn-${{ matrix.rn-architecture }}-${{ matrix.build-type }}-${{ matrix.ios-use-frameworks}}-${{ matrix.platform }} | |
| path: ${{ env.REACT_NATIVE_SAMPLE_PATH }} | |
| - name: Download Android APK | |
| if: ${{ matrix.platform == 'android' }} | |
| uses: actions/download-artifact@v7 | |
| with: | |
| name: sample-rn-${{ matrix.rn-architecture }}-${{ matrix.build-type }}-${{ matrix.platform }} | |
| path: ${{ env.REACT_NATIVE_SAMPLE_PATH }} | |
| - name: Unzip iOS App Archive | |
| if: ${{ matrix.platform == 'ios' }} | |
| working-directory: ${{ env.REACT_NATIVE_SAMPLE_PATH }} | |
| run: unzip ${{ env.IOS_APP_ARCHIVE_PATH }} | |
| - name: Unzip Android APK | |
| if: ${{ matrix.platform == 'android' }} | |
| working-directory: ${{ env.REACT_NATIVE_SAMPLE_PATH }} | |
| run: | | |
| unzip ${{ env.ANDROID_APP_ARCHIVE_PATH }} | |
| rm app-androidTest.apk | |
| - name: Enable Corepack | |
| run: npm i -g corepack | |
| - uses: actions/setup-node@v6 | |
| with: | |
| package-manager-cache: false | |
| node-version: 18 | |
| cache: 'yarn' | |
| cache-dependency-path: yarn.lock | |
| - name: Install JS Dependencies | |
| run: yarn install | |
| - uses: ./.github/actions/disk-cleanup | |
| if: ${{ matrix.platform == 'android' }} | |
| - name: Setup KVM | |
| if: ${{ matrix.platform == 'android' }} | |
| shell: bash | |
| run: | | |
| # check if virtualization is supported... | |
| sudo apt install -y --no-install-recommends cpu-checker coreutils && echo "CPUs=$(nproc --all)" && kvm-ok | |
| # allow access to KVM to run the emulator | |
| echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' \ | |
| | sudo tee /etc/udev/rules.d/99-kvm4all.rules | |
| sudo udevadm control --reload-rules | |
| sudo udevadm trigger --name-match=kvm | |
| - name: Boot ${{ env.IOS_DEVICE }} with iOS ${{ env.IOS_VERSION }} | |
| uses: futureware-tech/simulator-action@dab10d813144ef59b48d401cd95da151222ef8cd # pin@v4 | |
| if: ${{ matrix.platform == 'ios' }} | |
| with: | |
| model: ${{ env.IOS_DEVICE }} | |
| os_version: ${{ env.IOS_VERSION }} | |
| - name: Run iOS Tests | |
| if: ${{ matrix.platform == 'ios' }} | |
| working-directory: ${{ env.REACT_NATIVE_SAMPLE_PATH }} | |
| run: yarn test-ios | |
| - name: Run Android Tests on API ${{ env.ANDROID_API_LEVEL }} | |
| if: ${{ matrix.platform == 'android' }} | |
| uses: reactivecircus/android-emulator-runner@b530d96654c385303d652368551fb075bc2f0b6b # [email protected] | |
| with: | |
| api-level: ${{ env.ANDROID_API_LEVEL }} | |
| force-avd-creation: false | |
| disable-animations: true | |
| disable-spellchecker: true | |
| target: 'aosp_atd' | |
| channel: canary # Necessary for ATDs | |
| disk-size: 4096M | |
| emulator-options: > | |
| -no-window | |
| -no-snapshot-save | |
| -gpu swiftshader_indirect | |
| -noaudio | |
| -no-boot-anim | |
| -camera-back none | |
| -camera-front none | |
| -timezone US/Pacific | |
| working-directory: ${{ env.REACT_NATIVE_SAMPLE_PATH }} | |
| script: yarn test-android |