Skip to content

Commit 24c96f8

Browse files
committed
test(ci): mitigate e2e flakes with targeted baseload shrink
1 parent f8a11cb commit 24c96f8

8 files changed

Lines changed: 146 additions & 95 deletions

File tree

.github/workflows/scripts/flake-summary.sh

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,7 @@ DETOX_LOG="${RNFB_DETOX_LOG:-}"
2525
}
2626

2727
summarize "detox-log" "${DETOX_LOG}"
28-
summarize "simulator-log" "simulator.log"
29-
summarize "testing-log" "testing.log"
30-
summarize "springboard-log" "springboard-invertase.log"
28+
summarize "sim-app-log" "sim-app.log"
3129
summarize "resource-monitor" "resource-monitor.log"
3230
summarize "resource-monitor-android" "resource-monitor-android.log"
3331
summarize "metro-log" "metro.log"
@@ -43,7 +41,7 @@ DETOX_LOG="${RNFB_DETOX_LOG:-}"
4341
echo ""
4442

4543
echo "=== log stream death markers ==="
46-
for f in simulator.log testing.log springboard-invertase.log; do
44+
for f in sim-app.log; do
4745
if [[ -f "$f" ]]; then
4846
rg -n 'Child process terminated|log stream restarted' "$f" 2>/dev/null | tail -20 || true
4947
fi
Lines changed: 18 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
#!/bin/bash
2-
# Start or restart iOS simulator log streams and resource monitor (sourced by boot-simulator.sh).
2+
# Start or restart iOS simulator focused log stream and resource monitor (sourced by boot-simulator.sh).
33
set -uo pipefail
44

