forked from apple/swift-nio
-
Notifications
You must be signed in to change notification settings - Fork 0
372 lines (359 loc) · 20.2 KB
/
macos_tests.yml
File metadata and controls
372 lines (359 loc) · 20.2 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
name: macOS tests
on:
workflow_call:
inputs:
xcode_15_4_enabled:
type: boolean
description: "⚠️ Jobs with this version of Xcode are deprecated."
default: false
xcode_15_4_test_arguments_override:
type: string
description: "⚠️ Deprecated."
default: ""
xcode_16_0_enabled:
type: boolean
description: "Boolean to enable the Xcode version 16.0 jobs. Defaults to false."
default: false
xcode_16_0_build_arguments_override:
type: string
description: "The arguments passed to swift build in the macOS 5.10 Swift version matrix job."
default: ""
xcode_16_0_test_arguments_override:
type: string
description: "The arguments passed to swift test in the macOS 5.10 Swift version matrix job."
default: ""
xcode_16_0_setup_command:
type: string
description: "The command(s) to be executed before all other work."
default: ""
xcode_16_1_enabled:
type: boolean
description: "Boolean to enable the Xcode version 16.1 jobs. Defaults to false."
default: false
xcode_16_1_build_arguments_override:
type: string
description: "The arguments passed to swift build in the Xcode version 16.1 job."
default: ""
xcode_16_1_test_arguments_override:
type: string
description: "The arguments passed to swift test in the Xcode version 16.1 job."
default: ""
xcode_16_1_setup_command:
type: string
description: "The command(s) to be executed before all other work."
default: ""
xcode_16_2_enabled:
type: boolean
description: "Boolean to enable the Xcode version 16.2 jobs. Defaults to true."
default: true
xcode_16_2_build_arguments_override:
type: string
description: "The arguments passed to swift build in the Xcode version 16.2 job."
default: ""
xcode_16_2_test_arguments_override:
type: string
description: "The arguments passed to swift test in the Xcode version 16.2 job."
default: ""
xcode_16_2_setup_command:
type: string
description: "The command(s) to be executed before all other work."
default: ""
xcode_16_3_enabled:
type: boolean
description: "Boolean to enable the Xcode version 16.3 jobs. Defaults to true."
default: true
xcode_16_3_build_arguments_override:
type: string
description: "The arguments passed to swift build in the Xcode version 16.3 job."
default: ""
xcode_16_3_test_arguments_override:
type: string
description: "The arguments passed to swift test in the Xcode version 16.3 job."
default: ""
xcode_16_3_setup_command:
type: string
description: "The command(s) to be executed before all other work."
default: ""
xcode_26_beta_enabled:
type: boolean
description: "⚠️ Deprecated."
default: false
xcode_26_beta_1_build_arguments_override:
type: string
description: "⚠️ Deprecated."
default: ""
xcode_26_beta_1_test_arguments_override:
type: string
description: "⚠️ Deprecated."
default: ""
xcode_26_beta_1_setup_command:
type: string
description: "⚠️ Deprecated."
default: ""
xcode_latest_beta_enabled:
type: boolean
description: "Boolean to enable the Xcode beta jobs (uses latest beta if one currently exists). Defaults to true."
default: true
xcode_latest_beta_build_arguments_override:
type: string
description: "The arguments passed to swift build in the Xcode beta job."
default: ""
xcode_latest_beta_test_arguments_override:
type: string
description: "The arguments passed to swift test in the Xcode beta job."
default: ""
xcode_latest_beta_setup_command:
type: string
description: "The command(s) to be executed before all other work."
default: ""
build_scheme:
type: string
description: "The build scheme used in the Xcode builds."
swift_test_enabled:
type: boolean
description: "Boolean to enable test execution with `swift test`. Defaults to true."
default: true
macos_xcode_build_enabled:
type: boolean
description: "Boolean to enable the Xcode build targeting macOS. Defaults to true."
default: true
macos_xcode_test_enabled:
type: boolean
description: "Boolean to enable the Xcode test targeting macOS. Defaults to false."
default: false
ios_xcode_build_enabled:
type: boolean
description: "Boolean to enable the Xcode build targeting iOS. Defaults to true."
default: true
ios_xcode_test_enabled:
type: boolean
description: "Boolean to enable the Xcode test targeting iOS. Defaults to false."
default: false
watchos_xcode_build_enabled:
type: boolean
description: "Boolean to enable the Xcode build targeting watchOS. Defaults to true."
default: true
watchos_xcode_test_enabled:
type: boolean
description: "Boolean to enable the Xcode test targeting watchOS. Defaults to false."
default: false
tvos_xcode_build_enabled:
type: boolean
description: "Boolean to enable the Xcode build targeting tvOS. Defaults to true."
default: true
tvos_xcode_test_enabled:
type: boolean
description: "Boolean to enable the Xcode test targeting tvOS. Defaults to false."
default: false
visionos_xcode_build_enabled:
type: boolean
description: "Boolean to enable the Xcode build targeting visionOS. Defaults to true."
default: true
visionos_xcode_test_enabled:
type: boolean
description: "Boolean to enable the Xcode test targeting visionOS. Defaults to false."
default: false
runner_pool:
type: string
description: "The runner pool which will be requested."
default: "nightly"
jobs:
construct-matrix:
name: Construct Darwin matrix
runs-on: ubuntu-latest
outputs:
darwin-matrix: '${{ steps.generate-matrix.outputs.darwin-matrix }}'
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
persist-credentials: false
- id: generate-matrix
run: |
cat >> "$GITHUB_OUTPUT" << EOM
darwin-matrix=$(
runner_pool="${MATRIX_RUNNER_POOL:="nightly"}"
xcode_15_4_enabled="${MATRIX_MACOS_15_4_ENABLED:=true}"
xcode_15_4_build_arguments_override="${MATRIX_MACOS_15_4_BUILD_ARGUMENTS_OVERRIDE:=""}"
xcode_15_4_test_arguments_override="${MATRIX_MACOS_15_4_TEST_ARGUMENTS_OVERRIDE:=""}"
xcode_15_4_setup_command="${MATRIX_MACOS_15_4_SETUP_COMMAND:=""}"
xcode_16_0_enabled="${MATRIX_MACOS_16_0_ENABLED:=true}"
xcode_16_0_build_arguments_override="${MATRIX_MACOS_16_0_BUILD_ARGUMENTS_OVERRIDE:=""}"
xcode_16_0_test_arguments_override="${MATRIX_MACOS_16_0_TEST_ARGUMENTS_OVERRIDE:=""}"
xcode_16_0_setup_command="${MATRIX_MACOS_16_0_SETUP_COMMAND:=""}"
xcode_16_1_enabled="${MATRIX_MACOS_16_1_ENABLED:=true}"
xcode_16_1_build_arguments_override="${MATRIX_MACOS_16_1_BUILD_ARGUMENTS_OVERRIDE:=""}"
xcode_16_1_test_arguments_override="${MATRIX_MACOS_16_1_TEST_ARGUMENTS_OVERRIDE:=""}"
xcode_16_1_setup_command="${MATRIX_MACOS_16_1_SETUP_COMMAND:=""}"
xcode_16_2_enabled="${MATRIX_MACOS_16_2_ENABLED:=true}"
xcode_16_2_build_arguments_override="${MATRIX_MACOS_16_2_BUILD_ARGUMENTS_OVERRIDE:=""}"
xcode_16_2_test_arguments_override="${MATRIX_MACOS_16_2_TEST_ARGUMENTS_OVERRIDE:=""}"
xcode_16_2_setup_command="${MATRIX_MACOS_16_2_SETUP_COMMAND:=""}"
xcode_16_3_enabled="${MATRIX_MACOS_16_3_ENABLED:=true}"
xcode_16_3_build_arguments_override="${MATRIX_MACOS_16_3_BUILD_ARGUMENTS_OVERRIDE:=""}"
xcode_16_3_test_arguments_override="${MATRIX_MACOS_16_3_TEST_ARGUMENTS_OVERRIDE:=""}"
xcode_16_3_setup_command="${MATRIX_MACOS_16_3_SETUP_COMMAND:=""}"
xcode_latest_beta_enabled="${MATRIX_MACOS_26_BETA_1_ENABLED:=true}" # TODO: remove once no repos use this
xcode_latest_beta_build_arguments_override="${MATRIX_MACOS_26_BETA_1_BUILD_ARGUMENTS_OVERRIDE:=""}" # TODO: remove once no repos use this
xcode_latest_beta_test_arguments_override="${MATRIX_MACOS_26_BETA_1_TEST_ARGUMENTS_OVERRIDE:=""}" # TODO: remove once no repos use this
xcode_latest_beta_setup_command="${MATRIX_MACOS_26_BETA_1_SETUP_COMMAND:=""}" # TODO: remove once no repos use this
xcode_latest_beta_enabled="${MATRIX_MACOS_LATEST_BETA_ENABLED:=true}"
xcode_latest_beta_build_arguments_override="${MATRIX_MACOS_LATEST_BETA_BUILD_ARGUMENTS_OVERRIDE:=""}"
xcode_latest_beta_test_arguments_override="${MATRIX_MACOS_LATEST_BETA_TEST_ARGUMENTS_OVERRIDE:=""}"
xcode_latest_beta_setup_command="${MATRIX_MACOS_LATEST_BETA_SETUP_COMMAND:=""}"
# Create matrix from inputs
matrix='{"config": []}'
if [[ "$xcode_15_4_enabled" == "true" ]]; then
matrix=$(echo "$matrix" | jq -c \
--arg setup_command "$xcode_15_4_setup_command" \
--arg build_arguments_override "$xcode_15_4_build_arguments_override" \
--arg test_arguments_override "$xcode_15_4_test_arguments_override" \
--arg runner_pool "$runner_pool" \
'.config[.config| length] |= . + { "name": "Xcode 15.4", "xcode_version": "15.4", "xcode_app": "Xcode_15.4.app", "setup_command": $setup_command, "build_arguments_override": $build_arguments_override, "test_arguments_override": $test_arguments_override, "os": "sequoia", "arch": "ARM64", "pool": $runner_pool }')
fi
if [[ "$xcode_16_0_enabled" == "true" ]]; then
matrix=$(echo "$matrix" | jq -c \
--arg setup_command "$xcode_16_0_setup_command" \
--arg build_arguments_override "$xcode_16_0_build_arguments_override" \
--arg test_arguments_override "$xcode_16_0_test_arguments_override" \
--arg runner_pool "$runner_pool" \
'.config[.config| length] |= . + { "name": "Xcode 16.0", "xcode_version": "16.0", "xcode_app": "Xcode_16.0.app", "setup_command": $setup_command, "build_arguments_override": $build_arguments_override, "test_arguments_override": $test_arguments_override, "os": "sequoia", "arch": "ARM64", "pool": $runner_pool }')
fi
if [[ "$xcode_16_1_enabled" == "true" ]]; then
matrix=$(echo "$matrix" | jq -c \
--arg setup_command "$xcode_16_1_setup_command" \
--arg build_arguments_override "$xcode_16_1_build_arguments_override" \
--arg test_arguments_override "$xcode_16_1_test_arguments_override" \
--arg runner_pool "$runner_pool" \
'.config[.config| length] |= . + { "name": "Xcode 16.1", "xcode_version": "16.1", "xcode_app": "Xcode_16.1.app", "setup_command": $setup_command, "build_arguments_override": $build_arguments_override, "test_arguments_override": $test_arguments_override, "os": "sequoia", "arch": "ARM64", "pool": $runner_pool }')
fi
if [[ "$xcode_16_2_enabled" == "true" ]]; then
matrix=$(echo "$matrix" | jq -c \
--arg setup_command "$xcode_16_2_setup_command" \
--arg build_arguments_override "$xcode_16_2_build_arguments_override" \
--arg test_arguments_override "$xcode_16_2_test_arguments_override" \
--arg runner_pool "$runner_pool" \
'.config[.config| length] |= . + { "name": "Xcode 16.2", "xcode_version": "16.2", "xcode_app": "Xcode_16.2.app", "setup_command": $setup_command, "build_arguments_override": $build_arguments_override, "test_arguments_override": $test_arguments_override, "os": "sequoia", "arch": "ARM64", "pool": $runner_pool }')
fi
if [[ "$xcode_16_3_enabled" == "true" ]]; then
matrix=$(echo "$matrix" | jq -c \
--arg setup_command "$xcode_16_3_setup_command" \
--arg build_arguments_override "$xcode_16_3_build_arguments_override" \
--arg test_arguments_override "$xcode_16_3_test_arguments_override" \
--arg runner_pool "$runner_pool" \
'.config[.config| length] |= . + { "name": "Xcode 16.3", "xcode_version": "16.3", "xcode_app": "Xcode_16.3.app", "setup_command": $setup_command, "build_arguments_override": $build_arguments_override, "test_arguments_override": $test_arguments_override, "os": "sequoia", "arch": "ARM64", "pool": $runner_pool }')
fi
if [[ "$xcode_latest_beta_enabled" == "true" ]]; then
matrix=$(echo "$matrix" | jq -c \
--arg setup_command "$xcode_latest_beta_setup_command" \
--arg build_arguments_override "$xcode_latest_beta_build_arguments_override" \
--arg test_arguments_override "$xcode_latest_beta_test_arguments_override" \
--arg runner_pool "$runner_pool" \
'.config[.config| length] |= . + { "name": "Xcode latest beta", "xcode_version": "latest beta", "xcode_app": "Xcode-latest.app", "setup_command": $setup_command, "build_arguments_override": $build_arguments_override, "test_arguments_override": $test_arguments_override, "os": "sequoia", "arch": "ARM64", "pool": $runner_pool }')
fi
echo "$matrix" | jq -c
)"
EOM
env:
MATRIX_RUNNER_POOL: ${{ inputs.runner_pool }}
MATRIX_MACOS_15_4_ENABLED: ${{ inputs.xcode_15_4_enabled }}
MATRIX_MACOS_15_4_BUILD_ARGUMENTS_OVERRIDE: ${{ inputs.xcode_15_4_build_arguments_override }}
MATRIX_MACOS_15_4_TEST_ARGUMENTS_OVERRIDE: ${{ inputs.xcode_15_4_test_arguments_override }}
MATRIX_MACOS_15_4_SETUP_COMMAND: ${{ inputs.xcode_15_4_setup_command }}
MATRIX_MACOS_16_0_ENABLED: ${{ inputs.xcode_16_0_enabled }}
MATRIX_MACOS_16_0_BUILD_ARGUMENTS_OVERRIDE: ${{ inputs.xcode_16_0_build_arguments_override }}
MATRIX_MACOS_16_0_TEST_ARGUMENTS_OVERRIDE: ${{ inputs.xcode_16_0_test_arguments_override }}
MATRIX_MACOS_16_0_SETUP_COMMAND: ${{ inputs.xcode_16_0_setup_command }}
MATRIX_MACOS_16_1_ENABLED: ${{ inputs.xcode_16_1_enabled }}
MATRIX_MACOS_16_1_BUILD_ARGUMENTS_OVERRIDE: ${{ inputs.xcode_16_1_build_arguments_override }}
MATRIX_MACOS_16_1_TEST_ARGUMENTS_OVERRIDE: ${{ inputs.xcode_16_1_test_arguments_override }}
MATRIX_MACOS_16_1_SETUP_COMMAND: ${{ inputs.xcode_16_1_setup_command }}
MATRIX_MACOS_16_2_ENABLED: ${{ inputs.xcode_16_2_enabled }}
MATRIX_MACOS_16_2_BUILD_ARGUMENTS_OVERRIDE: ${{ inputs.xcode_16_2_build_arguments_override }}
MATRIX_MACOS_16_2_TEST_ARGUMENTS_OVERRIDE: ${{ inputs.xcode_16_2_test_arguments_override }}
MATRIX_MACOS_16_2_SETUP_COMMAND: ${{ inputs.xcode_16_2_setup_command }}
MATRIX_MACOS_16_3_ENABLED: ${{ inputs.xcode_16_3_enabled }}
MATRIX_MACOS_16_3_BUILD_ARGUMENTS_OVERRIDE: ${{ inputs.xcode_16_3_build_arguments_override }}
MATRIX_MACOS_16_3_TEST_ARGUMENTS_OVERRIDE: ${{ inputs.xcode_16_3_test_arguments_override }}
MATRIX_MACOS_16_3_SETUP_COMMAND: ${{ inputs.xcode_16_3_setup_command }}
MATRIX_MACOS_26_BETA_1_ENABLED: ${{ inputs.xcode_26_beta_1_enabled }}
MATRIX_MACOS_26_BETA_1_BUILD_ARGUMENTS_OVERRIDE: ${{ inputs.xcode_26_beta_1_build_arguments_override }}
MATRIX_MACOS_26_BETA_1_TEST_ARGUMENTS_OVERRIDE: ${{ inputs.xcode_26_beta_1_test_arguments_override }}
MATRIX_MACOS_26_BETA_1_SETUP_COMMAND: ${{ inputs.xcode_26_beta_1_setup_command }}
MATRIX_MACOS_LATEST_BETA_ENABLED: ${{ inputs.xcode_latest_beta_enabled }}
MATRIX_MACOS_LATEST_BETA_BUILD_ARGUMENTS_OVERRIDE: ${{ inputs.xcode_latest_beta_build_arguments_override }}
MATRIX_MACOS_LATEST_BETA_TEST_ARGUMENTS_OVERRIDE: ${{ inputs.xcode_latest_beta_test_arguments_override }}
MATRIX_MACOS_LATEST_BETA_SETUP_COMMAND: ${{ inputs.xcode_latest_beta_setup_command }}
darwin-job:
name: ${{ matrix.config.name }}
needs: construct-matrix
runs-on: [self-hosted, macos, "${{ matrix.config.os }}", "${{ matrix.config.arch }}", "${{ matrix.config.pool }}"]
timeout-minutes: 30
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.construct-matrix.outputs.darwin-matrix) }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
persist-credentials: false
submodules: true
- name: Setup command
if: ${{ matrix.config.setup_command != '' }}
run: bash -c "${{ matrix.config.setup_command }}"
- name: Swift build
run: |
if [ -n "${{ matrix.config.build_arguments_override }}" ]; then
swift build ${{ matrix.config.build_arguments_override }}
else
swift build --build-tests
fi
- name: Swift test
if: 'inputs.swift_test_enabled'
run: |
if [ -n "${{ matrix.config.test_arguments_override }}" ]; then
swift test ${{ matrix.config.test_arguments_override }}
else
swift test
fi
# see `xcodebuild -list` for schemes, `simctl list` for destinations
- name: macOS build
if: '!cancelled() && inputs.macos_xcode_build_enabled'
run: /usr/bin/xcodebuild -quiet -scheme ${BUILD_SCHEME} -destination "generic/platform=macos,variant=macos" build
- name: macOS test
if: '!cancelled() && inputs.macos_xcode_test_enabled'
run: /usr/bin/xcodebuild -quiet -scheme ${BUILD_SCHEME} -destination "name=My Mac,variant=macos" test
- name: macOS Catalyst build
if: '!cancelled() && inputs.macos_xcode_build_enabled'
run: /usr/bin/xcodebuild -quiet -scheme ${BUILD_SCHEME} -destination "generic/platform=macos,variant=Mac Catalyst" build
- name: macOS Catalyst test
if: '!cancelled() && inputs.macos_xcode_test_enabled'
run: /usr/bin/xcodebuild -quiet -scheme ${BUILD_SCHEME} -destination "name=My Mac,variant=Mac Catalyst" test
- name: iOS build
if: '!cancelled() && inputs.ios_xcode_build_enabled'
run: /usr/bin/xcodebuild -quiet -scheme ${BUILD_SCHEME} -destination "generic/platform=ios" build
- name: iOS test
if: '!cancelled() && inputs.ios_xcode_test_enabled'
run: /usr/bin/xcodebuild -quiet -scheme ${BUILD_SCHEME} -destination "name=iPhone 16 Pro" test
- name: watchOS build
if: '!cancelled() && inputs.watchos_xcode_build_enabled'
run: /usr/bin/xcodebuild -quiet -scheme ${BUILD_SCHEME} -destination "generic/platform=watchos" build
- name: watchOS test
if: '!cancelled() && inputs.watchos_xcode_test_enabled'
run: /usr/bin/xcodebuild -quiet -scheme ${BUILD_SCHEME} -destination "name=Apple Watch Series 10 (46mm)" test
- name: tvOS build
if: '!cancelled() && inputs.tvos_xcode_build_enabled'
run: /usr/bin/xcodebuild -quiet -scheme ${BUILD_SCHEME} -destination "generic/platform=tvos" build
- name: tvOS test
if: '!cancelled() && inputs.tvos_xcode_test_enabled'
run: /usr/bin/xcodebuild -quiet -scheme ${BUILD_SCHEME} -destination "name=Apple TV 4K (3rd generation)" test
- name: visionOS build # arm only
if: '!cancelled() && inputs.visionos_xcode_build_enabled'
run: /usr/bin/xcodebuild -quiet -scheme ${BUILD_SCHEME} -destination "generic/platform=visionos" build
- name: visionOS test # arm only
if: '!cancelled() && inputs.visionos_xcode_test_enabled'
run: TARGET_OS=""; if [ "$XCODE_VERSION" = "16.2" ]; then TARGET_OS=",OS=2.3"; fi && /usr/bin/xcodebuild -quiet -scheme ${BUILD_SCHEME} -destination "name=Apple Vision Pro$TARGET_OS" test
env:
XCODE_VERSION: ${{ matrix.config.xcode_version }}
DEVELOPER_DIR: "/Applications/${{ matrix.config.xcode_app }}"
BUILD_SCHEME: ${{ inputs.build_scheme }}