Repository navigation
144 lines (124 loc) · 6.16 KB
/
Copy pathandroid.yml
File metadata and controls
144 lines (124 loc) · 6.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
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@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- 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@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
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@de7274f081f381c8f8158605e0321c36c376e2e6 # v6.0.1
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 bundleRelease -PbtCiDebuggable -PbtCiMinify -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: Download bundletool
run: |
curl -fsSL --retry 5 --retry-all-errors --retry-delay 5 -o "$RUNNER_TEMP/bundletool.jar" \
https://github.com/google/bundletool/releases/download/1.17.2/bundletool-all-1.17.2.jar
echo "2d4ad908faea64047c1cc9cb747e6aa667c6ab192e09607bd16b67246a8cd6ae $RUNNER_TEMP/bundletool.jar" | sha256sum -c -
- 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@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
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@a421e43855164a8197daf9d8d40fe71c6996bb0d # v2.38.0
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, single APK then Play-style split install, a fatal JS error and a render error on the emulator
uses: reactivecircus/android-emulator-runner@a421e43855164a8197daf9d8d40fe71c6996bb0d # v2.38.0
env:
BUNDLETOOL_JAR: ${{ runner.temp }}/bundletool.jar
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: |
INSTALL=apk bash .github/scripts/android-native-crash.sh
INSTALL=split bash .github/scripts/android-native-crash.sh
bash .github/scripts/android-js-fatal.sh
MODE=render-error bash .github/scripts/android-js-fatal.sh
- name: Upload crash evidence
if: failure()
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: native-crash-api${{ matrix.api-level }}-${{ matrix.arch }}-newarch-${{ matrix.new-arch }}
path: |
/tmp/native-crash-*.dmp
/tmp/logcat-*.txt
/tmp/js-fatal-logcat.txt
/tmp/render-error-logcat.txt
if-no-files-found: warn
retention-days: 7