-
-
Notifications
You must be signed in to change notification settings - Fork 120
418 lines (371 loc) · 16.9 KB
/
Copy pathbuild-project.yaml
File metadata and controls
418 lines (371 loc) · 16.9 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
name: Build Project
on:
workflow_call:
outputs:
pluginName:
description: 'Project name detected by parsing build spec file'
value: ${{ jobs.check-event.outputs.pluginName }}
jobs:
check-event:
name: Check GitHub Event Data 🔎
runs-on: ubuntu-22.04
defaults:
run:
shell: bash
outputs:
package: ${{ steps.setup.outputs.package }}
codesign: ${{ steps.setup.outputs.codesign }}
notarize: ${{ steps.setup.outputs.notarize }}
config: ${{ steps.setup.outputs.config }}
commitHash: ${{ steps.setup.outputs.commitHash }}
pluginName: ${{ steps.setup.outputs.pluginName }}
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Check Event Data ☑️
id: setup
env:
GH_TOKEN: ${{ github.token }}
run: |
: Check Event Data ☑️
if [[ "${RUNNER_DEBUG}" ]]; then set -x; fi
case "${GITHUB_EVENT_NAME}" in
pull_request)
config_data=('codesign:false' 'notarize:false' 'package:false' 'config:RelWithDebInfo')
if gh pr view ${{ github.event.number }} --json labels \
| jq -e -r '.labels[] | select(.name == "Seeking Testers")' > /dev/null; then
config_data[0]='codesign:true'
config_data[2]='package:true'
fi
;;
push)
config_data=('codesign:true' 'notarize:false' 'package:true' 'config:RelWithDebInfo')
if [[ ${GITHUB_REF_NAME} =~ [0-9]+.[0-9]+.[0-9]+(-(rc|beta).+)? ]]; then
config_data[1]='notarize:true'
config_data[3]='config:Release'
fi
;;
workflow_dispatch)
config_data=('codesign:true' 'notarize:false' 'package:false' 'config:RelWithDebInfo')
;;
schedule)
config_data=('codesign:true' 'notarize:false' 'package:true' 'config:RelWithDebInfo')
;;
*) ;;
esac
for config in "${config_data[@]}"; do
IFS=':' read -r key value <<< "${config}"
echo "${key}=${value}" >> $GITHUB_OUTPUT
done
echo "commitHash=${GITHUB_SHA:0:9}" >> $GITHUB_OUTPUT
plugin_name="$(grep 'name' buildspec.json | sed -E -e 's/^.+"name":[^"]+"(.+)",?$/\1/g')"
plugin_display_name="$(grep 'displayName' buildspec.json | sed -E -e 's/^.+"displayName":[^"]+"(.+)",?$/\1/g' || echo "")"
if [[ "${plugin_display_name}" ]]; then
echo "pluginName=${plugin_display_name}" >> $GITHUB_OUTPUT
else
echo "pluginName=${plugin_name}" >> $GITHUB_OUTPUT
fi
macos-build:
name: Build for macOS 🍏
runs-on: macos-15
needs: check-event
strategy:
matrix:
architecture: [x86_64, arm64]
macos_version: [12, 13, 14, 15, embedded]
defaults:
run:
shell: zsh --no-rcs --errexit --pipefail {0}
steps:
- uses: actions/checkout@v6
with:
submodules: recursive
fetch-depth: 0
- name: Set Up Environment 🔧
id: setup
run: |
: Set Up Environment 🔧
if (( ${+RUNNER_DEBUG} )) setopt XTRACE
print '::group::Clean Homebrew Environment'
local -a to_remove=()
if (( #to_remove )) brew uninstall --ignore-dependencies ${to_remove}
print '::endgroup::'
local product_name
local product_version
read -r product_name product_version <<< \
"$(jq -r '. | {name, version} | join(" ")' buildspec.json)"
print "pluginName=${product_name}" >> $GITHUB_OUTPUT
print "pluginVersion=${product_version}" >> $GITHUB_OUTPUT
- uses: maxim-lobanov/setup-xcode@v1.7.0
id: set-xcode-version
with:
xcode-version: 16.2
- uses: actions/cache@v5
id: ccache-cache
with:
path: ${{ github.workspace }}/.ccache
key: ${{ runner.os }}-ccache-${{ needs.check-event.outputs.config }}-${{ matrix.architecture }}
restore-keys: |
${{ runner.os }}-ccache-${{ matrix.architecture }}-
- uses: actions/cache@v5
id: icu-cache
with:
path: |
${{ github.workspace }}/build_macos/ICU_build-prefix/bin
${{ github.workspace }}/build_macos/ICU_build-prefix/include
${{ github.workspace }}/build_macos/ICU_build-prefix/lib
${{ github.workspace }}/build_macos/ICU_build-prefix/sbin
${{ github.workspace }}/build_macos/ICU_build-prefix/share
${{ github.workspace }}/build_macos/ICU_build-prefix/tmp
key: ${{ runner.os }}-icu-build-${{ needs.check-event.outputs.config }}-${{ matrix.architecture }}
restore-keys: |
${{ runner.os }}-icu-build-${{ matrix.architecture }}-
- uses: actions-rust-lang/setup-rust-toolchain@v1
if: matrix.architecture == 'arm64'
with:
target: aarch64-apple-darwin
- uses: actions-rust-lang/setup-rust-toolchain@v1
if: matrix.architecture == 'x86_64'
with:
target: x86_64-apple-darwin
- name: Set Up Codesigning 🔑
uses: ./.github/actions/setup-macos-codesigning
if: fromJSON(needs.check-event.outputs.codesign)
id: codesign
with:
codesignIdentity: ${{ secrets.MACOS_SIGNING_APPLICATION_IDENTITY }}
installerIdentity: ${{ secrets.MACOS_SIGNING_INSTALLER_IDENTITY }}
codesignCertificate: ${{ secrets.MACOS_SIGNING_CERT }}
certificatePassword: ${{ secrets.MACOS_SIGNING_CERT_PASSWORD }}
keychainPassword: ${{ secrets.MACOS_KEYCHAIN_PASSWORD }}
provisioningProfile: ${{ secrets.MACOS_SIGNING_PROVISIONING_PROFILE }}
notarizationUser: ${{ secrets.MACOS_NOTARIZATION_USERNAME }}
notarizationPassword: ${{ secrets.MACOS_NOTARIZATION_PASSWORD }}
- name: Build Plugin 🧱
uses: ./.github/actions/build-plugin
with:
target: macos-${{ matrix.architecture }}
config: ${{ needs.check-event.outputs.config }}
macos_version: ${{ matrix.macos_version }}
codesign: ${{ fromJSON(needs.check-event.outputs.codesign) }}
codesignIdent: ${{ steps.codesign.outputs.codesignIdent }}
env:
MACOS_ARCH: ${{ matrix.architecture }}
GITHUB_WORKSPACE: ${{ github.workspace }}
- name: Package Plugin 📀
id: package_plugin
uses: ./.github/actions/package-plugin
with:
target: macos-${{ matrix.architecture }}
config: ${{ needs.check-event.outputs.config }}
macos_version: ${{ matrix.macos_version }}
package: ${{ fromJSON(needs.check-event.outputs.package) }}
codesign: ${{ fromJSON(needs.check-event.outputs.codesign) && fromJSON(steps.codesign.outputs.haveCodesignIdent) }}
codesignIdent: ${{ steps.codesign.outputs.codesignIdent }}
installerIdent: ${{ steps.codesign.outputs.installerIdent }}
codesignTeam: ${{ steps.codesign.outputs.codesignTeam }}
notarize: ${{ fromJSON(needs.check-event.outputs.notarize) && fromJSON(steps.codesign.outputs.haveNotarizationUser) }}
codesignUser: ${{ secrets.MACOS_NOTARIZATION_USERNAME }}
codesignPass: ${{ secrets.MACOS_NOTARIZATION_PASSWORD }}
env:
MACOS_ARCH: ${{ matrix.architecture }}
- name: Upload Notarization Failure Artifacts 📡
uses: actions/upload-artifact@v7
if: failure() && steps.package_plugin.outcome == 'failure'
with:
name: ${{ steps.setup.outputs.pluginName }}-${{ steps.setup.outputs.pluginVersion }}-macos-${{ matrix.macos_version }}-${{ matrix.architecture }}-${{ needs.check-event.outputs.commitHash }}-notarization-log
path: ${{ github.workspace }}/notarytool_log_*.json
- name: Upload Artifacts 📡
uses: actions/upload-artifact@v7
if: steps.package_plugin.outcome == 'success'
with:
name: ${{ steps.setup.outputs.pluginName }}-${{ steps.setup.outputs.pluginVersion }}-macos-${{ matrix.macos_version }}-${{ matrix.architecture }}-${{ needs.check-event.outputs.commitHash }}
path: ${{ github.workspace }}/release/${{ steps.setup.outputs.pluginName }}-${{ steps.setup.outputs.pluginVersion }}-macos-${{ matrix.macos_version }}-${{ matrix.architecture }}.*
- name: Upload Debug Symbol Artifacts 🪲
uses: actions/upload-artifact@v7
if: ${{ needs.check-event.outputs.config == 'Release' && steps.package_plugin.outcome == 'success' }}
with:
name: ${{ steps.setup.outputs.pluginName }}-${{ steps.setup.outputs.pluginVersion }}-macos-${{ matrix.macos_version }}-${{ matrix.architecture }}-${{ needs.check-event.outputs.commitHash }}-dSYMs
path: ${{ github.workspace }}/release/${{ steps.setup.outputs.pluginName }}-${{ steps.setup.outputs.pluginVersion }}-macos-${{ matrix.macos_version }}-${{ matrix.architecture }}-dSYMs.*
ubuntu-build:
name: Build for Ubuntu 🐧
runs-on: ubuntu-22.04
needs: check-event
strategy:
matrix:
acceleration: [generic, nvidia, amd]
defaults:
run:
shell: bash
env:
CI: 1
steps:
- name: Free Disk Space (Ubuntu)
if: ${{ matrix.acceleration == 'amd' || matrix.acceleration == 'nvidia' }}
uses: jlumbroso/free-disk-space@main
with:
# this might remove tools that are actually needed,
# if set to "true" but frees about 6 GB
tool-cache: false
# Needs to be false to prevent running out of memory
swap-storage: false
# large-packages takes a long time so don't remove them unless we need to
large-packages: false
android: true
dotnet: true
haskell: true
docker-images: true
- uses: actions/checkout@v6
with:
submodules: recursive
fetch-depth: 0
- name: "Setup additional apt repos, keys and pre-requisites"
run: |
wget -qO- https://packages.lunarg.com/lunarg-signing-key-pub.asc | sudo tee /etc/apt/trusted.gpg.d/lunarg.asc
sudo wget -qO /etc/apt/sources.list.d/lunarg-vulkan-jammy.list http://packages.lunarg.com/vulkan/lunarg-vulkan-jammy.list
sudo apt update
- uses: awalsh128/cache-apt-pkgs-action@v1.6.0
with:
packages: |
ccache
libcurl4-openssl-dev
libicu-dev
libgles2-mesa-dev
libopenblas0
libopenblas0-openmp
libopenblas0-pthread
libopenblas-dev
libopenblas-openmp-dev
libqt6svg6-dev
libsimde-dev
nvidia-opencl-dev
obs-studio
ocl-icd-opencl-dev
pkg-config
python3-setuptools
python3-wheel
qt6-base-dev
qt6-base-private-dev
vulkan-sdk
add-repository: ppa:obsproject/obs-studio
version: 1.0
execute_install_scripts: true
- name: Set Up Environment 🔧
id: setup
run: |
: Set Up Environment 🔧
if [[ "${RUNNER_DEBUG}" ]]; then set -x; fi
read -r product_name product_version <<< \
"$(jq -r '. | {name, version} | join(" ")' buildspec.json)"
echo "pluginName=${product_name}" >> $GITHUB_OUTPUT
echo "pluginVersion=${product_version}" >> $GITHUB_OUTPUT
- uses: actions-rust-lang/setup-rust-toolchain@v1
# CUDA toolkit needed for linking against so it can be found when looking up package dependencies
- name: "Install CUDA toolkit 12.8"
if: ${{ matrix.acceleration == 'nvidia' }}
run: |
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/cuda-keyring_1.1-1_all.deb
sudo dpkg -i cuda-keyring_1.1-1_all.deb
sudo apt update
sudo apt -y install cuda-12-8
export PATH=/usr/local/cuda-12.8/bin${PATH:+:${PATH}}
export LD_LIBRARY_PATH=/usr/local/cuda-12.8/lib ${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
# hip SDK needed for linking against so it can be found when looking up package dependencies
- name: "Install AMD hip SDK v6.4.2"
if: ${{ matrix.acceleration == 'amd' }}
run: |
wget https://repo.radeon.com/amdgpu-install/6.4.2/ubuntu/jammy/amdgpu-install_6.4.60402-1_all.deb
sudo apt install ./amdgpu-install_6.4.60402-1_all.deb
sudo apt update
sudo apt install python3-setuptools python3-wheel
sudo usermod -a -G render,video $LOGNAME # Add the current user to the render and video groups
sudo apt install rocm
sudo apt update && sudo apt install hipblas
- uses: actions/cache@v5
id: ccache-cache
with:
path: ${{ github.workspace }}/.ccache
key: ${{ runner.os }}-ccache-x86_64-${{ needs.check-event.outputs.config }}
restore-keys: |
${{ runner.os }}-ccache-x86_64-
- name: Set up Homebrew 🍺
uses: Homebrew/actions/setup-homebrew@master
- name: Build Plugin 🧱
uses: ./.github/actions/build-plugin
with:
CI: 1
target: x86_64
config: ${{ needs.check-event.outputs.config }}
acceleration: ${{ matrix.acceleration }}
- name: Package Plugin 📀
uses: ./.github/actions/package-plugin
with:
CI: 1
package: ${{ fromJSON(needs.check-event.outputs.package) }}
target: x86_64
config: ${{ needs.check-event.outputs.config }}
acceleration: ${{ matrix.acceleration }}
- name: Upload Source Tarball 🗜️
uses: actions/upload-artifact@v7
if: ${{ matrix.acceleration == 'generic' }}
with:
name: ${{ steps.setup.outputs.pluginName }}-${{ steps.setup.outputs.pluginVersion }}-sources-${{ needs.check-event.outputs.commitHash }}
path: ${{ github.workspace }}/release/${{ steps.setup.outputs.pluginName }}-${{ steps.setup.outputs.pluginVersion }}-source.*
- name: Upload Artifacts 📡
uses: actions/upload-artifact@v7
with:
name: ${{ steps.setup.outputs.pluginName }}-${{ steps.setup.outputs.pluginVersion }}-ubuntu-22.04-x86_64-${{ matrix.acceleration }}-${{ needs.check-event.outputs.commitHash }}
path: ${{ github.workspace }}/release/${{ steps.setup.outputs.pluginName }}-${{ steps.setup.outputs.pluginVersion }}-x86_64-linux-gnu-${{ matrix.acceleration }}*.*
- name: Upload debug symbol artifacts 🪲
uses: actions/upload-artifact@v7
if: ${{ fromJSON(needs.check-event.outputs.package) && (matrix.acceleration != 'amd') }}
with:
name: ${{ steps.setup.outputs.pluginName }}-${{ steps.setup.outputs.pluginVersion }}-ubuntu-22.04-x86_64-${{ matrix.acceleration }}-${{ needs.check-event.outputs.commitHash }}-dbgsym
path: ${{ github.workspace }}/release/${{ steps.setup.outputs.pluginName }}-${{ steps.setup.outputs.pluginVersion }}-x86_64-linux-gnu-${{ matrix.acceleration }}*-dbgsym.ddeb
windows-build:
name: Build for Windows 🪟
runs-on: windows-2022
needs: check-event
strategy:
matrix:
acceleration: [generic, nvidia, amd]
defaults:
run:
shell: pwsh
steps:
- uses: actions/checkout@v6
with:
submodules: recursive
fetch-depth: 0
- name: Set Up Environment 🔧
id: setup
run: |
# Set Up Environment 🔧
if ( $Env:RUNNER_DEBUG -ne $null ) {
Set-PSDebug -Trace 1
}
$BuildSpec = Get-Content -Path buildspec.json -Raw | ConvertFrom-Json
$ProductName = $BuildSpec.name
$ProductVersion = $BuildSpec.version
"pluginName=${ProductName}" >> $env:GITHUB_OUTPUT
"pluginVersion=${ProductVersion}" >> $env:GITHUB_OUTPUT
- uses: actions-rust-lang/setup-rust-toolchain@v1
- name: Build Plugin 🧱
uses: ./.github/actions/build-plugin
with:
target: x64
config: ${{ needs.check-event.outputs.config }}
acceleration: ${{ matrix.acceleration }}
- name: Package Plugin 📀
uses: ./.github/actions/package-plugin
with:
target: x64
config: ${{ needs.check-event.outputs.config }}
package: ${{ fromJSON(needs.check-event.outputs.package) }}
acceleration: ${{ matrix.acceleration }}
- name: Upload Artifacts 📡
uses: actions/upload-artifact@v7
with:
name: ${{ steps.setup.outputs.pluginName }}-${{ steps.setup.outputs.pluginVersion }}-windows-x64-${{ matrix.acceleration }}-${{ needs.check-event.outputs.commitHash }}
path: ${{ github.workspace }}/release/${{ steps.setup.outputs.pluginName }}-${{ steps.setup.outputs.pluginVersion }}-windows-x64*.*