-
Notifications
You must be signed in to change notification settings - Fork 7
136 lines (131 loc) · 4.89 KB
/
check.yml
File metadata and controls
136 lines (131 loc) · 4.89 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
name: Check
env:
# Version here should match the one in React Native template and packages/cmake-rn/src/cli.ts
NDK_VERSION: 27.1.12297006
on:
push:
branches:
- main
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: lts/jod
- run: npm ci
- run: npm run lint
test:
strategy:
fail-fast: false
matrix:
runner:
- ubuntu-latest
- windows-latest
- macos-latest
variant:
- unit-tests
- android-tests
- ios-tests
exclude:
# iOS tests are only supported on macOS runners
- runner: ubuntu-latest
variant: ios-tests
- runner: windows-latest
variant: ios-tests
# The reactivecircus/android-emulator-runner action does not support Windows runners
# See https://github.com/marketplace/actions/android-emulator-runner#github-action---android-emulator-runner
- runner: windows-latest
variant: android-tests
# MacOS is slow and expensive at running Android emulators
- runner: macos-latest
variant: android-tests
name: Test (${{ matrix.variant }} on ${{ matrix.runner }})
runs-on: ${{ matrix.runner }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: lts/jod
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: "17"
distribution: "temurin"
- name: Setup Android SDK
uses: android-actions/setup-android@v3
with:
packages: tools platform-tools ndk;${{ env.NDK_VERSION }}
- run: rustup target add x86_64-linux-android aarch64-linux-android armv7-linux-androideabi i686-linux-android aarch64-apple-ios-sim
- run: npm ci
- run: npm run bootstrap
# Unit tests
- if: matrix.variant == 'unit-tests'
name: Run tests (Unit)
run: npm test
# Integration tests (iOS)
- if: matrix.variant == 'ios-tests'
run: npm run pod-install
working-directory: apps/test-app
- if: matrix.variant == 'ios-tests'
name: Run tests (iOS)
run: npm run test:ios
working-directory: apps/test-app
# Integration tests (Android)
- name: Clone patched Hermes version
if: matrix.variant == 'android-tests'
shell: bash
run: |
REACT_NATIVE_OVERRIDE_HERMES_DIR=$(npx react-native-node-api vendor-hermes --silent)
echo "REACT_NATIVE_OVERRIDE_HERMES_DIR=$REACT_NATIVE_OVERRIDE_HERMES_DIR" >> $GITHUB_ENV
working-directory: apps/test-app
- name: Setup Android Emulator cache
if: matrix.variant == 'android-tests'
uses: actions/cache@v4
id: avd-cache
with:
path: |
~/.android/avd/*
~/.android/adb*
key: ${{ runner.os }}-avd-29
# See https://github.com/marketplace/actions/android-emulator-runner#running-hardware-accelerated-emulators-on-linux-runners
- name: Enable KVM group perms
if: matrix.runner == 'ubuntu-latest' && matrix.variant == 'android-tests'
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: Build weak-node-api for all architectures
if: matrix.variant == 'android-tests'
run: npm run build-weak-node-api -- --android
working-directory: packages/host
- name: Build ferric-example for all architectures
if: matrix.variant == 'android-tests'
run: npm run build -- --android
working-directory: packages/ferric-example
- name: Run tests (Android)
if: matrix.variant == 'android-tests'
timeout-minutes: 75
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: 29
force-avd-creation: false
emulator-options: -no-snapshot-save -no-metrics -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
disable-animations: true
arch: ${{ runner.os == 'macOS' && 'arm64-v8a' || 'x86' }}
ndk: ${{ env.NDK_VERSION }}
cmake: 3.22.1
working-directory: apps/test-app
script: |
# Setup port forwarding to Mocha Remote
adb reverse tcp:8090 tcp:8090
# Uninstall the app if already in the snapshot (unlikely but could result in a signature mismatch failure)
adb uninstall com.microsoft.reacttestapp || true
# Build, install and run the app
npm run test:android