55
restart_simulator_logging() {
66
local with_stdout="${RNFB_SIM_LOG_STDOUT:-0}"
7+
local record_screens="${RNFB_RECORD_SCREENS:-0}"
78
local log_dir="${RNFB_SIM_LOG_DIR:-.}"
8-
local simulator_log="${log_dir}/simulator.log"
9-
local testing_log="${log_dir}/testing.log"
10-
local springboard_log="${log_dir}/springboard-invertase.log"
9+
local sim_app_log="${log_dir}/sim-app.log"
1110
local resource_log="${log_dir}/resource-monitor.log"
1211
local repo_root="${RNFB_REPO_ROOT:-$(cd "$(dirname "${BASH_SOURCE[0]}")/../../.." && pwd)}"
12+
local log_predicate='process == "testing" OR (process == "SpringBoard" AND eventMessage CONTAINS "invertase")'
1313

1414
if ! xcrun simctl list devices booted 2>/dev/null | grep -q Booted; then
1515
echo "[boot-status] phase=log_streams skipped=no_booted_simulator"
1616
return 1
1717
fi
1818

19-
echo "[boot-status] phase=log_streams_restart ts=$(date -u +%Y-%m-%dT%H:%M:%SZ) stdout=${with_stdout} dir=${log_dir}"
19+
echo "[boot-status] phase=log_streams_restart ts=$(date -u +%Y-%m-%dT%H:%M:%SZ) stdout=${with_stdout} record_screens=${record_screens} dir=${log_dir}"
2020

2121
pkill -f 'simctl spawn booted log stream' 2>/dev/null || true
2222
pkill -f 'simctl io booted recordVideo' 2>/dev/null || true
@@ -25,33 +25,26 @@ restart_simulator_logging() {
2525

2626
{
2727
echo ""
28-
echo "=== log stream restarted $(date -u +%Y-%m-%dT%H:%M:%SZ) ==="
29-
} >>"$simulator_log" 2>/dev/null || : >"$simulator_log"
30-
{
31-
echo ""
32-
echo "=== log stream restarted $(date -u +%Y-%m-%dT%H:%M:%SZ) ==="
33-
} >>"$testing_log" 2>/dev/null || : >"$testing_log"
34-
{
35-
echo ""
36-
echo "=== log stream restarted $(date -u +%Y-%m-%dT%H:%M:%SZ) ==="
37-
} >>"$springboard_log" 2>/dev/null || : >"$springboard_log"
28+
echo "=== log stream restarted $(date -u +%Y-%m-%dT%H:%M:%SZ) predicate=${log_predicate} ==="
29+
} >>"$sim_app_log" 2>/dev/null || : >"$sim_app_log"
30+
31+
if [[ "$record_screens" == "1" ]]; then
32+
if [[ "$with_stdout" == "1" ]]; then
33+
xcrun simctl io booted recordVideo --codec=h264 -f "${log_dir}/simulator.mp4" 2>&1 &
34+
else
35+
nohup sh -c "xcrun simctl io booted recordVideo --codec=h264 -f '${log_dir}/simulator.mp4' 2>&1 &" >/dev/null 2>&1 &
36+
fi
37+
fi
3838

3939
if [[ "$with_stdout" == "1" ]]; then
40-
xcrun simctl io booted recordVideo --codec=h264 -f "${log_dir}/simulator.mp4" 2>&1 &
41-
xcrun simctl spawn booted log stream --level debug --style compact 2>&1 | tee -a "$simulator_log" &
42-
xcrun simctl spawn booted log stream --level debug --style compact \
43-
--predicate 'process == "testing"' 2>&1 | tee -a "$testing_log" &
4440
xcrun simctl spawn booted log stream --level debug --style compact \
45-
--predicate 'process == "SpringBoard" AND eventMessage CONTAINS "invertase"' 2>&1 | tee -a "$springboard_log" &
41+
--predicate "$log_predicate" 2>&1 | tee -a "$sim_app_log" &
4642
else
47-
nohup sh -c "xcrun simctl io booted recordVideo --codec=h264 -f '${log_dir}/simulator.mp4' 2>&1 &" >/dev/null 2>&1 &
48-
nohup sh -c "xcrun simctl spawn booted log stream --level debug --style compact >>'${simulator_log}' 2>&1 &" >/dev/null 2>&1 &
49-
nohup sh -c "xcrun simctl spawn booted log stream --level debug --style compact --predicate 'process == \"testing\"' >>'${testing_log}' 2>&1 &" >/dev/null 2>&1 &
50-
nohup sh -c "xcrun simctl spawn booted log stream --level debug --style compact --predicate 'process == \"SpringBoard\" AND eventMessage CONTAINS \"invertase\"' >>'${springboard_log}' 2>&1 &" >/dev/null 2>&1 &
43+
nohup sh -c "xcrun simctl spawn booted log stream --level debug --style compact --predicate '${log_predicate}' >>'${sim_app_log}' 2>&1 &" >/dev/null 2>&1 &
5144
fi
5245

5346
chmod +x "${repo_root}/.github/workflows/scripts/resource-monitor.sh"
5447
RNFB_RESOURCE_MONITOR_LOG="$resource_log" nohup "${repo_root}/.github/workflows/scripts/resource-monitor.sh" >/dev/null 2>&1 &
5548

56-
echo "[boot-status] phase=log_streams_started video=${log_dir}/simulator.mp4 monitor=${resource_log}"
49+
echo "[boot-status] phase=log_streams_started sim_app_log=${sim_app_log} video=$([[ "$record_screens" == "1" ]] && echo "${log_dir}/simulator.mp4" || echo disabled) monitor=${resource_log}"
5750
}

.github/workflows/scripts/wait-for-load-settle.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ set -euo pipefail
44

55
MAX_WAIT_SEC="${RNFB_LOAD_SETTLE_MAX_WAIT_SEC:-1200}"
66
POLL_SEC="${RNFB_LOAD_SETTLE_POLL_SEC:-5}"
7-
MAX_LOAD="${RNFB_LOAD_SETTLE_MAX_LOAD:-10}"
7+
MAX_LOAD="${RNFB_LOAD_SETTLE_MAX_LOAD:-20}"
88

