-
-
Notifications
You must be signed in to change notification settings - Fork 13
243 lines (225 loc) · 14.3 KB
/
build.yml
File metadata and controls
243 lines (225 loc) · 14.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
name: build
permissions:
contents: read
on:
push:
branches: [main, dev]
paths-ignore:
- 'Docs/**' # Docs folder in root of repo
- '**/*.md' # .md files anywhere in the repo
- '**/LICENSE' # LICENSE files anywhere in the repo
- '**/.gitignore' # .gitignore files anywhere in the repo
pull_request:
branches: [main]
paths-ignore:
- 'Docs/**' # Docs folder in root of repo
- '**/*.md' # .md files anywhere in the repo
- '**/LICENSE' # LICENSE files anywhere in the repo
- '**/.gitignore' # .gitignore files anywhere in the repo
workflow_dispatch:
schedule:
- cron: '40 11 * * *' # once a day @ 11:40am UTC (4:40am PST)
env:
SCHEME: "OSCKit"
jobs:
macOS:
name: macOS
runs-on: macos-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@main
- uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: latest-stable
- name: Build
run: xcodebuild build -workspace ".swiftpm/xcode/package.xcworkspace" -scheme "$SCHEME" -destination "generic/platform=macOS" | xcbeautify --renderer github-actions && exit ${PIPESTATUS[0]}
- name: Unit Tests
run: xcodebuild test -workspace ".swiftpm/xcode/package.xcworkspace" -scheme "$SCHEME" -destination "platform=macOS" | xcbeautify --renderer github-actions && exit ${PIPESTATUS[0]}
macCatalyst:
name: macCatalyst
runs-on: macos-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@main
- uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: latest-stable
- name: Build
run: xcodebuild build -workspace ".swiftpm/xcode/package.xcworkspace" -scheme "$SCHEME" -destination "generic/platform=macOS,variant=Mac Catalyst" | xcbeautify --renderer github-actions && exit ${PIPESTATUS[0]}
- name: Unit Tests
run: xcodebuild test -workspace ".swiftpm/xcode/package.xcworkspace" -scheme "$SCHEME" -destination "platform=macOS,variant=Mac Catalyst" | xcbeautify --renderer github-actions && exit ${PIPESTATUS[0]}
iOS:
name: iOS
runs-on: macos-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@main
- uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: latest-stable
- name: Bootstrap Platforms
# Workaround for Xcode/GitHub runner issues finding simulators.
# see https://github.com/actions/runner-images/issues/12758#issuecomment-3206748945
run: xcrun simctl list
- name: Download Platform
# Workaround for Xcode/GitHub runner issues finding simulators.
# see https://github.com/actions/runner-images/issues/12758#issuecomment-3206748945
run: xcodebuild -downloadPlatform iOS
- name: Build
run: xcodebuild build -workspace ".swiftpm/xcode/package.xcworkspace" -scheme "$SCHEME" -destination "generic/platform=iOS" | xcbeautify --renderer github-actions && exit ${PIPESTATUS[0]}
- name: Prepare Destination Device Name
id: destnameprep
# As of GitHub's updates to the macOS-15 runner summer 2025, randomly Xcode may not list any simulators.
# No idea why. Seems like a bug or runner config issue. So to prevent false-positive job failures, we'll skip
# the unit tests if no devices are found, but mark the unit test step as cancelled. The job is still marked as
# passed (green), but the Unit Tests step will show cancelled. This is the best we can do, as there appears to
# be no way to "cancel" an individual job programmatically.
continue-on-error: true
shell: bash
run: |
xcodebuild -showdestinations -workspace ".swiftpm/xcode/package.xcworkspace" -scheme "$SCHEME" > destinations.txt
SIMPLATFORM="iOS"
SIMDEVICE="iPhone\s\d{2}\s"
REGEX="m/\{\splatform:(.*\sSimulator),.*OS:(\d{1,2}\.\d),.*name:([a-zA-Z0-9\(\)\s]*)\s\}/g"
SIMPATFORMLIST=$(cat destinations.txt | perl -nle 'if ('$REGEX') { ($plat, $os, $name) = ($1, $2, $3); if ($plat =~ /'$SIMPLATFORM'/ and $name =~ /'$SIMDEVICE'/) { print "- ${name} (${plat}) (${os})"; } }')
if [[ -z $SIMPATFORMLIST ]]; then echo "Error: no matching simulators available."; exit 1; fi
echo "Available $SIMPLATFORM simulators:"
echo "$SIMPATFORMLIST"
DESTNAME=$(cat destinations.txt | perl -nle 'if ('$REGEX') { ($plat, $os, $name) = ($1, $2, $3); if ($plat =~ /'$SIMPLATFORM'/ and $name =~ /'$SIMDEVICE'/) { print $name; } }' | sort -rV | head -n 1)
if [[ -z $DESTNAME ]]; then echo "Error: no matching simulators available."; exit 1; fi
echo "Using device name \"$DESTNAME\""
echo "DESTNAME=$DESTNAME" >> "$GITHUB_ENV"
- name: Unit Tests
if: steps.destnameprep.outcome != 'failure'
run: xcodebuild test -workspace ".swiftpm/xcode/package.xcworkspace" -scheme "$SCHEME" -destination "platform=iOS Simulator,name=$DESTNAME" | xcbeautify --renderer github-actions && exit ${PIPESTATUS[0]}
tvOS:
name: tvOS
runs-on: macos-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@main
- uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: latest-stable
- name: Bootstrap Platforms
# Workaround for Xcode/GitHub runner issues finding simulators.
# see https://github.com/actions/runner-images/issues/12758#issuecomment-3206748945
run: xcrun simctl list
- name: Download Platform
# Workaround for Xcode/GitHub runner issues finding simulators.
# see https://github.com/actions/runner-images/issues/12758#issuecomment-3206748945
run: xcodebuild -downloadPlatform tvOS
- name: Build
run: xcodebuild build -workspace ".swiftpm/xcode/package.xcworkspace" -scheme "$SCHEME" -destination "generic/platform=tvOS" | xcbeautify --renderer github-actions && exit ${PIPESTATUS[0]}
- name: Prepare Destination Device Name
id: destnameprep
# As of GitHub's updates to the macOS-15 runner summer 2025, randomly Xcode may not list any simulators.
# No idea why. Seems like a bug or runner config issue. So to prevent false-positive job failures, we'll skip
# the unit tests if no devices are found, but mark the unit test step as cancelled. The job is still marked as
# passed (green), but the Unit Tests step will show cancelled. This is the best we can do, as there appears to
# be no way to "cancel" an individual job programmatically.
continue-on-error: true
shell: bash
run: |
xcodebuild -showdestinations -workspace ".swiftpm/xcode/package.xcworkspace" -scheme "$SCHEME" > destinations.txt
SIMPLATFORM="tvOS"
SIMDEVICE="Apple\sTV"
REGEX="m/\{\splatform:(.*\sSimulator),.*OS:(\d{1,2}\.\d),.*name:([a-zA-Z0-9\(\)\s]*)\s\}/g"
SIMPATFORMLIST=$(cat destinations.txt | perl -nle 'if ('$REGEX') { ($plat, $os, $name) = ($1, $2, $3); if ($plat =~ /'$SIMPLATFORM'/ and $name =~ /'$SIMDEVICE'/) { print "- ${name} (${plat}) (${os})"; } }')
if [[ -z $SIMPATFORMLIST ]]; then echo "Error: no matching simulators available."; exit 1; fi
echo "Available $SIMPLATFORM simulators:"
echo "$SIMPATFORMLIST"
DESTNAME=$(cat destinations.txt | perl -nle 'if ('$REGEX') { ($plat, $os, $name) = ($1, $2, $3); if ($plat =~ /'$SIMPLATFORM'/ and $name =~ /'$SIMDEVICE'/) { print $name; } }' | sort -rV | head -n 1)
if [[ -z $DESTNAME ]]; then echo "Error: no matching simulators available."; exit 1; fi
echo "Using device name \"$DESTNAME\""
echo "DESTNAME=$DESTNAME" >> "$GITHUB_ENV"
- name: Unit Tests
if: steps.destnameprep.outcome != 'failure'
run: xcodebuild test -workspace ".swiftpm/xcode/package.xcworkspace" -scheme "$SCHEME" -destination "platform=tvOS Simulator,name=$DESTNAME" | xcbeautify --renderer github-actions && exit ${PIPESTATUS[0]}
watchOS:
name: watchOS
runs-on: macos-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@main
- uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: latest-stable
- name: Bootstrap Platforms
# Workaround for Xcode/GitHub runner issues finding simulators.
# see https://github.com/actions/runner-images/issues/12758#issuecomment-3206748945
run: xcrun simctl list
- name: Download Platform
# Workaround for Xcode/GitHub runner issues finding simulators.
# see https://github.com/actions/runner-images/issues/12758#issuecomment-3206748945
run: xcodebuild -downloadPlatform watchOS
- name: Build
run: xcodebuild build -workspace ".swiftpm/xcode/package.xcworkspace" -scheme "$SCHEME" -destination "generic/platform=watchOS" | xcbeautify --renderer github-actions && exit ${PIPESTATUS[0]}
- name: Prepare Destination Device Name
id: destnameprep
# As of GitHub's updates to the macOS-15 runner summer 2025, randomly Xcode may not list any simulators.
# No idea why. Seems like a bug or runner config issue. So to prevent false-positive job failures, we'll skip
# the unit tests if no devices are found, but mark the unit test step as cancelled. The job is still marked as
# passed (green), but the Unit Tests step will show cancelled. This is the best we can do, as there appears to
# be no way to "cancel" an individual job programmatically.
continue-on-error: true
shell: bash
run: |
xcodebuild -showdestinations -workspace ".swiftpm/xcode/package.xcworkspace" -scheme "$SCHEME" > destinations.txt
SIMPLATFORM="watchOS"
SIMDEVICE="Apple\sWatch\sSeries"
REGEX="m/\{\splatform:(.*\sSimulator),.*OS:(\d{1,2}\.\d),.*name:([a-zA-Z0-9\(\)\s]*)\s\}/g"
SIMPATFORMLIST=$(cat destinations.txt | perl -nle 'if ('$REGEX') { ($plat, $os, $name) = ($1, $2, $3); if ($plat =~ /'$SIMPLATFORM'/ and $name =~ /'$SIMDEVICE'/) { print "- ${name} (${plat}) (${os})"; } }')
if [[ -z $SIMPATFORMLIST ]]; then echo "Error: no matching simulators available."; exit 1; fi
echo "Available $SIMPLATFORM simulators:"
echo "$SIMPATFORMLIST"
DESTNAME=$(cat destinations.txt | perl -nle 'if ('$REGEX') { ($plat, $os, $name) = ($1, $2, $3); if ($plat =~ /'$SIMPLATFORM'/ and $name =~ /'$SIMDEVICE'/) { print $name; } }' | sort -rV | head -n 1)
if [[ -z $DESTNAME ]]; then echo "Error: no matching simulators available."; exit 1; fi
echo "Using device name \"$DESTNAME\""
echo "DESTNAME=$DESTNAME" >> "$GITHUB_ENV"
- name: Unit Tests
if: steps.destnameprep.outcome != 'failure'
run: xcodebuild test -workspace ".swiftpm/xcode/package.xcworkspace" -scheme "$SCHEME" -destination "platform=watchOS Simulator,name=$DESTNAME" | xcbeautify --renderer github-actions && exit ${PIPESTATUS[0]}
examples:
name: Examples
runs-on: macos-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@main
- uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: latest-stable
- name: Custom Type - Resolve Package Dependencies # needed because sometimes xcodebuild fails otherwise
run: xcodebuild -project "Examples/Custom Type/Custom OSC Type.xcodeproj" -resolvePackageDependencies | xcbeautify --renderer github-actions && exit ${PIPESTATUS[0]}
- name: Custom Type - Build
run: xcodebuild build -project "Examples/Custom Type/Custom OSC Type.xcodeproj" -scheme "Custom OSC Type" -destination "generic/platform=macOS" | xcbeautify --renderer github-actions && exit ${PIPESTATUS[0]}
- name: Method Blocks - Resolve Package Dependencies # needed because sometimes xcodebuild fails otherwise
run: xcodebuild -project "Examples/Method Blocks/OSC Method Blocks.xcodeproj" -resolvePackageDependencies | xcbeautify --renderer github-actions && exit ${PIPESTATUS[0]}
- name: Method Blocks - Build
run: xcodebuild build -project "Examples/Method Blocks/OSC Method Blocks.xcodeproj" -scheme "OSC Method Blocks" -destination "generic/platform=macOS" | xcbeautify --renderer github-actions && exit ${PIPESTATUS[0]}
- name: Method IDs - Resolve Package Dependencies # needed because sometimes xcodebuild fails otherwise
run: xcodebuild -project "Examples/Method IDs/OSC Method IDs.xcodeproj" -resolvePackageDependencies | xcbeautify --renderer github-actions && exit ${PIPESTATUS[0]}
- name: Method IDs - Build
run: xcodebuild build -project "Examples/Method IDs/OSC Method IDs.xcodeproj" -scheme "OSC Method IDs" -destination "generic/platform=macOS" | xcbeautify --renderer github-actions && exit ${PIPESTATUS[0]}
- name: TCP Client and Server - Resolve Package Dependencies # needed because sometimes xcodebuild fails otherwise
run: xcodebuild -project "Examples/TCP Client and Server/OSC TCP Client and Server.xcodeproj" -resolvePackageDependencies | xcbeautify --renderer github-actions && exit ${PIPESTATUS[0]}
- name: TCP Client and Server - Build
run: xcodebuild build -project "Examples/TCP Client and Server/OSC TCP Client and Server.xcodeproj" -scheme "OSC TCP Client and Server" -destination "generic/platform=macOS" | xcbeautify --renderer github-actions && exit ${PIPESTATUS[0]}
- name: UDP Client and Server - Resolve Package Dependencies # needed because sometimes xcodebuild fails otherwise
run: xcodebuild -project "Examples/UDP Client and Server/OSC UDP Client and Server.xcodeproj" -resolvePackageDependencies | xcbeautify --renderer github-actions && exit ${PIPESTATUS[0]}
- name: UDP Client and Server - Build
run: xcodebuild build -project "Examples/UDP Client and Server/OSC UDP Client and Server.xcodeproj" -scheme "OSC UDP Client and Server" -destination "generic/platform=macOS" | xcbeautify --renderer github-actions && exit ${PIPESTATUS[0]}
- name: UDP Socket - Resolve Package Dependencies # needed because sometimes xcodebuild fails otherwise
run: xcodebuild -project "Examples/UDP Socket/OSC UDP Socket.xcodeproj" -resolvePackageDependencies | xcbeautify --renderer github-actions && exit ${PIPESTATUS[0]}
- name: UDP Socket - Build
run: xcodebuild build -project "Examples/UDP Socket/OSC UDP Socket.xcodeproj" -scheme "OSC UDP Socket" -destination "generic/platform=macOS" | xcbeautify --renderer github-actions && exit ${PIPESTATUS[0]}
linux:
name: Linux (OSCKitCore)
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@main
- name: Build
run: swift build
- name: Unit Tests
run: swift test