Repository navigation
406 lines (361 loc) · 13.7 KB
/
Copy pathci-windows.yml
File metadata and controls
406 lines (361 loc) · 13.7 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
---
name: CI-Windows
permissions: {}
on:
workflow_call:
inputs:
# Azure Artifact Signing account name
azure_signing_account:
required: false
type: string
default: ''
# Azure Artifact Signing certificate profile name
azure_signing_cert_profile:
required: false
type: string
default: ''
# Azure Artifact Signing account endpoint
# e.g. https://<region>.codesigning.azure.net
azure_signing_endpoint:
required: false
type: string
default: ''
publish_release:
required: true
type: string
release_commit:
required: true
type: string
release_version:
required: true
type: string
secrets:
# Azure Client ID (App Registration) for Artifact Signing
AZURE_CLIENT_ID:
required: false
# Azure Client Secret for Artifact Signing
AZURE_CLIENT_SECRET:
required: false
# Azure Tenant ID for Artifact Signing
AZURE_TENANT_ID:
required: false
env:
PYTHON_VERSION: '3.14'
jobs:
build_windows:
name: ${{ matrix.name }}
runs-on: ${{ matrix.os }}
defaults:
run:
shell: msys2 {0}
permissions:
contents: read
strategy:
fail-fast: false
matrix:
include:
- name: Windows-AMD64
os: windows-2022
arch: x86_64
msystem: ucrt64
toolchain: ucrt-x86_64
- name: Windows-ARM64
os: windows-11-arm
arch: aarch64
msystem: clangarm64
toolchain: clang-aarch64
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
submodules: recursive
- name: Setup Dependencies Windows
# if a dependency needs to be pinned, see https://github.com/LizardByte/build-deps/pull/186
uses: msys2/setup-msys2@ec48f7c5447b3140e2b088413ae3a55687bccb6e # v2.33.0
with:
msystem: ${{ matrix.msystem }}
update: true
install: >-
wget
- name: Update Windows dependencies
env:
# MSYSTEM is a built-in environment variable of MSYS2.
# Do not use this environment variable name.
MATRIX_MSYSTEM: ${{ matrix.msystem }}
TOOLCHAIN: ${{ matrix.toolchain }}
shell: msys2 {0}
run: |
# variables
declare -A pinned_deps
# dependencies
dependencies=(
"git"
"mingw-w64-${TOOLCHAIN}-boost"
"mingw-w64-${TOOLCHAIN}-cmake"
"mingw-w64-${TOOLCHAIN}-cppwinrt"
"mingw-w64-${TOOLCHAIN}-curl-winssl"
"mingw-w64-${TOOLCHAIN}-doxygen"
"mingw-w64-${TOOLCHAIN}-gcc"
"mingw-w64-${TOOLCHAIN}-graphviz"
"mingw-w64-${TOOLCHAIN}-miniupnpc"
"mingw-w64-${TOOLCHAIN}-nlohmann-json"
"mingw-w64-${TOOLCHAIN}-onevpl"
"mingw-w64-${TOOLCHAIN}-openssl"
"mingw-w64-${TOOLCHAIN}-opus"
"mingw-w64-${TOOLCHAIN}-toolchain"
"mingw-w64-${TOOLCHAIN}-qt6-static"
)
if [[ "${MATRIX_MSYSTEM}" == "ucrt64" ]]; then
dependencies+=(
"mingw-w64-${TOOLCHAIN}-MinHook"
"mingw-w64-${TOOLCHAIN}-nsis"
)
fi
# do not modify below this line
ignore_packages=()
tarballs=""
for pkg in "${!pinned_deps[@]}"; do
ignore_packages+=("${pkg}")
version="${pinned_deps[$pkg]}"
tarball="${pkg}-${version}-any.pkg.tar.zst"
# download working version
wget --max-redirect=0 "https://repo.msys2.org/mingw/${MATRIX_MSYSTEM}/${tarball}"
tarballs="${tarballs} ${tarball}"
done
# Create the ignore string for pacman
ignore_list=$(IFS=,; echo "${ignore_packages[*]}")
# install pinned dependencies
if [ -n "${tarballs}" ]; then
pacman -U --noconfirm "${tarballs}"
fi
# Only add --ignore if we have packages to ignore
if [ -n "${ignore_list}" ]; then
pacman -Syu --noconfirm --ignore="${ignore_list}" "${dependencies[@]}"
else
pacman -Syu --noconfirm "${dependencies[@]}"
fi
- name: Setup dotnet # needed for wix
uses: actions/setup-dotnet@0f4a354dd5547a28c70b7853dbd95d5b67886e73 # v6.1.0
with:
dotnet-version: '10.x'
- name: Setup NodeJS
uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version: 'lts/*'
- name: NodeJS Path
shell: pwsh
run: |
# get NodeJS PATH
$NODEJS_BINARY_PATH = (Get-Command node).Source
$NODEJS_PATH = Split-Path -Path "$NODEJS_BINARY_PATH" -Parent
# setup environment variables
echo "NODEJS_PATH=$NODEJS_PATH" >> $env:GITHUB_ENV
# step output
echo "nodejs-path=$NODEJS_PATH"
echo "nodejs-path=$NODEJS_PATH" >> $env:GITHUB_OUTPUT
- name: Setup python
id: setup-python
uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Setup uv
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
with:
enable-cache: true
- name: Sync Python tools
shell: msys2 {0}
env:
MSYS2_PATH_TYPE: inherit
UV_PYTHON: ${{ steps.setup-python.outputs.python-path }}
run: |
uv_sync_args=(
--locked
--no-python-downloads
--no-install-project
)
# uv.lock pins external artifacts; the reviewed local lizardbyte-common build hook is required.
uv sync "${uv_sync_args[@]}" # NOSONAR(githubactions:S8541, githubactions:S8544)
- name: Build Windows
shell: msys2 {0}
env:
# MSYSTEM is a built-in environment variable of MSYS2.
# Do not use this environment variable name.
MATRIX_MSYSTEM: ${{ matrix.msystem }}
BRANCH: ${{ github.head_ref || github.ref_name }}
BUILD_VERSION: ${{ inputs.release_version }}
COMMIT: ${{ inputs.release_commit }}
run: |
# setup NodeJS PATH
NODEJS_PATH=$(cygpath "$NODEJS_PATH")
export PATH="$PATH:$NODEJS_PATH"
mkdir -p build
cmake \
-B build \
-G Ninja \
-S . \
-DBUILD_WERROR=ON \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DSUNSHINE_ASSETS_DIR=assets \
-DSUNSHINE_PUBLISHER_NAME="${GITHUB_REPOSITORY_OWNER}" \
-DSUNSHINE_PUBLISHER_WEBSITE="https://app.lizardbyte.dev" \
-DSUNSHINE_PUBLISHER_ISSUE_URL="https://app.lizardbyte.dev/support"
echo "::add-matcher::.github/matchers/gcc.json"
ninja -C build
echo "::remove-matcher owner=gcc::"
- name: Check Windows linkage
shell: msys2 {0}
run: |
set -euo pipefail
binaries=(
build/sunshine.exe
build/tools/audio-info.exe
build/tools/dxgi-info.exe
build/tools/sunshinesvc.exe
build/tests/test_sunshine.exe
)
unexpected_deps=""
for binary in "${binaries[@]}"; do
echo "::group::ldd ${binary}"
if ! linkage="$(ldd "${binary}")"; then
echo "${linkage}"
exit 1
fi
echo "${linkage}"
echo "::endgroup::"
unexpected_for_binary="$(awk '
BEGIN { IGNORECASE = 1 }
$1 == "zlib1.dll" { next }
$1 ~ /^minhook-detours\..*\.dll$/ { next }
$1 ~ /^api-ms-win-/ { next }
$1 ~ /^ext-ms-win-/ { next }
$0 ~ /=>[[:space:]]+not found/ { print }
$0 ~ /=>[[:space:]]+\/(clangarm64|clang64|mingw32|mingw64|ucrt64)\/bin\// { print }
' <<< "${linkage}")"
if [[ -n "${unexpected_for_binary}" ]]; then
unexpected_deps="${unexpected_deps}"$'\n'"${binary}:"$'\n'"${unexpected_for_binary}"
fi
done
if [[ -n "${unexpected_deps}" ]]; then
echo "Unexpected non-packaged runtime dependencies were found:"
echo "${unexpected_deps}"
exit 1
fi
- name: Sign Windows executables
# ARM64 is not currently supported, see https://github.com/Azure/artifact-signing-action/issues/92
if: inputs.publish_release == 'true' && inputs.azure_signing_account != '' && matrix.name != 'Windows-ARM64'
uses: azure/trusted-signing-action@c7ab2a863ab5f9a846ddb8265964877ef296ee82 # v2.0.0
with:
azure-client-id: ${{ secrets.AZURE_CLIENT_ID }}
azure-client-secret: ${{ secrets.AZURE_CLIENT_SECRET }}
azure-tenant-id: ${{ secrets.AZURE_TENANT_ID }}
certificate-profile-name: ${{ inputs.azure_signing_cert_profile }}
endpoint: ${{ inputs.azure_signing_endpoint }}
files: |
${{ github.workspace }}/build/sunshine.exe
${{ github.workspace }}/build/tools/audio-info.exe
${{ github.workspace }}/build/tools/dxgi-info.exe
${{ github.workspace }}/build/tools/sunshinesvc.exe
files-folder: src_assets/windows
files-folder-filter: ps1
files-folder-recurse: true
signing-account-name: ${{ inputs.azure_signing_account }}
- name: Package Windows
shell: msys2 {0}
run: |
mkdir -p artifacts
cd build
# package
cpack -G WIX
cpack -G ZIP
# move
mv ./cpack_artifacts/Sunshine.msi ../artifacts/Sunshine-${{ matrix.name }}-installer.msi
mv ./cpack_artifacts/Sunshine.zip ../artifacts/Sunshine-${{ matrix.name }}-lite.zip
- name: Sign Windows installers
# ARM64 is not currently supported, see https://github.com/Azure/artifact-signing-action/issues/92
if: inputs.publish_release == 'true' && inputs.azure_signing_account != '' && matrix.name != 'Windows-ARM64'
uses: azure/trusted-signing-action@c7ab2a863ab5f9a846ddb8265964877ef296ee82 # v2.0.0
with:
azure-client-id: ${{ secrets.AZURE_CLIENT_ID }}
azure-client-secret: ${{ secrets.AZURE_CLIENT_SECRET }}
azure-tenant-id: ${{ secrets.AZURE_TENANT_ID }}
certificate-profile-name: ${{ inputs.azure_signing_cert_profile }}
endpoint: ${{ inputs.azure_signing_endpoint }}
files-folder: artifacts
files-folder-filter: msi
files-folder-recurse: false
signing-account-name: ${{ inputs.azure_signing_account }}
- name: Debug wix
if: always()
shell: msys2 {0}
run: cat ./build/cpack_artifacts/_CPack_Packages/win64/WIX/wix.log || true
- name: Initialize tray icon
working-directory: build/tests
env:
SUNSHINE_CONFIGURE_TRAY_ICONS: '1'
run: >-
./test_sunshine.exe
--gtest_color=yes
--gtest_filter=SystemTrayTest.InitializesTrayForWorkflowConfiguration
- name: Configure Windows tray screenshots
uses: LizardByte/tray/.github/actions/configure-windows-tray-screenshots@master
- name: Run tests
id: test
shell: msys2 {0}
working-directory: build/tests
run: ./test_sunshine.exe --gtest_color=yes --gtest_output=xml:test_results.xml
- name: Upload system tray screenshots
if: >-
always() &&
(steps.test.outcome == 'success' || steps.test.outcome == 'failure')
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: sunshine-screenshots-${{ matrix.name }}
path: build/tests/screenshots
if-no-files-found: error
- name: Generate gcov report
id: test_report
# any except canceled or skipped
if: >-
always() &&
(steps.test.outcome == 'success' || steps.test.outcome == 'failure')
shell: msys2 {0}
working-directory: build
env:
MSYS2_PATH_TYPE: inherit
run: |
uv run --project .. --locked --no-build --no-sync gcovr . -r ../src \
--exclude-noncode-lines \
--exclude-throw-branches \
--exclude-unreachable-branches \
--verbose \
--xml-pretty \
-o coverage.xml
- name: Upload coverage artifact
if: >-
always() &&
(steps.test_report.outcome == 'success')
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: coverage-${{ matrix.name }}
path: |
build/coverage.xml
build/tests/test_results.xml
if-no-files-found: error
- name: Package Windows Debug Info
shell: pwsh
working-directory: build
run: |
# use .dbg file extension for binaries to avoid confusion with real packages
Get-ChildItem -File -Recurse | `
% { Rename-Item -Path $_.PSPath -NewName $_.Name.Replace(".exe",".dbg") }
# save the binaries with debug info
7z -r `
"-xr!CMakeFiles" `
"-xr!cpack_artifacts" `
a "../artifacts/Sunshine-${{ matrix.name }}-debuginfo.7z" "*.dbg"
- name: Upload Artifacts
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: build-${{ matrix.name }}
path: artifacts/
if-no-files-found: error