bugfix: deliver breadcrumbs to native crash reports (#392) #12
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: Android CI | |
| on: | |
| push: | |
| branches: [main, dev] | |
| paths: | |
| - packages/react-native/** | |
| - packages/sdk-core/** | |
| - examples/sdk/reactNative/** | |
| - .github/workflows/android.yml | |
| - .github/scripts/** | |
| pull_request: | |
| paths: | |
| - packages/react-native/** | |
| - packages/sdk-core/** | |
| - examples/sdk/reactNative/** | |
| - .github/workflows/android.yml | |
| - .github/scripts/** | |
| workflow_dispatch: | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.head_ref || github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| native_crash: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 30 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| api-level: [34] | |
| arch: [x86_64] | |
| new-arch: [true, false] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Verify 16KB alignment | |
| run: | | |
| sudo apt-get install -y binutils | |
| bash scripts/verify-elf-16k.sh | |
| - name: Use Node.js 20.x | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20.x | |
| cache: npm | |
| cache-dependency-path: | | |
| package-lock.json | |
| examples/sdk/reactNative/package-lock.json | |
| - name: Use Java 17 | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: temurin | |
| java-version: 17 | |
| cache: gradle | |
| - run: npm ci | |
| - run: npm run build | |
| - name: Install example dependencies | |
| working-directory: examples/sdk/reactNative | |
| # npm ci fails after an SDK version bump, the lock records the linked package's version. | |
| run: npm install --no-audit --no-fund | |
| - name: Inject the CI crash driver into the example entry point | |
| run: cat .github/scripts/ci-crash-driver.js >> examples/sdk/reactNative/index.js | |
| - name: Run SDK unit tests | |
| working-directory: examples/sdk/reactNative/android | |
| run: ./gradlew :backtrace_react-native:testDebugUnitTest -PnewArchEnabled=${{ matrix.new-arch }} --console=plain | |
| - name: Build example app | |
| working-directory: examples/sdk/reactNative/android | |
| run: ./gradlew assembleRelease -PbtCiDebuggable -PnewArchEnabled=${{ matrix.new-arch }} -x uploadSourceMapsToBacktrace --console=plain | |
| - name: Verify native libraries and JNI symbols | |
| run: bash .github/scripts/verify-jni-symbols.sh examples/sdk/reactNative/android/app/build/outputs/apk/release/app-release.apk | |
| - name: Enable KVM | |
| run: | | |
| 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: AVD cache | |
| uses: actions/cache@v4 | |
| id: avd-cache | |
| with: | |
| path: | | |
| ~/.android/avd/* | |
| ~/.android/adb* | |
| key: avd-${{ matrix.api-level }}-${{ matrix.arch }} | |
| - name: Create AVD snapshot for caching | |
| if: steps.avd-cache.outputs.cache-hit != 'true' | |
| uses: reactivecircus/android-emulator-runner@v2 | |
| with: | |
| api-level: ${{ matrix.api-level }} | |
| arch: ${{ matrix.arch }} | |
| target: google_apis | |
| force-avd-creation: false | |
| emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none | |
| disable-animations: false | |
| script: echo "Generated AVD snapshot for caching." | |
| - name: Capture a native crash on the emulator | |
| uses: reactivecircus/android-emulator-runner@v2 | |
| with: | |
| api-level: ${{ matrix.api-level }} | |
| arch: ${{ matrix.arch }} | |
| target: google_apis | |
| force-avd-creation: false | |
| emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none | |
| disable-animations: true | |
| script: bash .github/scripts/android-native-crash.sh | |
| - name: Upload crash evidence | |
| if: failure() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: native-crash-api${{ matrix.api-level }}-${{ matrix.arch }}-newarch-${{ matrix.new-arch }} | |
| path: | | |
| /tmp/native-crash.dmp | |
| /tmp/logcat.txt | |
| if-no-files-found: warn | |
| retention-days: 7 |