-
Notifications
You must be signed in to change notification settings - Fork 1
371 lines (331 loc) · 13.9 KB
/
ci-full.yml
File metadata and controls
371 lines (331 loc) · 13.9 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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
name: CI (Full)
# Unit + Integration suite, run against a live mock z2m bridge. Triggers:
# 1. Nightly at 03:00 UTC (catches environmental / flaky issues)
# 2. On-demand from the Actions tab
# 3. Labeling a PR with `run-ui-tests` (kept for parity with the existing
# flow even though the UI job itself was removed — see below)
#
# UI tests previously ran here too but were removed while the device list /
# settings / logs UIs are in active redesign — the suite was reliably red on
# tests-vs-UI mismatches that aren't real regressions, training us to ignore
# the nightly badge. Restore the ui-tests job (git history) once the UI
# settles and we have a green baseline to defend.
#
# Typical duration: ~10 min. Not required for PR merge — see ci-fast.yml
# for the required check.
on:
schedule:
# 03:00 UTC daily. Cron syntax: minute hour day month day-of-week.
- cron: '0 3 * * *'
workflow_dispatch:
inputs:
reason:
description: 'Why are you running the full suite?'
required: false
default: 'Manual run'
pull_request:
types: [labeled]
concurrency:
group: ci-full-${{ github.ref }}
cancel-in-progress: true
jobs:
# Guard: when triggered by `pull_request: labeled`, only run if the label
# is exactly `run-ui-tests`. Without this, every label add would trigger.
gate:
name: Gate
runs-on: ubuntu-latest
if: github.event_name != 'pull_request' || github.event.label.name == 'run-ui-tests'
steps:
- name: Gate passed
run: |
echo "Trigger: ${{ github.event_name }}"
unit-tests:
name: Unit + Integration Tests
needs: gate
runs-on: macos-15
timeout-minutes: 25
env:
SCHEME: Shellbee
TEST_PLAN: Shellbee
TEST_TARGET: ShellbeeTests
DERIVED_DATA: ${{ github.workspace }}/DerivedData
steps:
- uses: actions/checkout@v4
- name: Cache SwiftPM dependencies
uses: actions/cache@v4
with:
path: |
${{ github.workspace }}/DerivedData/SourcePackages/checkouts
~/Library/Caches/org.swift.swiftpm
key: spm-${{ runner.os }}-${{ hashFiles('**/Package.resolved') }}
restore-keys: |
spm-${{ runner.os }}-
- name: Start dual mock Z2M bridges (native)
env:
MULTI_BRIDGE: "1"
run: ./.github/scripts/start-mock-bridge.sh
- name: Select latest Xcode
run: |
LATEST=$(ls -d /Applications/Xcode*.app 2>/dev/null | sort -V | tail -n1)
sudo xcode-select -s "$LATEST"
xcodebuild -version
- name: Pick simulator
id: sim
run: |
DEVICE_ID=$(xcrun simctl list devices available --json \
| jq -r '[.devices | to_entries[]
| select(.key | test("iOS|com.apple.CoreSimulator.SimRuntime.iOS"))
| .value[]
| select(.isAvailable and (.name | startswith("iPhone")))]
| sort_by(.name) | reverse | .[0].udid')
NAME=$(xcrun simctl list devices --json \
| jq -r --arg id "$DEVICE_ID" '[.devices | to_entries[].value[] | select(.udid==$id)][0].name')
echo "device_id=$DEVICE_ID" >> "$GITHUB_OUTPUT"
echo "device_name=$NAME" >> "$GITHUB_OUTPUT"
- name: Boot simulator and wait for readiness
timeout-minutes: 4
run: |
# `simctl bootstatus -b` boots (if not already) and BLOCKS until the
# device is actually ready (springboard up, services responding) —
# not just "Booted" state. The previous state-check loop returned
# too early, leaving xcodebuild waiting on a not-yet-ready simulator
# which silently hung for the full 30-minute test timeout.
DEVICE_ID="${{ steps.sim.outputs.device_id }}"
xcrun simctl bootstatus "$DEVICE_ID" -b
- name: Resolve Swift packages
run: |
xcodebuild -resolvePackageDependencies \
-project Shellbee.xcodeproj -scheme "$SCHEME" \
-derivedDataPath "$DERIVED_DATA"
- name: Build for testing
env:
DESTINATION: platform=iOS Simulator,id=${{ steps.sim.outputs.device_id }}
run: |
set -o pipefail
xcodebuild build-for-testing \
-project Shellbee.xcodeproj -scheme "$SCHEME" \
-testPlan "$TEST_PLAN" \
-destination "$DESTINATION" -derivedDataPath "$DERIVED_DATA" \
CODE_SIGNING_ALLOWED=NO | tee build-unit.log
- name: Run unit + integration tests
timeout-minutes: 15
env:
DESTINATION: platform=iOS Simulator,id=${{ steps.sim.outputs.device_id }}
run: |
# Skip the same tests that Shellbee-CI.xctestplan skips on Fast CI
# (keychain/concurrency issues that only fail on GitHub runners) —
# except Z2MIntegrationTests, which Full CI explicitly runs because
# we now have the mock bridge up. See xctestplans/README.md.
set -o pipefail
xcodebuild test-without-building \
-project Shellbee.xcodeproj -scheme "$SCHEME" \
-testPlan "$TEST_PLAN" \
-destination "$DESTINATION" -derivedDataPath "$DERIVED_DATA" \
-only-testing:"$TEST_TARGET" \
-skip-testing:"ShellbeeTests/ConnectionConfigTests/testSaveAndLoad" \
-skip-testing:"ShellbeeTests/ConnectionHistoryTests" \
-skip-testing:"ShellbeeTests/HomeLayoutStoreTests" \
-skip-testing:"ShellbeeTests/NotificationPreferencesTests" \
-skip-testing:"ShellbeeTests/ConnectionConfigTests/testSecondLoadAfterLegacyMigrationStillReturnsToken" \
-skip-testing:"ShellbeeTests/Z2MIntegrationTests/testReloadedPersistedConfigConnectsAndReceivesBridgeInfo" \
-resultBundlePath "$DERIVED_DATA/UnitTests.xcresult" \
CODE_SIGNING_ALLOWED=NO | tee test-unit.log
- name: Capture mock bridge logs
if: always()
run: |
cp "$RUNNER_TEMP/z2m-bridge.log" mock-bridge.log 2>/dev/null || true
cp "$RUNNER_TEMP/z2m-seeder.log" mock-seeder.log 2>/dev/null || true
cp "$RUNNER_TEMP/z2m-bridge-2.log" mock-bridge-2.log 2>/dev/null || true
cp "$RUNNER_TEMP/z2m-seeder-2.log" mock-seeder-2.log 2>/dev/null || true
- name: Summarize
if: always()
env:
DEVICE_NAME: ${{ steps.sim.outputs.device_name }}
run: |
{
echo "## Unit Tests"
echo
echo "| Field | Value |"
echo "| --- | --- |"
echo "| Simulator | $DEVICE_NAME |"
echo "| Target | $TEST_TARGET |"
echo
if [ -d "$DERIVED_DATA/UnitTests.xcresult" ]; then
xcrun xcresulttool get --path "$DERIVED_DATA/UnitTests.xcresult" --format json 2>/dev/null \
| jq -r '.metrics | "**Tests: \(.testsCount._value // 0) • Failed: \(.testsFailedCount._value // 0) • Skipped: \(.testsSkippedCount._value // 0)**"' \
|| echo "_Result bundle present but could not be parsed._"
else
echo "_No result bundle produced._"
fi
} >> "$GITHUB_STEP_SUMMARY"
- name: Upload artifacts on failure
if: failure()
uses: actions/upload-artifact@v4
with:
name: ci-full-unit-logs
path: |
build-unit.log
test-unit.log
mock-bridge.log
mock-seeder.log
mock-bridge-2.log
mock-seeder-2.log
${{ env.DERIVED_DATA }}/UnitTests.xcresult
if-no-files-found: ignore
retention-days: 14
ipad-build:
name: iPad build (build-only)
needs: gate
runs-on: macos-15
timeout-minutes: 15
env:
SCHEME: Shellbee
DERIVED_DATA: ${{ github.workspace }}/DerivedData
steps:
- uses: actions/checkout@v4
- name: Cache SwiftPM dependencies
uses: actions/cache@v4
with:
path: |
${{ github.workspace }}/DerivedData/SourcePackages/checkouts
~/Library/Caches/org.swift.swiftpm
key: spm-${{ runner.os }}-${{ hashFiles('**/Package.resolved') }}
restore-keys: |
spm-${{ runner.os }}-
- name: Select latest Xcode
run: |
LATEST=$(ls -d /Applications/Xcode*.app 2>/dev/null | sort -V | tail -n1)
sudo xcode-select -s "$LATEST"
xcodebuild -version
- name: Pick iPad simulator
id: sim
run: |
DEVICE_ID=$(xcrun simctl list devices available --json \
| jq -r '[.devices | to_entries[]
| select(.key | test("iOS|com.apple.CoreSimulator.SimRuntime.iOS"))
| .value[]
| select(.isAvailable and (.name | startswith("iPad")))]
| sort_by(.name) | reverse | .[0].udid')
if [ -z "$DEVICE_ID" ] || [ "$DEVICE_ID" = "null" ]; then
echo "No iPad simulator available on this runner" >&2
exit 1
fi
NAME=$(xcrun simctl list devices --json \
| jq -r --arg id "$DEVICE_ID" '[.devices | to_entries[].value[] | select(.udid==$id)][0].name')
echo "Using: $NAME ($DEVICE_ID)"
echo "device_id=$DEVICE_ID" >> "$GITHUB_OUTPUT"
echo "device_name=$NAME" >> "$GITHUB_OUTPUT"
- name: Build for iPad
env:
DESTINATION: platform=iOS Simulator,id=${{ steps.sim.outputs.device_id }}
run: |
set -o pipefail
xcodebuild build \
-project Shellbee.xcodeproj -scheme "$SCHEME" \
-destination "$DESTINATION" -derivedDataPath "$DERIVED_DATA" \
CODE_SIGNING_ALLOWED=NO | tee build-ipad.log
- name: Upload artifacts on failure
if: failure()
uses: actions/upload-artifact@v4
with:
name: ci-full-ipad-logs
path: |
build-ipad.log
if-no-files-found: ignore
retention-days: 14
ui-tests:
name: UI Tests (smoke)
# Only run when the PR is explicitly labeled `run-ui-tests`. The suite
# was dormant during the multi-bridge redesign; running it on every
# Full CI invocation hangs at 20 min with zero test execution while
# the simulator + app launch story is sorted (#83). The job is kept
# in the workflow so labeling a PR re-enables it once it's green.
if: github.event_name == 'pull_request' && github.event.label.name == 'run-ui-tests'
needs: gate
runs-on: macos-15
timeout-minutes: 30
env:
SCHEME: Shellbee
TEST_PLAN: Shellbee
TEST_TARGET: ShellbeeUITests
DERIVED_DATA: ${{ github.workspace }}/DerivedData
steps:
- uses: actions/checkout@v4
- name: Cache SwiftPM dependencies
uses: actions/cache@v4
with:
path: |
${{ github.workspace }}/DerivedData/SourcePackages/checkouts
~/Library/Caches/org.swift.swiftpm
key: spm-${{ runner.os }}-${{ hashFiles('**/Package.resolved') }}
restore-keys: |
spm-${{ runner.os }}-
- name: Start mock Z2M bridge (single)
run: ./.github/scripts/start-mock-bridge.sh
- name: Select latest Xcode
run: |
LATEST=$(ls -d /Applications/Xcode*.app 2>/dev/null | sort -V | tail -n1)
sudo xcode-select -s "$LATEST"
xcodebuild -version
- name: Pick simulator
id: sim
run: |
DEVICE_ID=$(xcrun simctl list devices available --json \
| jq -r '[.devices | to_entries[]
| select(.key | test("iOS|com.apple.CoreSimulator.SimRuntime.iOS"))
| .value[]
| select(.isAvailable and (.name | startswith("iPhone")))]
| sort_by(.name) | reverse | .[0].udid')
NAME=$(xcrun simctl list devices --json \
| jq -r --arg id "$DEVICE_ID" '[.devices | to_entries[].value[] | select(.udid==$id)][0].name')
echo "device_id=$DEVICE_ID" >> "$GITHUB_OUTPUT"
echo "device_name=$NAME" >> "$GITHUB_OUTPUT"
- name: Boot simulator
timeout-minutes: 4
run: xcrun simctl bootstatus "${{ steps.sim.outputs.device_id }}" -b
- name: Resolve Swift packages
run: |
xcodebuild -resolvePackageDependencies \
-project Shellbee.xcodeproj -scheme "$SCHEME" \
-derivedDataPath "$DERIVED_DATA"
- name: Build for testing
env:
DESTINATION: platform=iOS Simulator,id=${{ steps.sim.outputs.device_id }}
run: |
set -o pipefail
xcodebuild build-for-testing \
-project Shellbee.xcodeproj -scheme "$SCHEME" \
-testPlan "$TEST_PLAN" \
-destination "$DESTINATION" -derivedDataPath "$DERIVED_DATA" \
CODE_SIGNING_ALLOWED=NO | tee build-ui.log
- name: Run UI tests
timeout-minutes: 20
env:
DESTINATION: platform=iOS Simulator,id=${{ steps.sim.outputs.device_id }}
run: |
set -o pipefail
xcodebuild test-without-building \
-project Shellbee.xcodeproj -scheme "$SCHEME" \
-testPlan "$TEST_PLAN" \
-destination "$DESTINATION" -derivedDataPath "$DERIVED_DATA" \
-only-testing:"$TEST_TARGET" \
-resultBundlePath "$DERIVED_DATA/UITests.xcresult" \
CODE_SIGNING_ALLOWED=NO | tee test-ui.log
- name: Capture mock bridge logs
if: always()
run: |
cp "$RUNNER_TEMP/z2m-bridge.log" mock-bridge.log 2>/dev/null || true
cp "$RUNNER_TEMP/z2m-seeder.log" mock-seeder.log 2>/dev/null || true
- name: Upload artifacts on failure
if: failure()
uses: actions/upload-artifact@v4
with:
name: ci-full-ui-logs
path: |
build-ui.log
test-ui.log
mock-bridge.log
mock-seeder.log
${{ env.DERIVED_DATA }}/UITests.xcresult
if-no-files-found: ignore
retention-days: 14