99
parse_load1() {
1010
# uptime: ... load averages: 1.23 4.56 7.89

.github/workflows/tests_e2e_ios.yml

Lines changed: 26 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,23 @@
11
name: Testing E2E iOS
22

33
on:
4+
workflow_call:
5+
inputs:
6+
record_screens:
7+
description: 'Record host screencapture and simulator video artifacts'
8+
type: boolean
9+
default: false
410
workflow_dispatch:
511
inputs:
612
iterations:
713
description: 'Number of iterations to run. Default 1. Max 122.'
814
required: true
915
default: 1
1016
type: number
17+
record_screens:
18+
description: 'Record host screencapture and simulator video artifacts'
19+
type: boolean
20+
default: false
1121
pull_request:
1222
branches:
1323
- '**'
@@ -97,6 +107,7 @@ jobs:
97107
timeout-minutes: 107
98108
env:
99109
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
110+
RNFB_RECORD_SCREENS: ${{ (github.event_name == 'workflow_dispatch' || github.event_name == 'workflow_call') && inputs.record_screens && '1' || '0' }}
100111
CCACHE_SLOPPINESS: clang_index_store,file_stat_matches,include_file_ctime,include_file_mtime,ivfsoverlay,pch_defines,modules,system_headers,time_macros
101112
CCACHE_FILECLONE: true
102113
CCACHE_DEPEND: true
@@ -112,14 +123,15 @@ jobs:
112123
# https://github.com/guidepup/setup-action/releases
113124
uses: guidepup/setup-action@5ab89fbb6641406f6f6c91057225f3fb397c2eea # v0.20.0
114125
continue-on-error: true
126+
if: env.RNFB_RECORD_SCREENS == '1'
115127
with:
116128
record: true
117129

118130
- name: Upload Screen Recording Environment Setup
119131
# https://github.com/actions/upload-artifact/releases
120132
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
121133
continue-on-error: true
122-
if: always()
134+
if: always() && env.RNFB_RECORD_SCREENS == '1'
123135
with:
124136
name: screenrecording-setup-${{ matrix.buildmode }}-${{ matrix.iteration }}.mov
125137
path: ./recordings/
@@ -327,11 +339,11 @@ jobs:
327339
curl --output /dev/null --silent --head --fail "http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false&inlineSourceMap=true"
328340
echo "...javascript bundle ready"
329341
330-
- name: Start Screen and System Logging
342+
- name: Start host screen recording
343+
if: env.RNFB_RECORD_SCREENS == '1'
331344
continue-on-error: true
332345
run: |
333346
nohup sh -c "sleep 314159265 | screencapture -v -C -k -T0 -g screenrecording.mov > screenrecording.log 2>&1 &"
334-
nohup sh -c "log stream --backtrace --color none --style syslog > syslog.log 2>&1 &"
335347
336348
- name: Pre-Boot Simulator
337349
# Separate Simulator boot from Detox run. boot-simulator.sh polls bootstatus and logs
@@ -344,12 +356,12 @@ jobs:
344356
max_attempts: 3
345357
command: RNFB_START_SIM_LOGS=0 ./.github/workflows/scripts/boot-simulator.sh
346358

347-
- name: Start Simulator Recordings and Log
348-
# Log streams are owned by boot-simulator.sh (logs-only mode after pre-boot).
359+
- name: Start Simulator App Log
360+
# One filtered sim log stream (testing + SpringBoard/invertase); optional sim video when record_screens.
349361
continue-on-error: true
350362
run: |
351363
chmod +x ./.github/workflows/scripts/boot-simulator.sh
352-
RNFB_SIM_BOOT_MODE=logs ./.github/workflows/scripts/boot-simulator.sh
364+
RNFB_RECORD_SCREENS="${RNFB_RECORD_SCREENS}" RNFB_SIM_BOOT_MODE=logs ./.github/workflows/scripts/boot-simulator.sh
353365
354366
- name: Wait for host load to settle
355367
continue-on-error: true
@@ -388,43 +400,27 @@ jobs:
388400
continue-on-error: true
389401
run: |
390402
killall -int simctl
391-
killall -int screencapture
392-
killall -int log
403+
if [[ "${RNFB_RECORD_SCREENS}" == "1" ]]; then
404+
killall -int screencapture
405+
fi
393406
pkill -f resource-monitor.sh || true
394407
395408
- name: Upload App Video
396409
# https://github.com/actions/upload-artifact/releases
397410
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
398411
continue-on-error: true
399-
if: always()
412+
if: always() && env.RNFB_RECORD_SCREENS == '1'
400413
with:
401414
name: simulator-${{ matrix.buildmode }}-${{ matrix.iteration }}_video
402415
path: simulator.mp4
403416

404-
- name: Upload Simulator Log
405-
# https://github.com/actions/upload-artifact/releases
406-
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
407-
continue-on-error: true
408-
if: always()
409-
with:
410-
name: simulator-${{ matrix.buildmode }}-${{ matrix.iteration }}_log
411-
path: simulator.log
412-
413-
- name: Upload testing process log
414-
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
415-
continue-on-error: true
416-
if: always()
417-
with:
418-
name: testing-${{ matrix.buildmode }}-${{ matrix.iteration }}_log
419-
path: testing.log
420-
421-
- name: Upload SpringBoard invertase log
417+
- name: Upload Simulator App Log
422418
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
423419
continue-on-error: true
424420
if: always()
425421
with:
426-
name: springboard-${{ matrix.buildmode }}-${{ matrix.iteration }}_log
427-
path: springboard-invertase.log
422+
name: sim-app-${{ matrix.buildmode }}-${{ matrix.iteration }}_log
423+
path: sim-app.log
428424

429425
- name: Upload resource monitor log
430426
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
@@ -463,7 +459,7 @@ jobs:
463459
# https://github.com/actions/upload-artifact/releases
464460
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
465461
continue-on-error: true
466-
if: always()
462+
if: always() && env.RNFB_RECORD_SCREENS == '1'
467463
with:
468464
name: screenrecording-${{ matrix.buildmode }}-${{ matrix.iteration }}
469465
path: screenrecording.*

okf-bundle/ci-workflows/index.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ GitHub Actions job shape, platform reliability, and artifact triage.
44

55
## Platforms
66

7-
* [iOS](ios.md) — simulator boot, logging, troubleshooting
7+
* [iOS](ios.md) — simulator boot, logging, troubleshooting, [CI baseload policy](ios.md#ci-baseload-policy-instrumentation)
88
* [Android](android.md) — idling, adb teardown, native coverage
99
* [Other](other.md) — macOS Jet/Metro, Windows/shared
1010

@@ -13,7 +13,7 @@ GitHub Actions job shape, platform reliability, and artifact triage.
1313
* [Jet host orchestration](../testing/running-e2e.md#jet-host-orchestration-ports-and-launch-gate) — ports 8090/8091, defer-run launch gate (canonical)
1414
* [Detox patches](detox-patches.md) — inventory, `ECOMPROMISED`, patch workflow
1515
* [Cloud API quota triage](../testing/firebase-testing-project.md#ci-triage-cloud-api-quota-pressure) — live FIS/RC pressure (all platforms)
16-
* [iOS diagnostics](ios.md#operational-notes)`resource-monitor.sh`, `flake-summary.sh`
16+
* [iOS diagnostics](ios.md#operational-notes)`resource-monitor.sh`, `flake-summary.sh`, [CI baseload / load settle](ios.md#ci-baseload-policy-instrumentation)
1717

1818
## Related
1919

0 commit comments

Comments
 (0)