-
Notifications
You must be signed in to change notification settings - Fork 234
317 lines (288 loc) · 12 KB
/
windows.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
# Copyright 2015-2020 The Khronos Group Inc.
# SPDX-License-Identifier: Apache-2.0
name: KTX-Software Windows CI
# Seems no way to avoid duplicating this on logic in each .yml file.
# See https://github.com/actions/starter-workflows/issues/245.
on:
# Trigger the workflow on a pull request,
pull_request:
push:
# And on pushes to main, which will occur when a PR is merged.
branches:
- main
# Also trigger on push of release tags to any branch. Useful
# for testing release builds before merging to main.
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'
- 'v[0-9]+.[0-9]+.[0-9]+-*'
paths-ignore:
- .appveyor.yml
- .travis.yml
# Allow manual trigger
workflow_dispatch:
jobs:
#formatting:
# uses: ./.github/workflows/formatting.yml
windows:
# Shortcircuit and don't burn CI time when formatting will reject
#needs: formatting
strategy:
matrix:
os: [ windows-latest ]
generator: [ 'Visual Studio 17 2022' ]
toolset: [v143, CLangCL]
arch: [ x64 ]
check_mkvk: [ NO ]
options: [
{config: 'Debug,Release',
doc: ON, jni: ON, loadtests: OpenGL+Vulkan, py: ON, tests: ON, tools: ON, tools_cts: ON,
package: YES,
sse: ON, opencl: OFF},
{config: Release,
doc: OFF, loadtests: OFF, py: OFF, tests: OFF, tools: OFF, tools_cts: OFF,
package: NO,
sse: OFF, opencl: OFF},
{config: Release,
doc: OFF, loadtests: OFF, py: OFF, tests: OFF, tools: OFF, tools_cts: OFF,
package: NO,
sse: OFF, opencl: ON},
{config: Release,
doc: OFF, loadtests: OFF, py: OFF, tests: OFF, tools: OFF, tools_cts: OFF,
package: NO,
sse: ON, opencl: ON}
]
include:
- os: windows-2019
generator: 'Visual Studio 16 2019'
toolset: v142
arch: x64
options: {
config: 'Debug,Release',
doc: ON, jni: ON, loadtests: OpenGL+Vulkan, py: ON, tests: ON, tools: ON, tools_cts: ON,
package: NO,
sse: ON, opencl: OFF
}
- os: windows-latest
generator: 'Visual Studio 17 2022'
toolset: CLangCL
arch: arm64
options: {
config: 'Debug,Release',
doc: ON, jni: ON, loadtests: OpenGL+Vulkan, py: OFF, tests: ON, tools: ON, tools_cts: ON,
package: YES
}
runs-on: ${{ matrix.os }}
env:
# Skip downloading necessities for the load tests and source and golden
# images for the other tests since we can't run arm64 tests on the x64
# build host.
GIT_LFS_SKIP_SMUDGE: 1
BUILD_DIR: "build"
CMAKE_GEN: ${{ matrix.generator }}
CMAKE_TOOLSET: ${{ matrix.toolset }}
ARCH: ${{ matrix.arch }}
CHECK_MKVK: ${{ matrix.check_mkvk }}
CONFIGURATION: ${{ matrix.options.config }}
FEATURE_DOC: ${{ matrix.options.doc }}
FEATURE_JNI: ${{ matrix.options.jni }}
FEATURE_LOADTESTS: ${{ matrix.options.loadtests }}
FEATURE_PY: ${{ matrix.options.py }}
FEATURE_TESTS: ${{ matrix.options.tests }}
FEATURE_TOOLS: ${{ matrix.options.tools }}
FEATURE_TOOLS_CTS: ${{ matrix.options.tools_cts }}
PACKAGE: ${{ matrix.options.package }}
SUPPORT_OPENCL: ${{ matrix.options.opencl }}
SUPPORT_SSE: ${{ matrix.options.sse }}
WERROR: ON
CODE_SIGN_TIMESTAMP_URL: "http://timestamp.digicert.com"
AZURE_KEY_VAULT_URL: ${{ secrets.AZURE_KEY_VAULT_URL }}
AZURE_KEY_VAULT_CERTIFICATE: ${{ secrets.AZURE_KEY_VAULT_CERTIFICATE }}
AZURE_KEY_VAULT_CLIENT_ID: ${{ secrets.AZURE_KEY_VAULT_CLIENT_ID }}
AZURE_KEY_VAULT_CLIENT_SECRET: ${{ secrets.AZURE_KEY_VAULT_CLIENT_SECRET }}
AZURE_KEY_VAULT_TENANT_ID: ${{ secrets.AZURE_KEY_VAULT_TENANT_ID }}
OPENCL_SDK_HOME: https://github.com/intel/llvm/releases/download/2021-09
OPENCL_SDK_NAME: win-oclcpuexp-2021.12.9.0.24_rel
OPENGL_ES_EMULATOR: C:/Imagination/Windows_x86_64
OPENGL_ES_EMULATOR_WIN: C:\Imagination\Windows_x86_64
PVR_SDK_HOME: https://github.com/powervr-graphics/Native_SDK/raw/master/lib/Windows_x86_64/
PYTHON: C:\hostedtoolcache\windows\Python\3.11.4\x64\python.exe
# This is set to avoid the compiler running out of heap space
# when vcpkg is compiling glew. Default is logical cores + 1.
# Runners have 1 thread per core and 2 cores.
VCPKG_MAX_CONCURRENCY: 2
VULKAN_SDK_VER: 1.3.290.0
steps:
- uses: actions/checkout@v4
with:
# Fetch all history to make sure tags are
# included (used for version creation)
fetch-depth: 0
- name: Install NSIS with large string support
if: matrix.check_mkvk != 'ONLY'
shell: bash
run: |
retryCount=4
success=0
for i in $(seq $retryCount) ; do
echo "Attempt no: $i"
stack exec -- wget -O nsis-3.08-strlen_8192.zip https://downloads.sourceforge.net/nsis/NSIS%203/3.08/nsis-3.08-strlen_8192.zip
if [[ $? -eq 0 ]] ; then
success=1
7z x -aoa -o"/c/Program Files (x86)/NSIS" nsis-3.08-strlen_8192.zip
rm nsis-3.08-strlen_8192.zip
echo "Installation successful."
break
else
echo "Installation failed. Retrying..."
sleep $(( 2*$i ))
fi
done
if (( ! $success )) ; then
echo "Installation failed after $retryCount attempts."
exit 1
fi
- name: Force fetch provoking tag's annotation.
# Work around https://github.com/actions/checkout/issues/290.
if: github.ref_type == 'tag' && matrix.check_mkvk != 'ONLY'
run: git fetch -f origin ${{ github.ref }}:${{ github.ref }}
# Need doxygen and graphviz if docs are supposed to be built.
# Note these suffer frequent failures due to Chocolatey attempts
# to blackmail you into purchasing a license. Hence we retry a
# few times. If this still fails, re-run the build.
- name: Install Doxygen and Graphviz
if: matrix.options.doc == 'ON'
#run: choco install doxygen.install
#run: choco install graphviz
run: |
function Install-WithChoco {
param ( $Package )
$retryCount = 4
$success = $false
for ($i = 1; $i -le $retryCount; $i++) {
Write-Host "Attempt no $i for $Package"
# Without | Out-Host the choco output becomes output of this
# function because it is called from within `if`.
choco install $Package --no-progress --yes | Out-Host
if ($LASTEXITCODE -eq 0) {
$success = $true
Write-Host "$Package installation successful."
break
} else {
Write-Host "$Package installation failed. Retrying..."
Start-Sleep -Seconds (2*$i)
}
}
if (-not $success) {
Write-Host "$Package installation failed after $retryCount attempts."
}
return $success
}
if (-not ((Install-WithChoco doxygen.install) -and (Install-WithChoco graphviz))) {
exit 1
}
- name: Install AzureSignTool
if: matrix.check_mkvk != 'ONLY'
id: install-ast
run: |
if ($env:PACKAGE -eq "YES" -and $env:AZURE_KEY_VAULT_URL) {
dotnet tool install --global AzureSignTool
echo "CODE_SIGN_KEY_VAULT=Azure" >> $env:GITHUB_ENV
}
- name: Export GitHub Actions cache and vcpkg environment variables
if: matrix.options.loadtests != 'OFF'
uses: actions/github-script@v7
with:
# Caution. JSON in use. "#core" breaks the build.
script: |
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
core.exportVariable('VCPKG_BINARY_SOURCES', "clear;x-gha,readwrite");
core.exportVariable('VCPKG_ROOT', process.env.VCPKG_INSTALLATION_ROOT || '');
- name: Setup PIP_CONSTRAINT (workaround https://github.com/python-cffi/cffi/issues/117)
if: matrix.options.py == 'ON' && matrix.check_mkvk != 'ONLY'
run: |
echo 'setuptools<74' > $env:RUNNER_TEMP/constraint.txt
echo "PIP_CONSTRAINT=$env:RUNNER_TEMP/constraint.txt" >> $env:GITHUB_ENV
- name: Install Dependencies
if: matrix.check_mkvk != 'ONLY'
# This script only installs what's needed by ON FEATUREs.
run: scripts/install_win.ps1
- name: Set up JDK 17.
if: matrix.options.jni == 'ON' && matrix.check_mkvk != 'ONLY'
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
- name: Set up Python 3.11
if: matrix.options.py == 'ON' && matrix.check_mkvk != 'ONLY'
uses: actions/setup-python@v5
with:
python-version: '3.11.4'
- name: Init CTS submodule
if: matrix.options.tools_cts =='ON'
run:
git submodule update --init --recursive tests/cts
- name: Smudge embedded dates
if: matrix.options.doc == 'ON'
run: |
./install-gitconfig.ps1
scripts/smudge_date.ps1
- name: Build Windows
if: matrix.check_mkvk != 'ONLY'
# The installers run as part of "Install Dependencies" add
# environment variables to the registry and augment $Path there.
# Although each step gets a new Powershell instance, that instance
# is spawned from some parent Powershell so it does not pick up
# the changes from the registry. Use Chocolatey's helper to
# pull in the changes.
# After import, `refreshenv` is an alias for
# Update-SessionEnvironment. Without the import refreshenv will end
# up calling the cmd.exe version, which won't help Powershell, and
# Update-SessionEnvironment will not exist.
# Unfortunately this resets JAVA_HOME to whatever is in the registry.
# The one from the Set Up JDK step was set in the environment before
# this step is called.
run: |
$step_java_home=$env:JAVA_HOME
Import-Module "$env:ChocolateyInstall/helpers/chocolateyInstaller.psm1"
refreshenv
$env:JAVA_HOME=$step_java_home
scripts/build_win.ps1
- name: Test Generation of VkFormat-related files
if: matrix.check_mkvk == 'ONLY'
run: scripts/check_mkvk.ps1
- name: Test Windows build
# Tests built for arm64 can't be run as the CI runners are all x64.
if: matrix.arch == 'x64' && matrix.options.tests == 'ON'
run: ctest --output-on-failure --test-dir $env:BUILD_DIR -C Release
- name: Upload test log
if: ${{ failure() }}
run: scripts/on_failure.ps1
- name: Get KTX version
if: matrix.options.package == 'YES'
id: ktx-version
run: |
$KTX_VERSION = Get-Content $env:BUILD_DIR/ktx.version
echo "KTX_VERSION=$KTX_VERSION" >> $env:GITHUB_ENV
- name: Upload Artifact
if: matrix.options.package == 'YES' && matrix.toolset == 'CLangCL'
uses: actions/upload-artifact@v4
with:
name: KTX-Software-${{env.KTX_VERSION}}-Windows-${{matrix.arch}}
path: ${{env.BUILD_DIR}}/KTX-Software-*.exe*
- name: Upload pyktx artifacts
if: matrix.options.package == 'YES' && matrix.options.py == 'ON'
uses: kittaakos/upload-artifact-as-is@v0
with:
path: ${{env.BUILD_DIR}}/interface/python_binding/dist/
- name: Upload to Release
uses: softprops/action-gh-release@v1
if: matrix.options.package == 'YES' && matrix.toolset == 'CLangCL' && github.event_name == 'push' && github.ref_type == 'tag'
with:
draft: true
prerelease: true
files: |
${{env.BUILD_DIR}}/KTX-Software-*.exe*
${{env.BUILD_DIR}}/interface/python_binding/dist/pyktx-*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}