-
-
Notifications
You must be signed in to change notification settings - Fork 325
261 lines (216 loc) · 8.89 KB
/
windows-ci.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
name: windows-ci
on:
workflow_dispatch:
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:
id-token: write # needed for AWS
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@v4
with:
submodules: recursive
- name: Get all Windows files that have changed
if: github.event_name != 'workflow_dispatch'
id: changed-files
uses: tj-actions/changed-files@v45
with:
files_yaml_from_source_file: .github/changed-files.yml
- name: List changed files
if: steps.changed-files.outputs.windows_any_modified == 'true'
shell: bash
run: |
echo "Changed file(s): ${{ steps.changed-files.outputs.windows_all_changed_files }}"
windows-build-and-test:
if: needs.pre_job.outputs.should_skip != 'true'
needs: pre-job
strategy:
matrix:
renderer: [opengl, egl, vulkan, osmesa]
rendering_mode: [legacy, drawable]
exclude:
- renderer: egl
rendering_mode: drawable
- renderer: vulkan
rendering_mode: legacy
runs-on: windows-2022
steps:
- run: |
git config --system core.longpaths true
- uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: cpp
- if: matrix.rendering_mode == 'legacy'
shell: bash
run: echo rendering_mode_flag_cmake=-DMLN_LEGACY_RENDERER=ON >> "$GITHUB_ENV"
- if: matrix.rendering_mode == 'drawable'
shell: bash
run: echo rendering_mode_flag_cmake=-DMLN_DRAWABLE_RENDERER=ON >> "$GITHUB_ENV"
- if: matrix.renderer == 'opengl'
shell: bash
run: echo renderer_flag_cmake="-DMLN_WITH_OPENGL=ON" >> "$GITHUB_ENV"
- if: matrix.renderer == 'egl'
shell: bash
run: echo renderer_flag_cmake="-DMLN_WITH_EGL=ON" >> "$GITHUB_ENV"
- if: matrix.renderer == 'vulkan'
shell: bash
run: echo renderer_flag_cmake="-DMLN_WITH_VULKAN=ON -DMLN_WITH_OPENGL=OFF" >> "$GITHUB_ENV"
- if: matrix.renderer == 'osmesa'
shell: bash
run: echo renderer_flag_cmake="-DMLN_WITH_OSMESA=ON" >> "$GITHUB_ENV"
- uses: ilammy/msvc-dev-cmd@v1
- name: Export GitHub Actions cache environment variables
uses: actions/github-script@v7
with:
script: |
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
- uses: mozilla-actions/sccache-action@v0.0.6
- name: Initialize sccache
run: |
sccache --start-server
sccache --zero-stats
- name: Configure MapLibre Native Core
env:
CI: 1
VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite"
run: |
cmake --version
cmake -B build -GNinja `
-DCMAKE_POLICY_DEFAULT_CMP0141=NEW `
-DCMAKE_MSVC_DEBUG_INFORMATION_FORMAT=Embedded `
-DCMAKE_BUILD_TYPE=RelWithDebInfo `
-DCMAKE_CXX_COMPILER_LAUNCHER=sccache `
${{ env.renderer_flag_cmake }} `
${{ env.rendering_mode_flag_cmake }}
- name: Build MapLibre Native Core
run: |
cmake --build build --target mbgl-core mbgl-test-runner mbgl-render-test-runner mbgl-expression-test mbgl-render mbgl-benchmark-runner
# mbgl-render (used for size test) & mbgl-benchmark-runner
- name: Upload mbgl-render as artifact
if: matrix.renderer == 'opengl' && matrix.rendering_mode == 'drawable' && github.event_name == 'pull_request'
uses: actions/upload-artifact@v4
with:
name: mbgl-render
path: |
build/bin/mbgl-render.exe
- name: Upload mbgl-benchmark-runner as artifact
if: matrix.renderer == 'opengl' && matrix.rendering_mode == 'drawable' && github.event_name == 'pull_request'
uses: actions/upload-artifact@v4
with:
name: mbgl-benchmark-runner
path: |
build/mbgl-benchmark-runner.exe
- name: Configure AWS Credentials
if: matrix.renderer == 'opengl' && matrix.rendering_mode == 'drawable' && github.ref == 'refs/heads/main' && vars.OIDC_AWS_ROLE_TO_ASSUME
uses: aws-actions/configure-aws-credentials@v4
with:
aws-region: us-west-2
role-to-assume: ${{ vars.OIDC_AWS_ROLE_TO_ASSUME }}
role-session-name: ${{ github.run_id }}
- name: Upload mbgl-render & mbgl-benchmark-runner to S3
if: matrix.renderer == 'opengl' && matrix.rendering_mode == 'drawable' && github.ref == 'refs/heads/main' && vars.OIDC_AWS_ROLE_TO_ASSUME
shell: bash
run: |
aws s3 cp build/bin/mbgl-render.exe s3://maplibre-native/mbgl-render-main
aws s3 cp build/mbgl-benchmark-runner.exe s3://maplibre-native/mbgl-benchmark-runner-main
# CodeQL
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
with:
category: "/language:cpp"
- name: Download Mesa3D
if: matrix.renderer != 'egl'
run: |
Invoke-WebRequest https://github.com/pal1000/mesa-dist-win/releases/download/24.2.5/mesa3d-24.2.5-release-msvc.7z -OutFile mesa3d.7z
- name: Extract Mesa3D files for OpenGL
if: matrix.renderer != 'egl' && matrix.renderer != 'vulkan'
run: |
& 'C:\Program Files\7-Zip\7z.exe' e -obuild .\mesa3d.7z x64\opengl32.dll x64\libgallium_wgl.dll x64\libGLESv2.dll x64\libglapi.dll
- name: Extract Mesa3D files for Vulkan
if: matrix.renderer != 'egl' && matrix.renderer == 'vulkan'
run: |
& 'C:\Program Files\7-Zip\7z.exe' e -obuild .\mesa3d.7z x64\lvp_icd.x86_64.json x64\vulkan_lvp.dll
- name: Extract Mesa3D files for OSMesa
if: matrix.renderer == 'osmesa'
run: |
& 'C:\Program Files\7-Zip\7z.exe' e -obuild .\mesa3d.7z x64\osmesa.dll
# unit tests
- name: Configure Mesa3D drivers (OpenGL)
if: matrix.renderer != 'egl' && matrix.renderer != 'vulkan'
shell: bash
run: |
echo GALLIUM_DRIVER="llvmpipe" >> "$GITHUB_ENV"
- name: Configure Mesa3D drivers (Vulkan)
if: matrix.renderer == 'vulkan'
shell: bash
run: |
reg add 'HKLM\Software\Khronos\Vulkan\Drivers' //f //v '${{ github.workspace }}\build\lvp_icd.x86_64.json' //t REG_DWORD //d 0
- name: Download and configure Vulkan
if: matrix.renderer == 'vulkan'
run: |
Invoke-WebRequest https://sdk.lunarg.com/sdk/download/1.3.296.0/windows/VulkanRT-1.3.296.0-Components.zip -OutFile VulkanRT.zip
& 'C:\Program Files\7-Zip\7z.exe' e -obuild -r .\VulkanRT.zip *x64\vulkan-1.dll
- name: Run C++ tests
continue-on-error: ${{ matrix.renderer == 'vulkan' }}
shell: bash
run: build/mbgl-test-runner.exe
# render tests
- name: Run render test
id: render_test
env:
manifest_file: ${{ matrix.renderer == 'osmesa' && 'opengl' || matrix.renderer }}
shell: bash
run: build/mbgl-render-test-runner.exe "--manifestPath=metrics/windows-${manifest_file}.json"
- name: Upload render test result
if: always() && steps.render_test.outcome == 'failure'
uses: actions/upload-artifact@v4
with:
name: render-test-result-${{ matrix.renderer }}
path: |
metrics/windows-${{ matrix.renderer == 'osmesa' && 'opengl' || matrix.renderer }}.html
# expression tests
- name: Run expression test
shell: bash
run: build/expression-test/mbgl-expression-test.exe
- if: github.event_name == 'pull_request'
uses: ./.github/actions/save-pr-number
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
steps:
- name: Mark result as failed
if: needs.windows-build-and-test.result != 'success'
shell: bash
run: exit 1