-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
505 lines (503 loc) · 20.2 KB
/
build.yml
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
name: Build
on:
push:
branches:
- '**'
tags-ignore:
- '**'
paths-ignore:
- 'LICENSE'
- '**.md'
pull_request:
release:
types: [created]
workflow_dispatch:
inputs:
test_release:
description: 'Test release?'
required: true
default: 'false'
rebuild_sysroot:
description: 'Force rebuild sysroot?'
required: true
default: 'false'
env:
BUILD_XCODE_PATH: /Applications/Xcode_15.0.app
RUNNER_IMAGE: macos-13
jobs:
configuration:
name: Setup configuration
runs-on: ubuntu-latest
outputs:
runner: ${{ steps.checker.outputs.runners }}
github-runner: ${{ steps.checker.outputs.github-runner }}
steps:
- name: Check for hosted runners
id: checker
shell: bash
env:
IS_SELF_HOSTED_RUNNER: ${{ secrets.IS_SELF_HOSTED_RUNNER || (github.repository_owner == 'utmapp' && 'true') }}
run: |
echo "github-runner='$RUNNER_IMAGE'" >> $GITHUB_OUTPUT
if [ "$IS_SELF_HOSTED_RUNNER" == "true" ]; then
echo "runners=['self-hosted', 'macOS']" >> $GITHUB_OUTPUT
else
echo "runners='$RUNNER_IMAGE'" >> $GITHUB_OUTPUT
fi
build-sysroot:
name: Build Sysroot
runs-on: ${{ fromJSON(needs.configuration.outputs.runner) }}
needs: configuration
strategy:
matrix:
arch: [arm64]
platform: [ios, ios_simulator, ios-tci, macos, visionos, visionos_simulator, visionos-tci]
include:
# x86_64 supported only for macOS and simulators
- arch: x86_64
platform: macos
- arch: x86_64
platform: ios_simulator
- arch: x86_64
platform: visionos_simulator
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: recursive
- name: Setup Xcode
shell: bash
run: |
[[ "$(xcode-select -p)" == "${{ env.BUILD_XCODE_PATH }}"* ]] || sudo xcode-select -s "${{ env.BUILD_XCODE_PATH }}"
- name: Cache Sysroot
id: cache-sysroot
uses: osy/actions-cache@v3
with:
path: sysroot-${{ matrix.platform }}-${{ matrix.arch }}
key: ${{ matrix.platform }}-${{ matrix.arch }}-${{ hashFiles('scripts/build_dependencies.sh') }}-${{ hashFiles('patches/**') }}
upload-chunk-size: 1048576 # 1 MiB
- name: Setup Path
shell: bash
run: |
echo "/usr/local/opt/bison/bin:/opt/homebrew/opt/bison/bin" >> $GITHUB_PATH
- name: Install Requirements
if: (steps.cache-sysroot.outputs.cache-hit != 'true' || github.event.inputs.rebuild_sysroot == 'true') && needs.configuration.outputs.runner == env.RUNNER_IMAGE
run: |
brew uninstall cmake
brew install bison pkg-config gettext glib-utils libgpg-error nasm make meson
pip3 install --user six pyparsing
rm -f /usr/local/lib/pkgconfig/*.pc
- name: Build Sysroot
if: steps.cache-sysroot.outputs.cache-hit != 'true' || github.event.inputs.rebuild_sysroot == 'true'
run: ./scripts/build_dependencies.sh -p ${{ matrix.platform }} -a ${{ matrix.arch }}
env:
NCPU: ${{ matrix.platform == 'ios-tci' && '2' || '0' }} # limit 2 CPU for TCI build due to memory issues, 0 = unlimited for other builds
- name: Compress Sysroot
if: steps.cache-sysroot.outputs.cache-hit != 'true' || github.event_name == 'release' || github.event.inputs.test_release == 'true'
run: tar -acf sysroot.tgz sysroot*
- name: Upload Sysroot
if: steps.cache-sysroot.outputs.cache-hit != 'true' || github.event_name == 'release' || github.event.inputs.test_release == 'true'
uses: actions/upload-artifact@v3
with:
name: Sysroot-${{ matrix.platform }}-${{ matrix.arch }}
path: sysroot.tgz
build-sysroot-universal:
name: Build Sysroot (Universal Mac)
runs-on: ${{ fromJSON(needs.configuration.outputs.github-runner) }}
needs: [configuration, build-sysroot]
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Cache Sysroot (Universal Mac)
id: cache-sysroot-universal
uses: osy/actions-cache@v3
with:
path: sysroot-macOS-arm64_x86_64
key: macos-universal-${{ hashFiles('scripts/build_dependencies.sh', 'scripts/pack_dependencies.sh') }}-${{ hashFiles('patches/**') }}
- name: Cache Sysroot (arm64)
if: steps.cache-sysroot-universal.outputs.cache-hit != 'true'
id: cache-sysroot-arm64
uses: osy/actions-cache@v3
with:
path: sysroot-macos-arm64
key: macos-arm64-${{ hashFiles('scripts/build_dependencies.sh') }}-${{ hashFiles('patches/**') }}
- name: Cache Sysroot (x86_64)
if: steps.cache-sysroot-universal.outputs.cache-hit != 'true'
id: cache-sysroot-x86_64
uses: osy/actions-cache@v3
with:
path: sysroot-macos-x86_64
key: macos-x86_64-${{ hashFiles('scripts/build_dependencies.sh') }}-${{ hashFiles('patches/**') }}
- name: Check Cache
if: steps.cache-sysroot-universal.outputs.cache-hit != 'true' && (steps.cache-sysroot-arm64.outputs.cache-hit != 'true' || steps.cache-sysroot-x86_64.outputs.cache-hit != 'true')
uses: actions/github-script@v6
with:
script: core.setFailed('Cached sysroot not found!')
- name: Pack Universal Sysroot
if: steps.cache-sysroot-universal.outputs.cache-hit != 'true'
run: |
./scripts/pack_dependencies.sh . macos arm64 x86_64
- name: Compress Sysroot
if: steps.cache-sysroot-universal.outputs.cache-hit != 'true' || github.event_name == 'release' || github.event.inputs.test_release == 'true'
run: tar -acf sysroot.tgz sysroot-macOS-arm64_x86_64
- name: Upload Sysroot
if: steps.cache-sysroot-universal.outputs.cache-hit != 'true' || github.event_name == 'release' || github.event.inputs.test_release == 'true'
uses: actions/upload-artifact@v3
with:
name: Sysroot-macos-universal
path: sysroot.tgz
build-utm:
name: Build UTM
runs-on: ${{ fromJSON(needs.configuration.outputs.runner) }}
needs: [configuration, build-sysroot]
strategy:
matrix:
arch: [arm64]
platform: [ios, ios_simulator, ios-tci, macos, visionos, visionos_simulator, visionos-tci]
include:
# x86_64 supported only for macOS and simulators
- arch: x86_64
platform: macos
- arch: x86_64
platform: ios_simulator
- arch: x86_64
platform: visionos_simulator
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: recursive
- name: Cache Sysroot
id: cache-sysroot
uses: osy/actions-cache@v3
with:
path: sysroot-${{ matrix.platform }}-${{ matrix.arch }}
key: ${{ matrix.platform }}-${{ matrix.arch }}-${{ hashFiles('scripts/build_dependencies.sh') }}-${{ hashFiles('patches/**') }}
- name: Check Cache
if: steps.cache-sysroot.outputs.cache-hit != 'true'
uses: actions/github-script@v6
with:
script: core.setFailed('Cached sysroot not found!')
- name: Setup Xcode
shell: bash
run: |
[[ "$(xcode-select -p)" == "${{ env.BUILD_XCODE_PATH }}"* ]] || sudo xcode-select -s "${{ env.BUILD_XCODE_PATH }}"
- name: Build UTM
run: |
./scripts/build_utm.sh -p ${{ matrix.platform }} -a ${{ matrix.arch }} -o UTM
tar -acf UTM.xcarchive.tgz UTM.xcarchive
- name: Upload UTM
uses: actions/upload-artifact@v3
with:
name: UTM-${{ matrix.platform }}-${{ matrix.arch }}
path: UTM.xcarchive.tgz
build-universal:
name: Build UTM (Universal Mac)
runs-on: ${{ fromJSON(needs.configuration.outputs.runner) }}
needs: [configuration, build-sysroot-universal]
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: recursive
- name: Cache Sysroot
id: cache-sysroot
uses: osy/actions-cache@v3
with:
path: sysroot-macOS-arm64_x86_64
key: macos-universal-${{ hashFiles('scripts/build_dependencies.sh', 'scripts/pack_dependencies.sh') }}-${{ hashFiles('patches/**') }}
- name: Check Cache
if: steps.cache-sysroot.outputs.cache-hit != 'true'
uses: actions/github-script@v6
with:
script: core.setFailed('Cached sysroot not found!')
- name: Setup Xcode
shell: bash
run: |
[[ "$(xcode-select -p)" == "${{ env.BUILD_XCODE_PATH }}"* ]] || sudo xcode-select -s "${{ env.BUILD_XCODE_PATH }}"
- name: Build UTM
run: |
./scripts/build_utm.sh -t "$SIGNING_TEAM_ID" -p macos -a "arm64 x86_64" -o UTM
tar -acf UTM.xcarchive.tgz UTM.xcarchive
env:
SIGNING_TEAM_ID: ${{ secrets.SIGNING_TEAM_ID }}
- name: Upload UTM
uses: actions/upload-artifact@v3
with:
name: UTM-macos-universal
path: UTM.xcarchive.tgz
package-ipa:
name: Package (iOS IPA)
runs-on: ${{ fromJSON(needs.configuration.outputs.github-runner) }}
needs: [configuration, build-utm]
if: github.event_name == 'release' || github.event.inputs.test_release == 'true'
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Download Artifact
uses: actions/download-artifact@v3
with:
name: UTM-ios-arm64
- name: Install ldid
run: brew install ldid
- name: Fakesign IPA
run: |
tar -xf UTM.xcarchive.tgz
./scripts/package.sh ipa UTM.xcarchive .
- name: Upload Artifact
if: github.event_name != 'release'
uses: actions/upload-artifact@v3
with:
name: UTM-ipa
path: UTM.ipa
- name: Upload Release Asset
if: github.event_name == 'release'
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: UTM.ipa
asset_name: UTM.ipa
asset_content_type: application/octet-stream
- name: Send Dispatch Event
if: github.event_name == 'release'
continue-on-error: true
uses: peter-evans/repository-dispatch@v1
with:
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
repository: ${{ secrets.DISPATCH_ALTSTORE_REPO_NAME }}
event-type: new-release
package-ipa-se:
name: Package (iOS-TCI IPA)
runs-on: ${{ fromJSON(needs.configuration.outputs.github-runner) }}
needs: [configuration, build-utm]
if: github.event_name == 'release' || github.event.inputs.test_release == 'true'
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Download Artifact
uses: actions/download-artifact@v3
with:
name: UTM-ios-tci-arm64
- name: Install ldid
run: brew install ldid
- name: Fakesign IPA
run: |
tar -xf UTM.xcarchive.tgz
./scripts/package.sh ipa-se UTM.xcarchive .
- name: Upload Artifact
if: github.event_name != 'release'
uses: actions/upload-artifact@v3
with:
name: UTM-SE-ipa
path: UTM SE.ipa
- name: Upload Release Asset
if: github.event_name == 'release'
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: UTM SE.ipa
asset_name: UTM SE.ipa
asset_content_type: application/octet-stream
- name: Send Dispatch Event
if: github.event_name == 'release'
continue-on-error: true
uses: peter-evans/repository-dispatch@v1
with:
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
repository: ${{ secrets.DISPATCH_ALTSTORE_REPO_NAME }}
event-type: new-release
package-hv:
name: Package (iOS HV)
runs-on: ${{ fromJSON(needs.configuration.outputs.github-runner) }}
needs: [configuration, build-utm]
if: github.event_name == 'release' || github.event.inputs.test_release == 'true'
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Download Artifact
uses: actions/download-artifact@v3
with:
name: UTM-ios-arm64
- name: Install ldid
run: brew install ldid
- name: Fakesign IPA
run: |
tar -xf UTM.xcarchive.tgz
./scripts/package.sh ipa-hv UTM.xcarchive .
mv UTM.ipa UTM.HV.ipa
- name: Upload Artifact
if: github.event_name != 'release'
uses: actions/upload-artifact@v3
with:
name: UTM-HV-ipa
path: UTM.HV.ipa
- name: Upload Release Asset
if: github.event_name == 'release'
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: UTM.HV.ipa
asset_name: UTM.HV.ipa
asset_content_type: application/octet-stream
package-deb:
name: Package (iOS DEB)
runs-on: ${{ fromJSON(needs.configuration.outputs.github-runner) }}
needs: [configuration, build-utm]
if: github.event_name == 'release' || github.event.inputs.test_release == 'true'
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Download Artifact
uses: actions/download-artifact@v3
with:
name: UTM-ios-arm64
- name: Install ldid + dpkg
run: brew install ldid dpkg
- name: Fakesign IPA
run: |
tar -xf UTM.xcarchive.tgz
./scripts/package.sh deb UTM.xcarchive .
- name: Upload Artifact
if: github.event_name != 'release'
uses: actions/upload-artifact@v3
with:
name: UTM-deb
path: UTM.deb
- name: Upload Release Asset
if: github.event_name == 'release'
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: UTM.deb
asset_name: UTM.deb
asset_content_type: application/octet-stream
- name: Send Dispatch Event
if: github.event_name == 'release'
continue-on-error: true
uses: peter-evans/repository-dispatch@v1
with:
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
repository: ${{ secrets.DISPATCH_CYDIA_REPO_NAME }}
event-type: new-release
package-mac:
name: Package (macOS)
runs-on: ${{ fromJSON(needs.configuration.outputs.github-runner) }}
needs: [configuration, build-universal]
if: github.event_name == 'release' || github.event.inputs.test_release == 'true'
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Import signing certificate into keychain
uses: apple-actions/import-codesign-certs@v1
with:
p12-file-base64: ${{ secrets.SIGNING_CERTIFICATE_P12_DATA }}
p12-password: ${{ secrets.SIGNING_CERTIFICATE_PASSWORD }}
- name: Install Provisioning Profiles
run: |
mkdir -p ~/Library/MobileDevice/Provisioning\ Profiles
echo $PROFILE_DATA | base64 --decode -o ~/Library/MobileDevice/Provisioning\ Profiles/$PROFILE_UUID.provisionprofile
echo $HELPER_PROFILE_DATA | base64 --decode -o ~/Library/MobileDevice/Provisioning\ Profiles/$HELPER_PROFILE_UUID.provisionprofile
echo $LAUNCHER_PROFILE_DATA | base64 --decode -o ~/Library/MobileDevice/Provisioning\ Profiles/$LAUNCHER_PROFILE_UUID.provisionprofile
env:
PROFILE_DATA: ${{ secrets.PROFILE_DATA }}
PROFILE_UUID: ${{ secrets.PROFILE_UUID }}
HELPER_PROFILE_DATA: ${{ secrets.HELPER_PROFILE_DATA }}
HELPER_PROFILE_UUID: ${{ secrets.HELPER_PROFILE_UUID }}
LAUNCHER_PROFILE_DATA: ${{ secrets.LAUNCHER_PROFILE_DATA }}
LAUNCHER_PROFILE_UUID: ${{ secrets.LAUNCHER_PROFILE_UUID }}
- name: Install appdmg
run: npm install -g appdmg
- name: Download Artifact
uses: actions/download-artifact@v3
with:
name: UTM-macos-universal
- name: Package for Release
run: |
tar -xf UTM.xcarchive.tgz
./scripts/package_mac.sh developer-id UTM.xcarchive . "$SIGNING_TEAM_ID" "$PROFILE_UUID" "$HELPER_PROFILE_UUID" "$LAUNCHER_PROFILE_UUID"
env:
SIGNING_TEAM_ID: ${{ secrets.SIGNING_TEAM_ID }}
PROFILE_UUID: ${{ secrets.PROFILE_UUID }}
HELPER_PROFILE_UUID: ${{ secrets.HELPER_PROFILE_UUID }}
LAUNCHER_PROFILE_UUID: ${{ secrets.LAUNCHER_PROFILE_UUID }}
- name: Notarize app
run: npx notarize-cli --file "UTM.dmg" --bundle-id "com.utmapp.UTM"
env:
NOTARIZE_USERNAME: ${{ secrets.SIGNING_USERNAME }}
NOTARIZE_PASSWORD: ${{ secrets.SIGNING_PASSWORD }}
- name: Upload Artifact
if: github.event_name != 'release'
uses: actions/upload-artifact@v3
with:
name: UTM-dmg
path: UTM.dmg
- name: Upload Release Asset
if: github.event_name == 'release'
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: UTM.dmg
asset_name: UTM.dmg
asset_content_type: application/octet-stream
submit-mac:
name: Submit (macOS)
runs-on: ${{ fromJSON(needs.configuration.outputs.github-runner) }}
needs: [configuration, build-universal]
if: github.event_name == 'release' || github.event.inputs.test_release == 'true'
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Import signing certificate into keychain
uses: apple-actions/import-codesign-certs@v1
with:
p12-file-base64: ${{ secrets.SIGNING_CERTIFICATE_P12_DATA }}
p12-password: ${{ secrets.SIGNING_CERTIFICATE_PASSWORD }}
- name: Install Provisioning Profiles
run: |
mkdir -p ~/Library/MobileDevice/Provisioning\ Profiles
echo $PROFILE_DATA | base64 --decode -o ~/Library/MobileDevice/Provisioning\ Profiles/$PROFILE_UUID.provisionprofile
echo $HELPER_PROFILE_DATA | base64 --decode -o ~/Library/MobileDevice/Provisioning\ Profiles/$HELPER_PROFILE_UUID.provisionprofile
echo $LAUNCHER_PROFILE_DATA | base64 --decode -o ~/Library/MobileDevice/Provisioning\ Profiles/$LAUNCHER_PROFILE_UUID.provisionprofile
env:
PROFILE_DATA: ${{ secrets.APP_STORE_PROFILE_DATA }}
PROFILE_UUID: ${{ secrets.APP_STORE_PROFILE_UUID }}
HELPER_PROFILE_DATA: ${{ secrets.APP_STORE_HELPER_PROFILE_DATA }}
HELPER_PROFILE_UUID: ${{ secrets.APP_STORE_HELPER_PROFILE_UUID }}
LAUNCHER_PROFILE_DATA: ${{ secrets.APP_STORE_LAUNCHER_PROFILE_DATA }}
LAUNCHER_PROFILE_UUID: ${{ secrets.APP_STORE_LAUNCHER_PROFILE_UUID }}
- name: Download Artifact
uses: actions/download-artifact@v3
with:
name: UTM-macos-universal
- name: Package for App Store
run: |
tar -xf UTM.xcarchive.tgz
./scripts/package_mac.sh app-store UTM.xcarchive . "$SIGNING_TEAM_ID" "$PROFILE_UUID" "$HELPER_PROFILE_UUID" "$LAUNCHER_PROFILE_UUID"
env:
SIGNING_TEAM_ID: ${{ secrets.SIGNING_TEAM_ID }}
PROFILE_UUID: ${{ secrets.APP_STORE_PROFILE_UUID }}
HELPER_PROFILE_UUID: ${{ secrets.APP_STORE_HELPER_PROFILE_UUID }}
LAUNCHER_PROFILE_UUID: ${{ secrets.APP_STORE_LAUNCHER_PROFILE_UUID }}
- name: Upload Artifact
if: github.event_name != 'release'
uses: actions/upload-artifact@v3
with:
name: UTM-pkg
path: UTM.pkg
- name: Upload app to App Store Connect
if: github.event_name == 'release'
run: |
xcrun altool --upload-app -t macos -f "UTM.pkg" -u "$SUBMIT_USERNAME" -p "$SUBMIT_PASSWORD"
env:
SUBMIT_USERNAME: ${{ secrets.SIGNING_USERNAME }}
SUBMIT_PASSWORD: ${{ secrets.SIGNING_PASSWORD }}