-
-
Notifications
You must be signed in to change notification settings - Fork 561
397 lines (330 loc) · 16.1 KB
/
Copy pathwindows-ci.yml
File metadata and controls
397 lines (330 loc) · 16.1 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
name: windows-ci
on:
workflow_dispatch:
# temporarily disabled
# https://github.com/maplibre/maplibre-native/issues/3670
# push:
# branches:
# - main
# - windows-*.*.x
# tags:
# - windows-*
# pull_request:
# branches:
# - '*'
env:
SCCACHE_GHA_ENABLED: "true"
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
# INFO: We are cancelling the concurrency group if the change is on PR. For workflow dispatch, this will not work.
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
permissions:
actions: read # needed for CodeQL
contents: read # needed for CodeQL
security-events: write # needed for CodeQL
jobs:
pre-job:
runs-on: windows-2022
outputs:
should_skip: ${{ github.event_name != 'workflow_dispatch' && steps.changed-files.outputs.windows_any_modified != 'true' }}
steps:
- run: |
git config --system core.longpaths true
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
submodules: recursive
persist-credentials: false
- name: Get all Windows files that have changed
if: github.event_name != 'workflow_dispatch'
id: changed-files
uses: tj-actions/changed-files@9426d40962ed5378910ee2e21d5f8c6fcbf2dd96 # v47.0.6
with:
files_yaml_from_source_file: .github/changed-files.yml
- name: List changed files
if: steps.changed-files.outputs.windows_any_modified == 'true'
run: |
Write-Host "Changed file(s): ${{ steps.changed-files.outputs.windows_all_changed_files }}"
windows-get-or-build-dependencies:
if: needs.pre-job.outputs.should_skip != 'true'
needs: pre-job
runs-on: windows-2022
steps:
- run: |
git config --system core.longpaths true
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
sparse-checkout: |
platform/windows/vendor
platform/windows/Get-VendorPackages.ps1
persist-credentials: false
- name: Get vcpkg commit id
run: |
$vcpkg_commit_id = (Invoke-WebRequest ${{ github.api_url }}/repos/${{ github.repository }}/contents/platform/windows/vendor/vcpkg?ref=${{ github.ref }} -Headers @{ Authorization = ('Bearer {0}' -f '${{ secrets.GITHUB_TOKEN }}') } | ConvertFrom-Json).sha
Add-Content -Path $env:GITHUB_ENV -Value "VCPKG_COMMIT_ID=${vcpkg_commit_id}"
- name: Restore vcpkg binary cache
id: vcpkg-cache
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ${{ github.workspace }}\platform\windows\vendor\vcpkg\archives
key: vcpkg-${{ env.VCPKG_COMMIT_ID }}
lookup-only: true
- name: Initialize vcpkg submodule
if: steps.vcpkg-cache.outputs.cache-hit != 'true'
run: |
git submodule sync --recursive
git submodule update --init --force --depth=1 --recursive platform/windows/vendor/vcpkg
- uses: ilammy/msvc-dev-cmd@0b201ec74fa43914dc39ae48a89fd1d8cb592756 # v1.13.0
if: steps.vcpkg-cache.outputs.cache-hit != 'true'
- name: Acquire/Build Maplibre Native Core Dependencies
if: steps.vcpkg-cache.outputs.cache-hit != 'true'
env:
CI: 1,
VCPKG_BINARY_SOURCES: "clear;files,${{ github.workspace }}\\platform\\windows\\vendor\\vcpkg\\archives,readwrite"
timeout-minutes: 60
run: |
& ${{ github.workspace }}\platform\windows\Get-VendorPackages.ps1 -Triplet ${{ env.VSCMD_ARG_TGT_ARCH }}-windows -Renderer All -With-ICU
- name: Save vcpkg binary cache
if: steps.vcpkg-cache.outputs.cache-hit != 'true'
uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ${{ github.workspace }}\platform\windows\vendor\vcpkg\archives
key: vcpkg-${{ env.VCPKG_COMMIT_ID }}
windows-build-and-test-msvc:
needs: windows-get-or-build-dependencies
strategy:
matrix:
renderer: [opengl, egl, vulkan]
runs-on: windows-2022
steps:
- run: |
git config --system core.longpaths true
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
submodules: recursive
persist-credentials: false
- name: Initialize CodeQL
uses: github/codeql-action/init@99df26d4f13ea111d4ec1a7dddef6063f76b97e9 # v4.37.0
with:
languages: cpp
- uses: ilammy/msvc-dev-cmd@0b201ec74fa43914dc39ae48a89fd1d8cb592756 # v1.13.0
- uses: mozilla-actions/sccache-action@9e7fa8a12102821edf02ca5dbea1acd0f89a2696 # v0.0.10
- name: Initialize sccache
run: |
& $env:SCCACHE_PATH --start-server
& $env:SCCACHE_PATH --zero-stats
- name: Get vcpkg commit id
run: |
$vcpkg_commit_id = ($(git submodule status .\platform\windows\vendor\vcpkg).Trim() -split ' ')[0]
Add-Content -Path $env:GITHUB_ENV -Value "VCPKG_COMMIT_ID=${vcpkg_commit_id}"
- name: Restore vcpkg binary cache
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ${{ github.workspace }}\platform\windows\vendor\vcpkg\archives
key: vcpkg-${{ env.VCPKG_COMMIT_ID }}
- name: Configure MapLibre Native Core
env:
CI: 1
VCPKG_INSTALL_OPTIONS: "--debug"
VCPKG_BINARY_SOURCES: "clear;files,${{ github.workspace }}\\platform\\windows\\vendor\\vcpkg\\archives,readwrite"
CMAKE_C_COMPILER_LAUNCHER: "${{ env.SCCACHE_PATH }}"
CMAKE_CXX_COMPILER_LAUNCHER: "${{ env.SCCACHE_PATH }}"
timeout-minutes: 60
run: |
cmake --version
cmake --preset windows-${{ matrix.renderer }} -DCMAKE_POLICY_DEFAULT_CMP0141=NEW -DCMAKE_MSVC_DEBUG_INFORMATION_FORMAT=Embedded -DCMAKE_BUILD_TYPE=RelWithDebInfo
- name: Build MapLibre Native Core
run: |
cmake --build build-windows-${{ matrix.renderer }} --target mbgl-core mbgl-test-runner mbgl-render-test-runner mbgl-expression-test mbgl-render mbgl-benchmark-runner
# CodeQL
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@99df26d4f13ea111d4ec1a7dddef6063f76b97e9 # v4.37.0
with:
category: "/language:cpp"
- name: Download Mesa3D
run: |
(Invoke-WebRequest https://api.github.com/repos/pal1000/mesa-dist-win/releases -Headers @{ Authorization = ('Bearer {0}' -f '${{ secrets.GITHUB_TOKEN }}') } | ConvertFrom-Json)[0].assets | Where-Object name -match 'mesa3d-.+-release-msvc\.7z' | foreach { Invoke-WebRequest $_.browser_download_url -OutFile mesa3d.7z }
- name: Extract Mesa3D files for OpenGL
if: matrix.renderer != 'vulkan'
run: |
& 'C:\Program Files\7-Zip\7z.exe' e -obuild-windows-${{ matrix.renderer }} .\mesa3d.7z x64\libgallium_wgl.dll x64\libGLESv2.dll
- name: Extract Mesa3D files for Vulkan
if: matrix.renderer == 'vulkan'
run: |
& 'C:\Program Files\7-Zip\7z.exe' e -obuild-windows-${{ matrix.renderer }} .\mesa3d.7z x64\lvp_icd.x86_64.json x64\vulkan_lvp.dll
# unit tests
- name: Configure Mesa3D drivers (OpenGL)
if: matrix.renderer != 'vulkan'
run: |
reg add 'HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\OpenGLDrivers\MSOGL' /v DLL /t REG_SZ /d ('{0}\build-windows-${{ matrix.renderer }}\libgallium_wgl.dll' -f $PWD.Path) /f
reg add 'HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\OpenGLDrivers\MSOGL' /v DriverVersion /t REG_DWORD /d 1 /f
reg add 'HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\OpenGLDrivers\MSOGL' /v Flags /t REG_DWORD /d 1 /f
reg add 'HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\OpenGLDrivers\MSOGL' /v Version /t REG_DWORD /d 2 /f
Add-Content -Path $env:GITHUB_ENV -Value 'GALLIUM_DRIVER=llvmpipe'
- name: Configure Mesa3D drivers (Vulkan)
if: matrix.renderer == 'vulkan'
run: |
reg add 'HKLM\Software\Khronos\Vulkan\Drivers' /f /v '${{ github.workspace }}\build-windows-${{ matrix.renderer }}\lvp_icd.x86_64.json' /t REG_DWORD /d 0
- name: Download and configure Vulkan
if: matrix.renderer == 'vulkan'
run: |
# 1.4.313.1 doesn't have runtime components?
# $version = (Invoke-WebRequest -Uri "https://vulkan.lunarg.com/sdk/latest.json" | ConvertFrom-Json).windows
$version = '1.4.313.0'
Invoke-WebRequest https://sdk.lunarg.com/sdk/download/$version/windows/VulkanRT-X64-$version-Components.zip -OutFile VulkanRT.zip
& 'C:\Program Files\7-Zip\7z.exe' e -obuild-windows-${{ matrix.renderer }} -r .\VulkanRT.zip *x64\vulkan-1.*
- name: Run C++ tests
continue-on-error: ${{ matrix.renderer == 'vulkan' }}
env:
ANGLE_DEFAULT_PLATFORM: 'gl'
GALLIUM_DRIVER: llvmpipe
LIBGL_ALWAYS_SOFTWARE: true
run: build-windows-${{ matrix.renderer }}/mbgl-test-runner.exe
# render tests
- name: Run render test
id: render_test
env:
manifest_file: ${{ matrix.renderer }}
ANGLE_DEFAULT_PLATFORM: 'gl'
GALLIUM_DRIVER: llvmpipe
LIBGL_ALWAYS_SOFTWARE: true
run: build-windows-${{ matrix.renderer }}/mbgl-render-test-runner.exe "--manifestPath=metrics/windows-${env:manifest_file}.json"
- name: Upload render test result
if: always() && steps.render_test.outcome == 'failure'
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: render-test-result-${{ matrix.renderer }}
path: |
metrics/windows-${{ matrix.renderer }}.html
# expression tests
- name: Run expression test
run: build-windows-${{ matrix.renderer }}/expression-test/mbgl-expression-test.exe
windows-build-and-test-msys2:
if: needs.pre-job.outputs.should_skip != 'true'
needs: pre-job
strategy:
matrix:
msystem: [clang64, mingw64, ucrt64]
renderer: [opengl, egl, vulkan]
runs-on: windows-2022
steps:
- run: |
git config --system core.longpaths true
git config --system core.autocrlf input
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
submodules: recursive
persist-credentials: false
- uses: msys2/setup-msys2@66cd2cce69caa17b53920067426061ca1de3a884 # v2.32.0
with:
msystem: ${{ matrix.msystem }}
update: true
pacboy: >-
toolchain:p
clang:p
cmake:p
angleproject:p
curl-winssl:p
dlfcn:p
glfw:p
icu:p
libjpeg-turbo:p
libpng:p
libwebp:p
libuv:p
- name: Initialize CodeQL
uses: github/codeql-action/init@99df26d4f13ea111d4ec1a7dddef6063f76b97e9 # v4.37.0
with:
languages: cpp
- uses: mozilla-actions/sccache-action@9e7fa8a12102821edf02ca5dbea1acd0f89a2696 # v0.0.10
- name: Initialize sccache
run: |
& $env:SCCACHE_PATH --start-server
& $env:SCCACHE_PATH --zero-stats
- name: Configure MapLibre Native Core
env:
CI: 1
CMAKE_C_COMPILER_LAUNCHER: "${{ env.SCCACHE_PATH }}"
CMAKE_CXX_COMPILER_LAUNCHER: "${{ env.SCCACHE_PATH }}"
shell: msys2 {0}
run: |
cmake --version
cmake --preset windows-${{ matrix.renderer }} -DCMAKE_POLICY_DEFAULT_CMP0141=NEW -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++
- name: Build MapLibre Native Core
shell: msys2 {0}
run: |
cmake --build build-windows-${{ matrix.renderer }} --target mbgl-core mbgl-test-runner mbgl-render-test-runner mbgl-expression-test mbgl-render mbgl-benchmark-runner
# CodeQL
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@99df26d4f13ea111d4ec1a7dddef6063f76b97e9 # v4.37.0
with:
category: "/language:cpp"
- name: Download Mesa3D
run: |
(Invoke-WebRequest https://api.github.com/repos/pal1000/mesa-dist-win/releases -Headers @{ Authorization = ('Bearer {0}' -f '${{ secrets.GITHUB_TOKEN }}') } | ConvertFrom-Json)[0].assets | Where-Object name -match 'mesa3d-.+-release-msvc\.7z' | foreach { Invoke-WebRequest $_.browser_download_url -OutFile mesa3d.7z }
- name: Extract Mesa3D files for OpenGL
if: matrix.renderer != 'vulkan'
run: |
& 'C:\Program Files\7-Zip\7z.exe' e -obuild-windows-${{ matrix.renderer }} .\mesa3d.7z x64\libgallium_wgl.dll x64\libGLESv2.dll
- name: Extract Mesa3D files for Vulkan
if: matrix.renderer == 'vulkan'
run: |
& 'C:\Program Files\7-Zip\7z.exe' e -obuild-windows-${{ matrix.renderer }} .\mesa3d.7z x64\lvp_icd.x86_64.json x64\vulkan_lvp.dll
# unit tests
- name: Configure Mesa3D drivers (OpenGL)
if: matrix.renderer != 'vulkan'
run: |
reg add 'HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\OpenGLDrivers\MSOGL' /v DLL /t REG_SZ /d ('{0}\build-windows-${{ matrix.renderer }}\libgallium_wgl.dll' -f $PWD.Path) /f
reg add 'HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\OpenGLDrivers\MSOGL' /v DriverVersion /t REG_DWORD /d 1 /f
reg add 'HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\OpenGLDrivers\MSOGL' /v Flags /t REG_DWORD /d 1 /f
reg add 'HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\OpenGLDrivers\MSOGL' /v Version /t REG_DWORD /d 2 /f
Add-Content -Path $env:GITHUB_ENV -Value 'GALLIUM_DRIVER=llvmpipe'
- name: Configure Mesa3D drivers (Vulkan)
if: matrix.renderer == 'vulkan'
run: |
reg add 'HKLM\Software\Khronos\Vulkan\Drivers' /f /v '${{ github.workspace }}\build-windows-${{ matrix.renderer }}\lvp_icd.x86_64.json' /t REG_DWORD /d 0
- name: Download and configure Vulkan
if: matrix.renderer == 'vulkan'
run: |
# 1.4.313.1 doesn't have runtime components?
# $version = (Invoke-WebRequest -Uri "https://vulkan.lunarg.com/sdk/latest.json" | ConvertFrom-Json).windows
$version = '1.4.313.0'
Invoke-WebRequest https://sdk.lunarg.com/sdk/download/$version/windows/VulkanRT-X64-$version-Components.zip -OutFile VulkanRT.zip
& 'C:\Program Files\7-Zip\7z.exe' e -obuild-windows-${{ matrix.renderer }} -r .\VulkanRT.zip *x64\vulkan-1.*
- name: Run C++ tests
continue-on-error: ${{ matrix.renderer == 'vulkan' }}
env:
ANGLE_DEFAULT_PLATFORM: 'gl'
GALLIUM_DRIVER: llvmpipe
LIBGL_ALWAYS_SOFTWARE: true
run: build-windows-${{ matrix.renderer }}/mbgl-test-runner.exe
# render tests
- name: Run render test
id: render_test
env:
manifest_file: ${{ matrix.renderer }}
ANGLE_DEFAULT_PLATFORM: 'gl'
GALLIUM_DRIVER: llvmpipe
LIBGL_ALWAYS_SOFTWARE: true
run: build-windows-${{ matrix.renderer }}/mbgl-render-test-runner.exe "--manifestPath=metrics/windows-${env:manifest_file}.json"
- name: Upload render test result
if: always() && steps.render_test.outcome == 'failure'
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: render-test-result-${{ matrix.renderer }}
path: |
metrics/windows-${{ matrix.renderer }}.html
# expression tests
- name: Run expression test
run: build-windows-${{ matrix.renderer }}/expression-test/mbgl-expression-test.exe
windows-ci-result:
name: Windows CI Result
if: needs.pre-job.outputs.should_skip != 'true' && always()
runs-on: windows-2022
needs:
- pre-job
- windows-build-and-test-msvc
- windows-build-and-test-msys2
steps:
- name: Mark result as failed
if: needs.windows-build-and-test-msvc.result != 'success' || needs.windows-build-and-test-msys2.result != 'success'
run: exit 1