Repository navigation
410 lines (346 loc) · 16.1 KB
/
Copy pathliveobjects.yaml
File metadata and controls
410 lines (346 loc) · 16.1 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
# Checks for the LiveObjects plugin (the AblyLiveObjects product and the
# LiveObjects/ directory). Ported from the ably-liveobjects-swift-plugin
# repo's Check workflow when that repo was merged into this one; the core
# SDK's checks live in the other workflows in this directory.
name: LiveObjects
on:
workflow_dispatch:
pull_request:
# Only main is listed. sdk-upload-action rejects a push to any other branch.
push:
branches:
- main
permissions: {}
defaults:
run:
working-directory: LiveObjects
jobs:
lint:
runs-on: macos-15
permissions:
contents: read
# From actions/cache documentation linked to below
env:
MINT_PATH: .mint/lib
MINT_LINK_PATH: .mint/bin
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
with:
persist-credentials: false
submodules: true
# This step can be removed once the runners' default version of Xcode is 26.2 or above
- uses: maxim-lobanov/setup-xcode@ed7a3b1fda3918c0306d1b724322adc0b8cc0a90 # v1
with:
xcode-version: 26.2
# We use caching for Mint because at the time of writing SwiftLint took about 5 minutes to build in CI, which is unacceptably slow.
# https://github.com/actions/cache/blob/40c3b67b2955d93d83b27ed164edd0756bc24049/examples.md#swift---mint
- uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4
with:
path: LiveObjects/.mint
key: ${{ runner.os }}-mint-${{ hashFiles('**/Mintfile') }}
restore-keys: |
${{ runner.os }}-mint-
- run: npm ci
- run: brew install mint
- run: mint bootstrap
- run: swift run --package-path BuildTool BuildTool lint
# Fails if LiveObjects/Sources grows a `testsOnly_` declaration outside the
# sanctioned residual allowlist (or if a listed residual disappears). See
# Test/AblyLiveObjectsTesting/README.md.
- name: Check LiveObjects test seams
working-directory: .
run: bash Scripts/check-liveobjects-test-seams.sh
# Emits the platform × Xcode-version matrices (via BuildTool generate-matrices)
# consumed by the BuildTool-driven jobs below.
generate-matrices:
runs-on: macos-15
permissions:
contents: read
outputs:
matrix: ${{ steps.generation-step.outputs.matrix }}
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
with:
persist-credentials: false
submodules: true
# This step can be removed once the runners' default version of Xcode is 26.2 or above
- uses: maxim-lobanov/setup-xcode@ed7a3b1fda3918c0306d1b724322adc0b8cc0a90 # v1
with:
xcode-version: 26.2
- id: generation-step
run: swift run --package-path BuildTool BuildTool generate-matrices >> $GITHUB_OUTPUT
build-and-test-spm:
name: SPM (Xcode ${{ matrix.tooling.xcodeVersion }})
runs-on: macos-15
needs: generate-matrices
permissions:
contents: read
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.generate-matrices.outputs.matrix).withoutPlatform }}
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
with:
persist-credentials: false
submodules: true
- uses: maxim-lobanov/setup-xcode@ed7a3b1fda3918c0306d1b724322adc0b8cc0a90 # v1
with:
xcode-version: ${{ matrix.tooling.xcodeVersion }}
# https://forums.swift.org/t/warnings-as-errors-for-libraries-frameworks/58393/2
#
# These run at the repo root: the package that contains the
# AblyLiveObjects targets is the root ably-cocoa package. The test run
# is filtered to the LiveObjects test module; the rest of the package's
# tests are run by the core SDK's own workflows (though `swift test`
# builds all of the package's test targets, so -warnings-as-errors
# covers their compilation here too — note that the warning set is a
# property of this job's Xcode version, and newer toolchains may warn
# about things this one does not).
- name: Build (warnings as errors)
working-directory: .
run: swift build -Xswiftc -warnings-as-errors
- name: Run LiveObjects tests
working-directory: .
run: swift test -Xswiftc -warnings-as-errors --filter 'AblyLiveObjectsTests\.'
# NOTE: there is deliberately NO job here that RUNS the `UTS` target's tests
# (Test/UTS — the Universal Test Suite derived from the ably/specification
# `uts/` specs, including the LiveObjects `objects` unit tier at
# Test/UTS/unit/objects). Running them here would duplicate CI that already
# exists:
#
# - EXECUTION: uts.yaml's Fastlane lanes run the whole `UTS`
# target on iOS, tvOS AND macOS via Test/Ably.xctestplan (which lists the
# UTS target un-skipped) — including the sandbox-network integration tier
# and, on macOS, the proxy tier.
# - COMPILATION under -warnings-as-errors: the build-and-test-spm job above
# already provides it — `swift test` compiles every test target in the
# package (UTS and Test/AblyLiveObjectsTesting included) even though its
# --filter only EXECUTES the AblyLiveObjectsTests suite.
#
# A `build-and-test-uts` job used to live here; it was removed as redundant
# (and flaky — `--filter UTS` ran the network-bound sandbox/proxy suites on
# every PR). To run the UTS tests locally: `swift test --filter UTS`, or a
# single suite with the target-qualified form
# `swift test --filter "UTS.<SuiteName>"`.
build-release-configuration-spm:
name: SPM, `release` configuration (Xcode ${{ matrix.tooling.xcodeVersion }})
runs-on: macos-15
needs: generate-matrices
permissions:
contents: read
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.generate-matrices.outputs.matrix).withoutPlatform }}
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
with:
persist-credentials: false
submodules: true
- uses: maxim-lobanov/setup-xcode@ed7a3b1fda3918c0306d1b724322adc0b8cc0a90 # v1
with:
xcode-version: ${{ matrix.tooling.xcodeVersion }}
# https://forums.swift.org/t/warnings-as-errors-for-libraries-frameworks/58393/2
#
# Scoped to --target AblyLiveObjects: a whole-package release build also
# compiles the AblyLiveObjectsTesting helper target, which uses
# `@testable import AblyLiveObjects` and so only builds when testability is
# enabled (a debug-only affordance). That helper is debug-only test tooling,
# never shipped, and unreachable from any product, so consumers never build
# it. Scoping the release check to the AblyLiveObjects target reproduces
# exactly what a consumer compiles — a genuine, no-testability release check
# of the shipped library that excludes the helper target. (Note: --product
# does NOT scope this out for an in-package build — SwiftPM still compiles
# every regular target of the root package; --target does. This matches the
# availability job above, which also uses --target AblyLiveObjects.) The
# -Xswiftc -warnings-as-errors flag is preserved.
- name: Build (release, warnings as errors)
working-directory: .
run: swift build -Xswiftc -warnings-as-errors --configuration release --target AblyLiveObjects
# Builds and runs AblyLiveObjectsTests through the AblyLiveObjects Xcode
# scheme via BuildTool, once per platform.
build-and-test-xcode:
name: Xcode, ${{matrix.platform}} (Xcode ${{ matrix.tooling.xcodeVersion }})
runs-on: macos-15
needs: generate-matrices
permissions:
contents: read
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.generate-matrices.outputs.matrix).withPlatform }}
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
with:
persist-credentials: false
submodules: true
- uses: maxim-lobanov/setup-xcode@ed7a3b1fda3918c0306d1b724322adc0b8cc0a90 # v1
with:
xcode-version: ${{ matrix.tooling.xcodeVersion }}
# We run these as two separate steps so that we can easily see the execution time of each step.
- name: Build for testing
env:
PLATFORM: ${{ matrix.platform }}
run: swift run --package-path BuildTool BuildTool build-library-for-testing --platform "$PLATFORM"
- name: Run tests
env:
PLATFORM: ${{ matrix.platform }}
run: swift run --package-path BuildTool BuildTool test-library --platform "$PLATFORM" --without-building
# Runs AblyLiveObjectsTests with coverage and publishes the numbers. Note it
# passes the UnitTests test plan (skips anything tagged .integration), unlike
# build-and-test-xcode above which uses the scheme's default AllTests plan.
code-coverage:
name: Generate code coverage
runs-on: macos-15
permissions:
contents: read
checks: write
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
with:
persist-credentials: false
submodules: true
# This step can be removed once the runners' default version of Xcode is 26.2 or above
- uses: maxim-lobanov/setup-xcode@ed7a3b1fda3918c0306d1b724322adc0b8cc0a90 # v1
with:
xcode-version: 26.2
- run: swift run --package-path BuildTool BuildTool generate-code-coverage --result-bundle-path CodeCoverage.xcresult
# Generate a Markdown report of the code coverage information and add it to the workflow run.
#
# This tool is the best option that I could find after a brief look at the options. There are a few things that I wish it could do:
#
# - post a message on the pull request, like they do on Kotlin
# - offer more fine-grained configuration about which data to include in the report (I only care about code coverage, not test results, and I don't care about code coverage of the AblyLiveObjectsTests target)
#
# but it'll do for now (we can always fork or have another look for tooling later).
- uses: slidoapp/xcresulttool@b98987749a0e149b1eecce5387dbb90aa1d58499 # v3.2.0
with:
path: LiveObjects/CodeCoverage.xcresult
# This title will be used for the sidebar item that this job adds to GitHub results page for this workflow
title: LiveObjects code coverage results
# Turning off as much non-code-coverage information as it lets me
show-passed-tests: false
if: success() || failure()
# Release-configuration build of the AblyLiveObjects scheme per platform
# (build only — no tests). Complements build-release-configuration-spm above,
# which does the SPM-side release check.
build-release-configuration-xcode:
name: Xcode, `release` configuration, ${{matrix.platform}} (Xcode ${{ matrix.tooling.xcodeVersion }})
runs-on: macos-15
needs: generate-matrices
permissions:
contents: read
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.generate-matrices.outputs.matrix).withPlatform }}
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
with:
persist-credentials: false
submodules: true
- uses: maxim-lobanov/setup-xcode@ed7a3b1fda3918c0306d1b724322adc0b8cc0a90 # v1
with:
xcode-version: ${{ matrix.tooling.xcodeVersion }}
- name: Build library
env:
PLATFORM: ${{ matrix.platform }}
run: swift run --package-path BuildTool BuildTool build-library --platform "$PLATFORM" --configuration release
# Builds the LiveObjects example app (LiveObjects/Example) per platform.
# The core SDK's example apps are covered separately by examples.yaml.
check-example-app:
name: Example app, ${{matrix.platform}} (Xcode ${{ matrix.tooling.xcodeVersion }})
runs-on: macos-15
needs: generate-matrices
permissions:
contents: read
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.generate-matrices.outputs.matrix).withPlatform }}
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
with:
persist-credentials: false
submodules: true
- uses: maxim-lobanov/setup-xcode@ed7a3b1fda3918c0306d1b724322adc0b8cc0a90 # v1
with:
xcode-version: ${{ matrix.tooling.xcodeVersion }}
- name: Build example app
env:
PLATFORM: ${{ matrix.platform }}
run: swift run --package-path BuildTool BuildTool build-example-app --platform "$PLATFORM"
# Builds the AblyLiveObjects DocC documentation and uploads a preview
# deployment. The core SDK's (Jazzy) docs are built by docs.yml instead.
check-documentation:
runs-on: macos-15
permissions:
deployments: write
id-token: write
contents: read
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
with:
persist-credentials: false
submodules: true
# This step can be removed once the runners' default version of Xcode is 26.2 or above
- uses: maxim-lobanov/setup-xcode@ed7a3b1fda3918c0306d1b724322adc0b8cc0a90 # v1
with:
xcode-version: 26.2
# Dry run upload-action to get base-path url
- name: Dry-Run Upload (to get url)
id: preupload
uses: ably/sdk-upload-action@4e694297f208b72b5a9f6b1248a1556f19f821d6 # v2
with:
mode: preempt
sourcePath: LiveObjects/AblyLiveObjects.doccarchive
githubToken: ${{ secrets.GITHUB_TOKEN }}
artifactName: AblyLiveObjects
# Build the documentation using xcodebuild's built-in DocC support and
# transform it for static hosting. (The standalone plugin repo used the
# swift-docc-plugin package plugin instead; we deliberately avoid that
# here because it would have to be a dependency of the root manifest,
# where ably-cocoa's consumers would resolve it.)
- name: Build documentation
env:
HOSTING_BASE_PATH: ${{ steps.preupload.outputs.base-path }}
run: |
xcodebuild docbuild -scheme AblyLiveObjects -destination generic/platform=macOS -derivedDataPath DerivedData
$(xcrun --find docc) process-archive transform-for-static-hosting \
"$(find DerivedData -name AblyLiveObjects.doccarchive -print -quit)" \
--output-path AblyLiveObjects.doccarchive \
--hosting-base-path "$HOSTING_BASE_PATH"
# Configure AWS credentials for uploading documentation
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@7474bc4690e29a8392af63c5b98e7449536d5c3a # v4
with:
aws-region: eu-west-2
role-to-assume: arn:aws:iam::${{ secrets.ABLY_AWS_ACCOUNT_ID_SDK }}:role/ably-sdk-builds-ably-pubsub-cocoa
role-session-name: "${{ github.run_id }}-${{ github.run_number }}"
# Upload the generated documentation
- name: Upload Documentation
uses: ably/sdk-upload-action@4e694297f208b72b5a9f6b1248a1556f19f821d6 # v2
with:
sourcePath: LiveObjects/AblyLiveObjects.doccarchive
githubToken: ${{ secrets.GITHUB_TOKEN }}
artifactName: AblyLiveObjects
landingPagePath: documentation/ablyliveobjects
# We use this job as a marker that all of the required checks have completed.
# This allows us to configure a single required status check in our branch
# protection rules instead of having to type loads of different check names
# into the branch protection web UI (and keep this list up to date as we
# tweak the matrices).
all-checks-completed:
runs-on: ubuntu-latest
permissions: {}
needs:
- lint
- build-and-test-spm
- build-release-configuration-spm
- build-and-test-xcode
- build-release-configuration-xcode
- check-example-app
- check-documentation
- code-coverage
steps:
- name: No-op
# Override the workflow-wide default working directory: this job runs
# without a checkout, so the LiveObjects directory does not exist.
working-directory: .
run: "true"