Repository navigation
676 lines (656 loc) · 32.3 KB
/
Copy pathci.yml
File metadata and controls
676 lines (656 loc) · 32.3 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
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
name: CI
on:
pull_request:
push:
branches: [dev]
workflow_call:
workflow_dispatch:
concurrency:
group: ci-${{ github.ref }}-${{ github.event_name }}
cancel-in-progress: true
defaults:
run:
shell: bash
jobs:
tools:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v7
- uses: actions/setup-go@v7
with:
go-version-file: tools/go.mod
cache-dependency-path: tools/go.mod
- run: go vet ./tools/...
- run: go test ./tools/...
- name: Check that the string catalogs round-trip through merge-translations
run: |
for catalog in ishare/Localizable.xcstrings fastlane/metadata/Metadata.xcstrings; do
go run ./tools/cmd/ishare-tools merge-translations "$catalog" "$catalog" "$RUNNER_TEMP/roundtrip.xcstrings"
cmp "$catalog" "$RUNNER_TEMP/roundtrip.xcstrings"
done
- name: Check that the localized App Store metadata matches its catalog
run: go run ./tools/cmd/ishare-tools metadata --check
core:
runs-on: macos-26
timeout-minutes: 30
steps:
- uses: actions/checkout@v7
- uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: latest-stable
- name: Check the Swift formatting
run: |
xcrun swift-format --version
xcrun swift-format lint --strict --recursive --parallel \
ishare sharemenuext ishareWidgets ishare-cli ishareTests ishareUITests \
Packages/ishareCore/Package.swift Packages/ishareCore/Sources Packages/ishareCore/Tests
- name: Run the ishareCore package tests
run: swift test --package-path Packages/ishareCore
integrations:
runs-on: ubuntu-24.04
defaults:
run:
working-directory: integrations/raycast
steps:
- uses: actions/checkout@v7
- uses: actions/setup-node@v7
with:
node-version: lts/*
cache: npm
cache-dependency-path: integrations/raycast/package-lock.json
- run: npm ci
- run: npm run build
- run: npm run lint
app:
runs-on: macos-26
timeout-minutes: 60
steps:
- uses: actions/checkout@v7
- uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: latest-stable
- uses: actions/setup-go@v7
with:
go-version-file: tools/go.mod
cache-dependency-path: tools/go.mod
- name: Install XcodeGen
run: brew install xcodegen
- run: xcodegen generate
- name: Build the App Store target
run: |
xcodebuild build \
-project ishare.xcodeproj \
-scheme ishare \
-configuration Release \
-destination "generic/platform=macOS" \
CODE_SIGNING_ALLOWED=NO | tee "$RUNNER_TEMP/app-store-build.log" | xcbeautify
- name: Rebuild the widget and app incrementally to catch warnings only those builds show
run: |
touch ishareWidgets/*.swift ishare/Intents/*.swift
xcodebuild build \
-project ishare.xcodeproj \
-scheme ishare \
-configuration Release \
-destination "generic/platform=macOS" \
CODE_SIGNING_ALLOWED=NO | tee "$RUNNER_TEMP/app-store-incremental.log" | xcbeautify
- name: Run unit tests
timeout-minutes: 25
run: |
(
sleep 720
for pid in $(pgrep -f "ishare.app/Contents/MacOS/ishare|xctest"); do
sample "$pid" 3 -file "$RUNNER_TEMP/hang-$pid.txt" > /dev/null 2>&1 || true
done
) &
xcodebuild test \
-project ishare.xcodeproj \
-scheme GitHub \
-destination "platform=macOS,arch=arm64" \
-enableCodeCoverage YES \
-resultBundlePath build/UnitTests.xcresult \
CODE_SIGN_IDENTITY=- CODE_SIGN_STYLE=Manual DEVELOPMENT_TEAM= PROVISIONING_PROFILE_SPECIFIER= | tee "$RUNNER_TEMP/unit-tests.log" | xcbeautify
- name: Show where the unit tests hung
if: failure()
run: |
for file in "$RUNNER_TEMP"/hang-*.txt; do
[ -f "$file" ] || continue
echo "== $file"
sed -n '/Call graph:/,/Total number in stack/p' "$file" | head -300
done
- name: Fail on build warnings
run: |
go run ./tools/cmd/ishare-tools build-warnings \
"$RUNNER_TEMP/app-store-build.log" "$RUNNER_TEMP/app-store-incremental.log" "$RUNNER_TEMP/unit-tests.log"
- name: Check code coverage
run: |
mkdir -p build/coverage
xcrun xccov view --report --json build/UnitTests.xcresult > "$RUNNER_TEMP/coverage.json"
go run ./tools/cmd/ishare-tools coverage \
--root "$GITHUB_WORKSPACE" \
--min Capture=23 \
--min Http=70 \
--min ISCU=80 \
--output build/coverage/summary.md \
"$RUNNER_TEMP/coverage.json"
- name: Record the pull request for the coverage comment
if: always() && github.event_name == 'pull_request' && hashFiles('build/coverage/summary.md') != ''
env:
PR_NUMBER: ${{ github.event.pull_request.number }}
run: echo "$PR_NUMBER" > build/coverage/pr-number
- uses: actions/upload-artifact@v7
if: always() && github.event_name == 'pull_request' && hashFiles('build/coverage/summary.md') != ''
with:
name: coverage-summary
path: build/coverage
retention-days: 7
- name: Show compiler errors
if: failure()
run: grep -h -B2 -A6 -E "error:|Command .* failed|Stack dump" "$RUNNER_TEMP"/*.log | head -200 || true
- name: Find the source file that crashes the compiler
if: failure()
run: |
xcodebuild build \
-project ishare.xcodeproj \
-scheme ishare \
-configuration Release \
-destination "generic/platform=macOS" \
SWIFT_COMPILATION_MODE=singlefile \
SWIFT_ENABLE_BATCH_MODE=NO \
CODE_SIGNING_ALLOWED=NO > "$RUNNER_TEMP/singlefile.log" 2>&1 || true
grep -B12 -E "Stack dump:" "$RUNNER_TEMP/singlefile.log" | grep -E "SwiftCompile|Compiling|emitting|-primary-file" | sed -E 's/.*-primary-file ([^ ]+).*/primary file: \1/' | sort -u | head -40 || true
- name: Collect the snapshot renderings that differ from their references
if: failure()
run: |
FAILURES="$(getconf DARWIN_USER_TEMP_DIR)ishare-snapshot-failures"
mkdir -p build/snapshot-failures
if [ -d "$FAILURES" ]; then cp -R "$FAILURES/." build/snapshot-failures/; fi
- uses: actions/upload-artifact@v7
if: failure()
with:
name: snapshot-failures
path: build/snapshot-failures
if-no-files-found: ignore
automation:
runs-on: macos-26
timeout-minutes: 45
steps:
- uses: actions/checkout@v7
- uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: latest-stable
- uses: actions/setup-go@v7
with:
go-version-file: tools/go.mod
cache-dependency-path: tools/go.mod
- name: Install XcodeGen
run: brew install xcodegen
- run: xcodegen generate
- name: Build the GitHub app with the automation test hooks
run: |
xcodebuild build \
-project ishare.xcodeproj \
-scheme GitHub \
-configuration Debug \
-destination "platform=macOS,arch=arm64" \
-derivedDataPath build/DerivedData \
CODE_SIGN_IDENTITY=- CODE_SIGN_STYLE=Manual DEVELOPMENT_TEAM= PROVISIONING_PROFILE_SPECIFIER= \
"OTHER_SWIFT_FLAGS=\$(inherited) -DAUTOMATION_TESTS" | tee "$RUNNER_TEMP/automation-build.log" | xcbeautify
- name: Fail on build warnings
run: go run ./tools/cmd/ishare-tools build-warnings "$RUNNER_TEMP/automation-build.log"
- name: Let the bundled command-line tool use the test mailbox outside its sandbox
run: |
APP=build/DerivedData/Build/Products/Debug/ishare.app
test -x "$APP/Contents/Helpers/ishare"
codesign --force --sign - "$APP/Contents/Helpers/ishare"
codesign --force --sign - --preserve-metadata=entitlements,flags "$APP"
codesign --verify --verbose=2 "$APP"
- name: Park the pointer away from the result toasts
run: |
cat > "$RUNNER_TEMP/park-pointer.swift" <<'SWIFT'
import CoreGraphics
let height = CGFloat(CGDisplayPixelsHigh(CGMainDisplayID()))
CGWarpMouseCursorPosition(CGPoint(x: 10, y: height - 10))
SWIFT
xcrun swift "$RUNNER_TEMP/park-pointer.swift"
- name: Keep the app's info log
run: sudo log config --subsystem dev.adrian.ishare --mode "level:info,persist:info"
- name: Let the automation runner script the app
run: |
go build -o "$RUNNER_TEMP/ishare-tools" ./tools/cmd/ishare-tools
scripts/allow-apple-events.sh dev.adrian.ishare "$RUNNER_TEMP/ishare-tools"
- name: Run every ishare:// action and CLI command against the app
run: |
"$RUNNER_TEMP/ishare-tools" automation \
--app build/DerivedData/Build/Products/Debug/ishare.app \
--work "$RUNNER_TEMP/automation" | tee "$RUNNER_TEMP/automation.log"
- name: Summarize the automation checks
if: always()
run: |
if [ -f "$RUNNER_TEMP/automation.log" ]; then
{
echo '### Automation checks'
echo '```'
cat "$RUNNER_TEMP/automation.log"
echo '```'
} >> "$GITHUB_STEP_SUMMARY"
fi
- name: Show the app log
if: failure()
run: |
log show --last 40m --info --style compact --predicate 'subsystem == "dev.adrian.ishare"' | tail -400 || true
for pid in $(pgrep -f "ishare.app/Contents/MacOS/ishare"); do
sample "$pid" 2 -file "$RUNNER_TEMP/automation/sample-$pid.txt" > /dev/null 2>&1 || true
sed -n '/Call graph:/,/Total number in stack/p' "$RUNNER_TEMP/automation/sample-$pid.txt" | head -120 || true
done
- uses: actions/upload-artifact@v7
if: failure()
with:
name: automation-work
path: ${{ runner.temp }}/automation
if-no-files-found: ignore
leaks:
runs-on: macos-26
timeout-minutes: 45
steps:
- uses: actions/checkout@v7
- uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: latest-stable
- uses: actions/setup-go@v7
with:
go-version-file: tools/go.mod
cache-dependency-path: tools/go.mod
- name: Install XcodeGen
run: brew install xcodegen
- run: xcodegen generate
- name: Build the GitHub app with the automation test hooks
run: |
xcodebuild build \
-project ishare.xcodeproj \
-scheme GitHub \
-configuration Debug \
-destination "platform=macOS,arch=arm64" \
-derivedDataPath build/DerivedData \
CODE_SIGN_IDENTITY=- CODE_SIGN_STYLE=Manual DEVELOPMENT_TEAM= PROVISIONING_PROFILE_SPECIFIER= \
"OTHER_SWIFT_FLAGS=\$(inherited) -DAUTOMATION_TESTS" | tee "$RUNNER_TEMP/automation-build.log" | xcbeautify
- name: Fail on build warnings
run: go run ./tools/cmd/ishare-tools build-warnings "$RUNNER_TEMP/automation-build.log"
- name: Let the bundled command-line tool use the test mailbox outside its sandbox
run: |
APP=build/DerivedData/Build/Products/Debug/ishare.app
test -x "$APP/Contents/Helpers/ishare"
codesign --force --sign - "$APP/Contents/Helpers/ishare"
codesign --force --sign - --preserve-metadata=entitlements,flags "$APP"
codesign --verify --verbose=2 "$APP"
- name: Park the pointer away from the result toasts
run: |
cat > "$RUNNER_TEMP/park-pointer.swift" <<'SWIFT'
import CoreGraphics
let height = CGFloat(CGDisplayPixelsHigh(CGMainDisplayID()))
CGWarpMouseCursorPosition(CGPoint(x: 10, y: height - 10))
SWIFT
xcrun swift "$RUNNER_TEMP/park-pointer.swift"
- name: Keep the app's info log
run: sudo log config --subsystem dev.adrian.ishare --mode "level:info,persist:info"
- name: Let the automation runner script the app
run: |
go build -o "$RUNNER_TEMP/ishare-tools" ./tools/cmd/ishare-tools
scripts/allow-apple-events.sh dev.adrian.ishare "$RUNNER_TEMP/ishare-tools"
- name: Run two identical automation rounds in one session
run: |
mkdir -p "$RUNNER_TEMP/leaks"
"$RUNNER_TEMP/ishare-tools" automation \
--app build/DerivedData/Build/Products/Debug/ishare.app \
--work "$RUNNER_TEMP/automation" \
--rounds 2 --keep-running \
--launch-env MallocStackLogging=1 \
--snapshots "$RUNNER_TEMP/leaks" | tee "$RUNNER_TEMP/leaks/automation.log"
- name: Check for leaks and memory growth
run: |
PID=$(cat "$RUNNER_TEMP/leaks/pid")
leaks "$PID" > "$RUNNER_TEMP/leaks/leaks.txt" || true
vmmap --summary "$PID" > "$RUNNER_TEMP/leaks/vmmap.txt" || true
kill "$PID" || true
go run ./tools/cmd/ishare-tools leaks-check \
--leaks "$RUNNER_TEMP/leaks/leaks.txt" \
--before "$RUNNER_TEMP/leaks/footprint-1.txt" \
--after "$RUNNER_TEMP/leaks/footprint-2.txt" \
--max-leaks 10 --max-growth-mb 40
- uses: actions/upload-artifact@v7
if: always()
with:
name: leak-reports
path: ${{ runner.temp }}/leaks
if-no-files-found: ignore
app-store-tests:
runs-on: macos-26
timeout-minutes: 60
steps:
- uses: actions/checkout@v7
- uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: latest-stable
- uses: actions/setup-go@v7
with:
go-version-file: tools/go.mod
cache-dependency-path: tools/go.mod
- name: Install XcodeGen
run: brew install xcodegen
- run: xcodegen generate
- name: Run the unit tests inside the sandboxed App Store app
run: |
xcodebuild test \
-project ishare.xcodeproj \
-scheme AppStoreTests \
-destination "platform=macOS,arch=arm64" \
-derivedDataPath build/DerivedData \
-resultBundlePath build/AppStoreTests.xcresult \
CODE_SIGN_IDENTITY=- CODE_SIGN_STYLE=Manual DEVELOPMENT_TEAM= PROVISIONING_PROFILE_SPECIFIER= \
ISHARE_APP_STORE_ENTITLEMENTS=ishareTests/SandboxedTestHost.entitlements | tee "$RUNNER_TEMP/app-store-tests.log" | xcbeautify
- name: Fail on build warnings
run: go run ./tools/cmd/ishare-tools build-warnings "$RUNNER_TEMP/app-store-tests.log"
- name: Check that the test host really was sandboxed
run: codesign -d --entitlements - --xml build/DerivedData/Build/Products/Debug/ishare.app | grep -q com.apple.security.app-sandbox
- uses: actions/upload-artifact@v7
if: failure()
with:
name: app-store-tests-xcresult
path: build/AppStoreTests.xcresult
real-capture:
runs-on: macos-26
timeout-minutes: 40
continue-on-error: true
steps:
- uses: actions/checkout@v7
- uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: latest-stable
- name: Install XcodeGen
run: brew install xcodegen
- run: xcodegen generate
- name: Build the unit tests
run: |
xcodebuild build-for-testing \
-project ishare.xcodeproj \
-scheme GitHub \
-destination "platform=macOS,arch=arm64" \
-derivedDataPath build/DerivedData \
CODE_SIGN_IDENTITY=- CODE_SIGN_STYLE=Manual DEVELOPMENT_TEAM= PROVISIONING_PROFILE_SPECIFIER= | xcbeautify
- name: Allow the test host to record the screen
run: scripts/allow-screen-recording.sh dev.adrian.ishare
- name: Capture the real screen around the selection overlay
env:
TEST_RUNNER_ISHARE_REAL_CAPTURE: "1"
run: |
xcodebuild test-without-building \
-project ishare.xcodeproj \
-scheme GitHub \
-destination "platform=macOS,arch=arm64" \
-derivedDataPath build/DerivedData \
-only-testing:ishareTests/RealCaptureTests \
-resultBundlePath build/RealCapture.xcresult | xcbeautify
- uses: actions/upload-artifact@v7
if: failure()
with:
name: real-capture-xcresult
path: build/RealCapture.xcresult
ui-tests:
runs-on: macos-26
timeout-minutes: 60
steps:
- uses: actions/checkout@v7
- uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: latest-stable
- uses: actions/setup-go@v7
with:
go-version-file: tools/go.mod
cache-dependency-path: tools/go.mod
- name: Install XcodeGen
run: brew install xcodegen
- run: xcodegen generate
- name: Run the menu and editor UI tests
run: |
xcodebuild test \
-project ishare.xcodeproj \
-scheme UITests \
-destination "platform=macOS,arch=arm64" \
-derivedDataPath build/DerivedData \
-resultBundlePath build/UITests.xcresult \
CODE_SIGN_IDENTITY=- CODE_SIGN_STYLE=Manual DEVELOPMENT_TEAM= PROVISIONING_PROFILE_SPECIFIER= | tee "$RUNNER_TEMP/ui-tests.log" | xcbeautify
- name: Fail on build warnings
run: go run ./tools/cmd/ishare-tools build-warnings "$RUNNER_TEMP/ui-tests.log"
- uses: actions/upload-artifact@v7
if: failure()
with:
name: ui-tests-xcresult
path: build/UITests.xcresult
s3-integration:
runs-on: macos-26
timeout-minutes: 60
env:
MINIO_ROOT_USER: ishare-ci
MINIO_ROOT_PASSWORD: ishare-ci-secret
MINIO_DOMAIN: localhost
steps:
- uses: actions/checkout@v7
- uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: latest-stable
- name: Install XcodeGen and MinIO
run: brew install xcodegen minio
- name: Check that bucket subdomains of localhost resolve to loopback
run: |
for host in ishare-integration.localhost ishare-integration-private.localhost; do
dscacheutil -q host -a name "$host"
done
- name: Start MinIO
run: |
mkdir -p "$RUNNER_TEMP/minio"
nohup minio server "$RUNNER_TEMP/minio" --address "[::]:9000" > "$RUNNER_TEMP/minio.log" 2>&1 &
for _ in $(seq 1 60); do
if curl -sf http://127.0.0.1:9000/minio/health/live; then
exit 0
fi
sleep 1
done
cat "$RUNNER_TEMP/minio.log"
exit 1
- run: xcodegen generate
- name: Run the S3 integration tests against MinIO
env:
TEST_RUNNER_ISHARE_S3_ENDPOINT: http://127.0.0.1:9000
TEST_RUNNER_ISHARE_S3_VIRTUAL_HOST_ENDPOINT: http://localhost:9000
TEST_RUNNER_ISHARE_S3_ACCESS_KEY: ishare-ci
TEST_RUNNER_ISHARE_S3_SECRET_KEY: ishare-ci-secret
run: |
xcodebuild test \
-project ishare.xcodeproj \
-scheme GitHub \
-destination "platform=macOS,arch=arm64" \
-derivedDataPath build/DerivedData \
-resultBundlePath build/S3Integration.xcresult \
-only-testing:ishareTests/NetworkSuite \
CODE_SIGN_IDENTITY=- CODE_SIGN_STYLE=Manual DEVELOPMENT_TEAM= PROVISIONING_PROFILE_SPECIFIER= | xcbeautify
- name: Check that the integration tests ran
run: |
xcrun xcresulttool get test-results tests --path build/S3Integration.xcresult > "$RUNNER_TEMP/tests.json"
python3 - "$RUNNER_TEMP/tests.json" <<'PY'
import json, sys
def walk(node):
yield node
for child in node.get("children", []):
yield from walk(child)
nodes = [node for root in json.load(open(sys.argv[1]))["testNodes"] for node in walk(root)]
integration = [node for node in nodes if node.get("nodeType") == "Test Case" and "S3IntegrationTests" in node.get("nodeIdentifier", "")]
passed = [node for node in integration if node.get("result") == "Passed"]
print(f"{len(passed)} of {len(integration)} S3 integration tests passed")
sys.exit(0 if integration and len(passed) == len(integration) else 1)
PY
- name: Show the MinIO log
if: failure()
run: cat "$RUNNER_TEMP/minio.log"
- uses: actions/upload-artifact@v7
if: failure()
with:
name: s3-integration-xcresult
path: build/S3Integration.xcresult
webdav-integration:
runs-on: macos-26
timeout-minutes: 60
env:
WEBDAV_USER: ishare
WEBDAV_PASSWORD: ishare-ci-secret
steps:
- uses: actions/checkout@v7
- uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: latest-stable
- name: Install XcodeGen and rclone
run: brew install xcodegen rclone
- name: Install WsgiDAV for digest authentication
run: |
python3 -m venv "$RUNNER_TEMP/wsgidav"
"$RUNNER_TEMP/wsgidav/bin/pip" install --quiet wsgidav cheroot
- name: Start the WebDAV servers
run: |
mkdir -p "$RUNNER_TEMP/webdav" "$RUNNER_TEMP/digest"
nohup rclone serve webdav "$RUNNER_TEMP/webdav" --addr 127.0.0.1:8081 --user "$WEBDAV_USER" --pass "$WEBDAV_PASSWORD" > "$RUNNER_TEMP/webdav.log" 2>&1 &
cat > "$RUNNER_TEMP/wsgidav.yaml" <<YAML
host: 127.0.0.1
port: 8082
server: cheroot
verbose: 3
http_authenticator:
accept_basic: false
accept_digest: true
default_to_digest: true
simple_dc:
user_mapping:
"*":
$WEBDAV_USER:
password: $WEBDAV_PASSWORD
provider_mapping:
"/": $RUNNER_TEMP/digest
YAML
nohup "$RUNNER_TEMP/wsgidav/bin/wsgidav" --config "$RUNNER_TEMP/wsgidav.yaml" > "$RUNNER_TEMP/digest.log" 2>&1 &
for _ in $(seq 1 60); do
basic=$(curl -s -o /dev/null -w "%{http_code}" -u "$WEBDAV_USER:$WEBDAV_PASSWORD" http://127.0.0.1:8081/ || true)
digest=$(curl -s -o /dev/null -w "%{http_code}" --digest -u "$WEBDAV_USER:$WEBDAV_PASSWORD" http://127.0.0.1:8082/ || true)
if [ "$basic" = "200" ] && [ "$digest" = "200" ]; then
exit 0
fi
sleep 1
done
cat "$RUNNER_TEMP/webdav.log" "$RUNNER_TEMP/digest.log"
exit 1
- run: xcodegen generate
- name: Run the WebDAV integration tests
env:
TEST_RUNNER_ISHARE_WEBDAV_URL: http://127.0.0.1:8081/
TEST_RUNNER_ISHARE_WEBDAV_DIGEST_URL: http://127.0.0.1:8082/
TEST_RUNNER_ISHARE_WEBDAV_USER: ishare
TEST_RUNNER_ISHARE_WEBDAV_PASSWORD: ishare-ci-secret
run: |
xcodebuild test \
-project ishare.xcodeproj \
-scheme GitHub \
-destination "platform=macOS,arch=arm64" \
-derivedDataPath build/DerivedData \
-resultBundlePath build/WebDAVIntegration.xcresult \
-only-testing:ishareTests/NetworkSuite \
CODE_SIGN_IDENTITY=- CODE_SIGN_STYLE=Manual DEVELOPMENT_TEAM= PROVISIONING_PROFILE_SPECIFIER= | xcbeautify
- name: Check that the integration tests ran
run: |
xcrun xcresulttool get test-results tests --path build/WebDAVIntegration.xcresult > "$RUNNER_TEMP/tests.json"
python3 - "$RUNNER_TEMP/tests.json" <<'PY'
import json, sys
def walk(node):
yield node
for child in node.get("children", []):
yield from walk(child)
nodes = [node for root in json.load(open(sys.argv[1]))["testNodes"] for node in walk(root)]
integration = [node for node in nodes if node.get("nodeType") == "Test Case" and "WebDAVIntegrationTests" in node.get("nodeIdentifier", "")]
passed = [node for node in integration if node.get("result") == "Passed"]
print(f"{len(passed)} of {len(integration)} WebDAVIntegrationTests passed")
sys.exit(0 if integration and len(passed) == len(integration) else 1)
PY
- name: Show the WebDAV server logs
if: failure()
run: cat "$RUNNER_TEMP/webdav.log" "$RUNNER_TEMP/digest.log"
- uses: actions/upload-artifact@v7
if: failure()
with:
name: webdav-integration-xcresult
path: build/WebDAVIntegration.xcresult
sftp-integration:
runs-on: macos-26
timeout-minutes: 60
env:
SFTP_USER: ishare
SFTP_PASSWORD: ishare-ci-secret
steps:
- uses: actions/checkout@v7
- uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: latest-stable
- name: Install XcodeGen and rclone
run: brew install xcodegen rclone
- name: Start a throwaway SFTP server
run: |
mkdir -p "$RUNNER_TEMP/sftp/uploads" "$RUNNER_TEMP/keys"
ssh-keygen -q -t ed25519 -N "" -f "$RUNNER_TEMP/keys/client" -C ishare-ci
ssh-keygen -q -t ed25519 -N "" -f "$RUNNER_TEMP/keys/host" -C ishare-ci-host
ssh-keygen -lf "$RUNNER_TEMP/keys/host.pub"
nohup rclone serve sftp "$RUNNER_TEMP/sftp" --addr 127.0.0.1:2222 --user "$SFTP_USER" --pass "$SFTP_PASSWORD" \
--authorized-keys "$RUNNER_TEMP/keys/client.pub" --key "$RUNNER_TEMP/keys/host" > "$RUNNER_TEMP/sftp.log" 2>&1 &
for _ in $(seq 1 60); do
if nc -z 127.0.0.1 2222; then
exit 0
fi
sleep 1
done
cat "$RUNNER_TEMP/sftp.log"
exit 1
- run: xcodegen generate
- name: Run the SFTP integration tests
run: |
export TEST_RUNNER_ISHARE_SFTP_HOST=127.0.0.1
export TEST_RUNNER_ISHARE_SFTP_PORT=2222
export TEST_RUNNER_ISHARE_SFTP_USER="$SFTP_USER"
export TEST_RUNNER_ISHARE_SFTP_PASSWORD="$SFTP_PASSWORD"
export TEST_RUNNER_ISHARE_SFTP_KEY_PATH="$RUNNER_TEMP/keys/client"
export TEST_RUNNER_ISHARE_SFTP_DIRECTORY=uploads
xcodebuild test \
-project ishare.xcodeproj \
-scheme GitHub \
-destination "platform=macOS,arch=arm64" \
-derivedDataPath build/DerivedData \
-resultBundlePath build/SFTPIntegration.xcresult \
-only-testing:ishareTests/NetworkSuite \
CODE_SIGN_IDENTITY=- CODE_SIGN_STYLE=Manual DEVELOPMENT_TEAM= PROVISIONING_PROFILE_SPECIFIER= | xcbeautify
- name: Check that the integration tests ran
run: |
xcrun xcresulttool get test-results tests --path build/SFTPIntegration.xcresult > "$RUNNER_TEMP/tests.json"
python3 - "$RUNNER_TEMP/tests.json" <<'PY'
import json, sys
def walk(node):
yield node
for child in node.get("children", []):
yield from walk(child)
nodes = [node for root in json.load(open(sys.argv[1]))["testNodes"] for node in walk(root)]
integration = [node for node in nodes if node.get("nodeType") == "Test Case" and "SFTPIntegrationTests" in node.get("nodeIdentifier", "")]
passed = [node for node in integration if node.get("result") == "Passed"]
print(f"{len(passed)} of {len(integration)} SFTPIntegrationTests passed")
sys.exit(0 if integration and len(passed) == len(integration) else 1)
PY
- name: Check that the uploads reached the server
run: find "$RUNNER_TEMP/sftp/uploads" -type f | head -20
- name: Show the SFTP server log
if: failure()
run: cat "$RUNNER_TEMP/sftp.log"
- uses: actions/upload-artifact@v7
if: failure()
with:
name: sftp-integration-xcresult
path: build/SFTPIntegration.xcresult