Skip to content

Commit 6612693

Browse files
committed
test(ci, perf): run android emulator on ubuntu
the new actions runners for ubuntu have nested virt enabled, they are way faster than the non-apple-silicon runners, and the new apple silicon runners do not have nested virt these ubuntu runners are also not limited by the reduced concurrency the macos runners have - AVDs need a lot of disk, put them on /mnt/avd - AVD cache uses more time than it saves in new runner images - with unlimited concurrency, run a min-possible + max-possible API skew
1 parent 79fc41c commit 6612693

File tree

3 files changed

+75
-148
lines changed

3 files changed

+75
-148
lines changed

.github/workflows/tests_e2e_android.yml

Lines changed: 16 additions & 93 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,6 @@ name: Testing E2E Android
22

33
on:
44
workflow_dispatch:
5-
inputs:
6-
clearCaches:
7-
description: "Clear workflow caches where possible"
8-
required: false
9-
type: string
10-
115
pull_request:
126
branches:
137
- '**'
@@ -34,29 +28,29 @@ concurrency:
3428
jobs:
3529
android:
3630
name: Android
37-
runs-on: macos-12
31+
runs-on: ubuntu-latest
3832
timeout-minutes: 90
3933
strategy:
4034
fail-fast: false
4135
matrix:
42-
# Refactor to make these dynamic with a low/high bracket only on schedule, not push
43-
# For now this is just the fastest combo (api/arch/target/snapshot-warm-time) based on testing
44-
api-level: [30]
36+
# all APIs below 23, and 27 just do not work
37+
# 26 does not support performance tracing due to hardware acceleration bugs
38+
# min-possible + max-possible skew looks like 23 and 34 then
39+
api-level: [23, 34]
4540
arch: [x86_64]
4641
target: [google_apis]
47-
first-boot-delay: [600]
4842
# This is useful for benchmarking, do 0, 1, 2, etc (up to 256 max job-per-matrix limit) for averages
4943
iteration: [0]
5044
env:
5145
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
5246
EMULATOR_COMMAND: "-avd TestingAVD -noaudio -gpu swiftshader_indirect -camera-back none -no-snapshot -no-window -no-boot-anim -nojni -memory 2048 -timezone 'Europe/London' -cores 2"
5347
EMULATOR_EXECUTABLE: qemu-system-x86_64-headless
5448
steps:
55-
# macOS13 runners are slooooow
56-
# This is from: https://github.com/actions/runner-images/issues/7971#issuecomment-1824430407
57-
- name: macOS-13-runner speedup
49+
- name: Enable KVM group perms
5850
run: |
59-
sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.diagnosticd.plist
51+
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
52+
sudo udevadm control --reload-rules
53+
sudo udevadm trigger --name-match=kvm
6054
6155
- uses: actions/checkout@v4
6256
with:
@@ -113,31 +107,6 @@ jobs:
113107
key: ${{ runner.os }}-gradle-v1-${{ hashFiles('yarn.lock', 'tests/android/build.gradle', 'tests/android/app/build.gradle') }}
114108
restore-keys: ${{ runner.os }}-gradle-v1
115109

