@@ -57,19 +57,37 @@ jobs:
5757 - name : Start the clock
5858 run : echo "$(date +%s) start" > "$RUNNER_TEMP/timing"
5959
60- - name : Generate the Xcode project and boot a simulator
60+ - name : Boot a simulator in the background
6161 run : |
62- echo "$(date +%s) project-and-simulator" >> "$RUNNER_TEMP/timing"
63- HOMEBREW_NO_AUTO_UPDATE=1 HOMEBREW_NO_INSTALL_CLEANUP=1 brew install xcodegen
64- (cd ios-shell && xcodegen generate)
6562 picked="$(python3 ios-shell/ci/pick_simulator.py)"
6663 udid="$(printf '%s' "$picked" | cut -f1)"
6764 echo "SIM_UDID=$udid" >> "$GITHUB_ENV"
6865 defaults write com.apple.iphonesimulator ConnectHardwareKeyboard -bool false
69- xcrun simctl boot "$udid" || true
70- xcrun simctl bootstatus "$udid" -b
71- xcrun simctl spawn "$udid" defaults write com.apple.Preferences DidShowContinuousPathIntroduction -bool true || true
72- xcrun simctl spawn "$udid" defaults write com.apple.keyboard.preferences DidShowContinuousPathIntroduction -bool true || true
66+ # Booting takes minutes on a fresh runner: it runs while the rest of the job does.
67+ nohup bash -c 'xcrun simctl boot "$1" || true; xcrun simctl bootstatus "$1" -b \
68+ && xcrun simctl spawn "$1" defaults write com.apple.Preferences DidShowContinuousPathIntroduction -bool true; \
69+ xcrun simctl spawn "$1" defaults write com.apple.keyboard.preferences DidShowContinuousPathIntroduction -bool true; \
70+ touch "$2"' boot "$udid" "$RUNNER_TEMP/simulator.ready" > "$RUNNER_TEMP/boot.log" 2>&1 &
71+
72+ - uses : actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
73+ with :
74+ path : ~/xcodegen-dist
75+ key : ios-shell-video-xcodegen-v1
76+
77+ - name : Generate the Xcode project
78+ run : |
79+ echo "$(date +%s) project" >> "$RUNNER_TEMP/timing"
80+ if [ ! -x ~/xcodegen-dist/xcodegen/bin/xcodegen ]; then
81+ mkdir -p ~/xcodegen-dist
82+ curl -fsSL -o "$RUNNER_TEMP/xcodegen.zip" https://github.com/yonaskolb/XcodeGen/releases/latest/download/xcodegen.zip \
83+ && unzip -q -o "$RUNNER_TEMP/xcodegen.zip" -d ~/xcodegen-dist || true
84+ fi
85+ if [ -x ~/xcodegen-dist/xcodegen/bin/xcodegen ]; then
86+ (cd ios-shell && ~/xcodegen-dist/xcodegen/bin/xcodegen generate)
87+ else
88+ HOMEBREW_NO_AUTO_UPDATE=1 HOMEBREW_NO_INSTALL_CLEANUP=1 brew install xcodegen
89+ (cd ios-shell && xcodegen generate)
90+ fi
7391
7492 - uses : oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0
7593 with :
@@ -130,6 +148,8 @@ jobs:
130148 env :
131149 TEST_RUNNER_OPENBOT_SHELL_VIDEO_MODE : " 1"
132150 run : |
151+ for _ in $(seq 1 300); do [ -f "$RUNNER_TEMP/simulator.ready" ] && break; sleep 1; done
152+ [ -f "$RUNNER_TEMP/simulator.ready" ] || { cat "$RUNNER_TEMP/boot.log"; exit 1; }
133153 echo "$(date +%s) record" >> "$RUNNER_TEMP/timing"
134154 started="$(python3 -c 'import time; print(time.time())')"
135155 echo "STARTED=$started" >> "$GITHUB_ENV"
@@ -190,19 +210,37 @@ jobs:
190210 - name : Start the clock
191211 run : echo "$(date +%s) start" > "$RUNNER_TEMP/timing"
192212
193- - name : Generate the Xcode project and boot a simulator
213+ - name : Boot a simulator in the background
194214 run : |
195- echo "$(date +%s) project-and-simulator" >> "$RUNNER_TEMP/timing"
196- HOMEBREW_NO_AUTO_UPDATE=1 HOMEBREW_NO_INSTALL_CLEANUP=1 brew install xcodegen
197- (cd ios-shell && xcodegen generate)
198215 picked="$(python3 ios-shell/ci/pick_simulator.py)"
199216 udid="$(printf '%s' "$picked" | cut -f1)"
200217 echo "SIM_UDID=$udid" >> "$GITHUB_ENV"
201218 defaults write com.apple.iphonesimulator ConnectHardwareKeyboard -bool false
202- xcrun simctl boot "$udid" || true
203- xcrun simctl bootstatus "$udid" -b
204- xcrun simctl spawn "$udid" defaults write com.apple.Preferences DidShowContinuousPathIntroduction -bool true || true
205- xcrun simctl spawn "$udid" defaults write com.apple.keyboard.preferences DidShowContinuousPathIntroduction -bool true || true
219+ # Booting takes minutes on a fresh runner: it runs while the rest of the job does.
220+ nohup bash -c 'xcrun simctl boot "$1" || true; xcrun simctl bootstatus "$1" -b \
221+ && xcrun simctl spawn "$1" defaults write com.apple.Preferences DidShowContinuousPathIntroduction -bool true; \
222+ xcrun simctl spawn "$1" defaults write com.apple.keyboard.preferences DidShowContinuousPathIntroduction -bool true; \
223+ touch "$2"' boot "$udid" "$RUNNER_TEMP/simulator.ready" > "$RUNNER_TEMP/boot.log" 2>&1 &
224+
225+ - uses : actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
226+ with :
227+ path : ~/xcodegen-dist
228+ key : ios-shell-video-xcodegen-v1
229+
230+ - name : Generate the Xcode project
231+ run : |
232+ echo "$(date +%s) project" >> "$RUNNER_TEMP/timing"
233+ if [ ! -x ~/xcodegen-dist/xcodegen/bin/xcodegen ]; then
234+ mkdir -p ~/xcodegen-dist
235+ curl -fsSL -o "$RUNNER_TEMP/xcodegen.zip" https://github.com/yonaskolb/XcodeGen/releases/latest/download/xcodegen.zip \
236+ && unzip -q -o "$RUNNER_TEMP/xcodegen.zip" -d ~/xcodegen-dist || true
237+ fi
238+ if [ -x ~/xcodegen-dist/xcodegen/bin/xcodegen ]; then
239+ (cd ios-shell && ~/xcodegen-dist/xcodegen/bin/xcodegen generate)
240+ else
241+ HOMEBREW_NO_AUTO_UPDATE=1 HOMEBREW_NO_INSTALL_CLEANUP=1 brew install xcodegen
242+ (cd ios-shell && xcodegen generate)
243+ fi
206244
207245 - name : Decide the build
208246 env :
@@ -238,6 +276,8 @@ jobs:
238276 TEST_RUNNER_OPENBOT_SHELL_GOOGLE_TOTP_SECRET : ${{ secrets.OPENBOT_SHELL_GOOGLE_TOTP_SECRET }}
239277 REAL_SIGN_OUT : ${{ inputs.real_sign_out }}
240278 run : |
279+ for _ in $(seq 1 300); do [ -f "$RUNNER_TEMP/simulator.ready" ] && break; sleep 1; done
280+ [ -f "$RUNNER_TEMP/simulator.ready" ] || { cat "$RUNNER_TEMP/boot.log"; exit 1; }
241281 echo "$(date +%s) record" >> "$RUNNER_TEMP/timing"
242282 if [ "$REAL_SIGN_OUT" = "true" ]; then export TEST_RUNNER_OPENBOT_SHELL_REAL_SIGN_OUT=1; fi
243283 if [ "$CONFIGURATION" = "Release" ]; then
0 commit comments