Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions .github/workflows/reusable-ios-checks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,26 @@ jobs:
-sdk iphonesimulator -destination "id=${{ steps.sim.outputs.udid }}" \
CODE_SIGN_IDENTITY='' CODE_SIGNING_REQUIRED='NO' CODE_SIGN_ENTITLEMENTS=''

- name: Boot the simulator and let it settle
run: |
xcrun simctl boot "${{ steps.sim.outputs.udid }}"
xcrun simctl bootstatus "${{ steps.sim.outputs.udid }}" -b
# A simulator booted for the first time spends minutes compiling shaders and drawing the lock
# screen's posters, and on the runner's three cores that leaves no CPU time to the utility-QoS
# queues the SDK's core runs on: tests that wait for them time out. Tests start once the first-boot
# work has calmed down (the mean idle CPU of the last five samples is 25 % or more), three minutes
# at most; the step never fails on its own.
start=$(date +%s)
last=""
while [ $(( $(date +%s) - start )) -lt 180 ]; do
idle=$(top -l 2 -s 1 -n 0 | awk '/CPU usage/ { v = $7 } END { sub("%", "", v); print int(v) }')
echo "$(date +%T) idle ${idle}%"
last=$(echo "$last $idle" | awk '{ for (i = (NF > 5 ? NF - 4 : 1); i <= NF; i++) printf "%s ", $i }')
mean=$(echo "$last" | awk '{ s = 0; for (i = 1; i <= NF; i++) s += $i; print (NF == 5 ? int(s / 5) : 0) }')
if [ "$mean" -ge 25 ]; then break; fi
done
echo "The simulator settled for $(( $(date +%s) - start )) s"

- name: Run tests
if: ${{ !cancelled() }}
run: |
Expand Down
Loading