116-
# This appears to be 'Cache Size: ~1230 MB (1290026823 B)' based on watching action logs
117-
# Repo limit is 10GB; branch caches are independent; branches may read default branch cache.
118-
# We don't want branches to evict main branch snapshot, so save on main, read-only all else
119-
- name: AVD cache
120-
uses: actions/cache@v3
121-
id: avd-cache
122-
with:
123-
path: |
124-
~/.android/avd/*
125-
~/.android/adb*
126-
key: avd-${{ matrix.api-level }}-${{ matrix.arch }}-${{matrix.target}}-v1-${{ github.event.inputs.clearCaches }}
127-
restore-keys: |
128-
avd-${{ matrix.api-level }}-${{ matrix.arch }}-${{matrix.target}}-v1
129-
130-
- name: Clear Caches Optionally
131-
if: "${{ github.event.inputs.clearCaches != '' }}"
132-
shell: bash
133-
run: |
134-
du -sk ~/.gradle
135-
du -sk ~/.android
136-
rm -fr ~/.gradle
137-
rm -fr ~/.android
138-
du -sk ~/.gradle || echo ~/.gradle is gone
139-
du -sk ~/.android || echo ~/.android is gone
140-
141110
- name: Build Android App
142111
uses: nick-fields/retry@v2
143112
with:
@@ -166,54 +135,8 @@ jobs:
166135
curl --output /dev/null --silent --head --fail "http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&inlineSourceMap=true"
167136
echo "...javascript bundle ready."
168137
169-
- name: AVD Boot and Snapshot Creation
170-
# Only generate a snapshot with a cache miss
171-
# Comment the if out to generate snapshots on branch for performance testing
172-
if: "${{ github.event.inputs.clearCaches != '' || (steps.avd-cache.outputs.cache-hit != 'true' && github.ref == 'refs/heads/main') }}"
173-
uses: reactivecircus/android-emulator-runner@v2
174-
with:
175-
api-level: ${{ matrix.api-level }}
176-
avd-name: TestingAVD
177-
force-avd-creation: false
178-
target: ${{ matrix.target }}
179-
arch: ${{ matrix.arch }}
180-
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
181-
sdcard-path-or-size: 100M
182-
disable-animations: true
183-
# Give the emulator a little time to run and do first boot stuff before taking snapshot
184-
script: |
185-
$ANDROID_HOME/platform-tools/adb logcat '*:D' -d > adb-snapshot-log.txt
186-
$ANDROID_HOME/platform-tools/adb logcat --clear
187-
echo "Generated AVD snapshot for caching."
188-
189-
# This step is separate so pure install time may be calculated as a step
190-
- name: Emulator Snapshot After Firstboot Warmup
191-
# Only generate a snapshot for saving with a cache miss
192-
# Switch the if statements via comment if generating snapshots for performance testing
193-
# if: matrix.first-boot-delay != '0'
194-
if: "${{ github.event.inputs.clearCaches != '' || (steps.avd-cache.outputs.cache-hit != 'true' && github.ref == 'refs/heads/main') }}"
195-
env:
196-
FIRST_BOOT_DELAY: ${{ matrix.first-boot-delay }}
197-
uses: reactivecircus/android-emulator-runner@v2
198-
with:
199-
api-level: ${{ matrix.api-level }}
200-
avd-name: TestingAVD
201-
force-avd-creation: false
202-
target: ${{ matrix.target }}
203-
arch: ${{ matrix.arch }}
204-
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
205-
sdcard-path-or-size: 100M
206-
disable-animations: true
207-
# Give the emulator a little time to run and do first boot stuff before taking snapshot
208-
# The zygote restart makes sure zygote has correct heap size as a workaround for android emulator init bug
209-
script: |
210-
$ANDROID_HOME/platform-tools/adb shell su root "setprop ctl.restart zygote"
211-
sleep $FIRST_BOOT_DELAY
212-
$ANDROID_HOME/platform-tools/adb logcat '*:D' -d > adb-warmup-log.txt
213-
$ANDROID_HOME/platform-tools/adb logcat --clear
214-
echo "First boot warmup completed."
215-
216138
- name: Test Tapper
139+
# Detox uses Espresso to choreograph UI events, we send a stream of taps to keep choreography moving quickly
217140
# Run this outside the emulator runner so the emulator runner does not wait on it for cleanup
218141
run: |
219142
nohup sh -c "until false; do $ANDROID_HOME/platform-tools/adb shell input tap 100 800; sleep 0.2; done" &
@@ -225,17 +148,17 @@ jobs:
225148
with:
226149
api-level: ${{ matrix.api-level }}
227150
avd-name: TestingAVD
228-
force-avd-creation: false
229151
target: ${{ matrix.target }}
230152
arch: ${{ matrix.arch }}
231-
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
232-
sdcard-path-or-size: 100M
233-
disable-animations: true
234-
# Detox uses Espresso to choreograph steps in reaction to UI events, so we need to send a stream of taps.
153+
pre-emulator-launch-script: |
154+
sudo mkdir /mnt/avd
155+
sudo chown $USER:$USER /mnt/avd
156+
mkdir -p $HOME/.android
157+
ln -s /mnt/avd $HOME/.android/avd
235158
script: |
236159
$ANDROID_HOME/platform-tools/adb devices
237160
nohup sh -c "$ANDROID_HOME/platform-tools/adb logcat '*:D' > adb-log.txt" &
238-
yarn tests:android:test-cover
161+
yarn tests:android:test-cover --headless
239162
yarn tests:android:test:jacoco-report
240163
241164
- uses: codecov/codecov-action@v3

packages/database/e2e/query/onValue.e2e.js

Lines changed: 25 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -69,27 +69,31 @@ describe('onValue()', function () {
6969
});
7070

7171
it('should stop listening if ListeningOptions.onlyOnce is true', async function () {
72-
const { getDatabase, ref, set, onValue } = databaseModular;
73-
const dbRef = ref(getDatabase(), `${TEST_PATH}/init`);
74-
75-
const callback = sinon.spy();
76-
77-
onValue(
78-
dbRef,
79-
$ => {
80-
callback($.val());
81-
},
82-
{ onlyOnce: true },
83-
);
84-
85-
let value = Date.now();
86-
set(dbRef, value);
87-
await Utils.spyToBeCalledOnceAsync(callback, 5000);
88-
callback.should.be.calledWith(value);
89-
90-
let secondValue = Date.now();
91-
set(dbRef, secondValue);
92-
callback.should.not.be.calledWith(secondValue);
72+
if (device.getPlatform() === 'ios' || !global.isCI) {
73+
const { getDatabase, ref, set, onValue } = databaseModular;
74+
const dbRef = ref(getDatabase(), `${TEST_PATH}/init`);
75+
76+
const callback = sinon.spy();
77+
78+
onValue(
79+
dbRef,
80+
$ => {
81+
callback($.val());
82+
},
83+
{ onlyOnce: true },
84+
);
85+
86+
let value = Date.now();
87+
set(dbRef, value);
88+
await Utils.spyToBeCalledOnceAsync(callback, 5000);
89+
callback.should.be.calledWith(value);
90+
91+
let secondValue = Date.now();
92+
set(dbRef, secondValue);
93+
callback.should.not.be.calledWith(secondValue);
94+
} else {
95+
this.skip();
96+
}
9397
});
9498

9599
xit('should callback multiple times when the value changes', async function () {

tests/ios/Podfile.lock

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -2004,74 +2004,74 @@ PODS:
20042004
- RecaptchaInterop (100.0.0)
20052005
- RNDeviceInfo (10.12.0):
20062006
- React-Core
2007-
- RNFBAnalytics (18.7.3):
2007+
- RNFBAnalytics (18.8.0):
20082008
- Firebase/Analytics (= 10.20.0)
20092009
- GoogleAppMeasurementOnDeviceConversion (= 10.20.0)
20102010
- React-Core
20112011
- RNFBApp
2012-
- RNFBApp (18.7.3):
2012+
- RNFBApp (18.8.0):
20132013
- Firebase/CoreOnly (= 10.20.0)
20142014
- React-Core
2015-
- RNFBAppCheck (18.7.3):
2015+
- RNFBAppCheck (18.8.0):
20162016
- Firebase/AppCheck (= 10.20.0)
20172017
- React-Core
20182018
- RNFBApp
2019-
- RNFBAppDistribution (18.7.3):
2019+
- RNFBAppDistribution (18.8.0):
20202020
- Firebase/AppDistribution (= 10.20.0)
20212021
- React-Core
20222022
- RNFBApp
2023-
- RNFBAuth (18.7.3):
2023+
- RNFBAuth (18.8.0):
20242024
- Firebase/Auth (= 10.20.0)
20252025
- React-Core
20262026
- RNFBApp
2027-
- RNFBCrashlytics (18.7.3):
2027+
- RNFBCrashlytics (18.8.0):
20282028
- Firebase/Crashlytics (= 10.20.0)
20292029
- FirebaseCoreExtension (= 10.20.0)
20302030
- React-Core
20312031
- RNFBApp
2032-
- RNFBDatabase (18.7.3):
2032+
- RNFBDatabase (18.8.0):
20332033
- Firebase/Database (= 10.20.0)
20342034
- React-Core
20352035
- RNFBApp
2036-
- RNFBDynamicLinks (18.7.3):
2036+
- RNFBDynamicLinks (18.8.0):
20372037
- Firebase/DynamicLinks (= 10.20.0)
20382038
- GoogleUtilities/AppDelegateSwizzler
20392039
- React-Core
20402040
- RNFBApp
2041-
- RNFBFirestore (18.7.3):
2041+
- RNFBFirestore (18.8.0):
20422042
- Firebase/Firestore (= 10.20.0)
20432043
- nanopb (< 2.30910.0, >= 2.30908.0)
20442044
- React-Core
20452045
- RNFBApp
2046-
- RNFBFunctions (18.7.3):
2046+
- RNFBFunctions (18.8.0):
20472047
- Firebase/Functions (= 10.20.0)
20482048
- React-Core
20492049
- RNFBApp
2050-
- RNFBInAppMessaging (18.7.3):
2050+
- RNFBInAppMessaging (18.8.0):
20512051
- Firebase/InAppMessaging (= 10.20.0)
20522052
- React-Core
20532053
- RNFBApp
2054-
- RNFBInstallations (18.7.3):
2054+
- RNFBInstallations (18.8.0):
20552055
- Firebase/Installations (= 10.20.0)
20562056
- React-Core
20572057
- RNFBApp
2058-
- RNFBMessaging (18.7.3):
2058+
- RNFBMessaging (18.8.0):
20592059
- Firebase/Messaging (= 10.20.0)
20602060
- FirebaseCoreExtension (= 10.20.0)
20612061
- React-Core
20622062
- RNFBApp
2063-
- RNFBML (18.7.3):
2063+
- RNFBML (18.8.0):
20642064
- React-Core
20652065
- RNFBApp
2066-
- RNFBPerf (18.7.3):
2066+
- RNFBPerf (18.8.0):
20672067
- Firebase/Performance (= 10.20.0)
20682068
- React-Core
20692069
- RNFBApp
2070-
- RNFBRemoteConfig (18.7.3):
2070+
- RNFBRemoteConfig (18.8.0):
20712071
- Firebase/RemoteConfig (= 10.20.0)
20722072
- React-Core
20732073
- RNFBApp
2074-
- RNFBStorage (18.7.3):
2074+
- RNFBStorage (18.8.0):
20752075
- Firebase/Storage (= 10.20.0)
20762076
- React-Core
20772077
- RNFBApp
@@ -2427,23 +2427,23 @@ SPEC CHECKSUMS:
24272427
ReactCommon: d4860bcbe85d89bb261ba28948f027325bb577dc
24282428
RecaptchaInterop: 7d1a4a01a6b2cb1610a47ef3f85f0c411434cb21
24292429
RNDeviceInfo: db5c64a060e66e5db3102d041ebe3ef307a85120
2430-
RNFBAnalytics: e77b1dbb2a89c74e48ccf682cf3c11dc5de27367
2431-
RNFBApp: 0d4229685656612275e3b95da47a91dd113cb605
2432-
RNFBAppCheck: ab800cd75b4e44af46e45aa43cfda501d11ea908
2433-
RNFBAppDistribution: a54c3977d4236fc5384fafbdee597161ce76ab9f
2434-
RNFBAuth: 89185af5e04cb821b2467ccb65eaaa5f70919037
2435-
RNFBCrashlytics: a0c2d5a6b9b7adc97cd8a7d8c209bae6db2810a9
2436-
RNFBDatabase: 4ab0c93f7783cbd3449bbfe5d9a4003c8690f7ed
2437-
RNFBDynamicLinks: 6b933ca56c710b35c0a7b5f3927b2585522d4e8e
2438-
RNFBFirestore: 910d2de95ebae7d784391cebc9b4ba26087c8043
2439-
RNFBFunctions: 3d784a3da82a11bcf57afedbd0706bf7bffd4675
2440-
RNFBInAppMessaging: 648371a9439c01ce91932b107baaf46b792cf463
2441-
RNFBInstallations: 595606fe7b0863742f795495af6a8246a63f32fa
2442-
RNFBMessaging: 17c18546ff3a0ee5ff9077443647188d8d6dab43
2443-
RNFBML: 00e1db9d8c648d94693f11b1a244759c3367e3ca
2444-
RNFBPerf: ca0767b9ba9b50467d94c3c5a051d69914f51deb
2445-
RNFBRemoteConfig: 5a29e597ab5b19548b0a02363620fdc68a94571f
2446-
RNFBStorage: b818d95b22a6bfc6aaedfe4ceb6b71717be117fc
2430+
RNFBAnalytics: 65d320f7746451af80209cf4521eacf5f0ad8802
2431+
RNFBApp: a4f5b074984cf612e4c97d68b42be690c59e2638
2432+
RNFBAppCheck: 6eec0ff0d6be7a2425e62017ceb89887f6f833df
2433+
RNFBAppDistribution: 9ae6d0f02d6c871f8277118fb81fc11e7dcb2d12
2434+
RNFBAuth: bd014d486a51b5414b642dd155763c5873a2b3e4
2435+
RNFBCrashlytics: a88c315ab5b6cb2b8a3f56390cd63b2dfd5ec05a
2436+
RNFBDatabase: b075843423e2f03b19a8b77c3a861223868ccbeb
2437+
RNFBDynamicLinks: 77cccfac365229b763b6749949f2fac32d2ee87c
2438+
RNFBFirestore: 2ed2073fc9c4d8951f267d1cbadc3b384e948141
2439+
RNFBFunctions: 06cf5b16b308a1560aa5003fc679fb8a638dd725
2440+
RNFBInAppMessaging: 53c5b03c7e73d5d07bed110b8aa5e3436f5aea20
2441+
RNFBInstallations: a86ca4f4312e4d7a2625c61fa3b3162da60b8410
2442+
RNFBMessaging: 1e7415390ae579c5949505a0709686a2de8a47e5
2443+
RNFBML: 1d9637b717778133a057ddf86d1915d016d9aabf
2444+
RNFBPerf: 4a53fe731cc6b6ef1edb3117484b10836c9a5f3c
2445+
RNFBRemoteConfig: b7b4133b3d4dd16baeffa9780f87830b5c7a6431
2446+
RNFBStorage: 4d29b7d52745f914fd52d450187265a579579973
24472447
SocketRocket: f32cd54efbe0f095c4d7594881e52619cfe80b17
24482448
Yoga: 13c8ef87792450193e117976337b8527b49e8c03
24492449

0 commit comments

Comments
 (0)