-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
273 lines (261 loc) · 11.4 KB
/
Copy pathwindows_ci_msvc.yml
File metadata and controls
273 lines (261 loc) · 11.4 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
name: CI Windows MSVC
on:
push:
branches:
- master
paths-ignore:
- 'vlib/v3/**'
- '**.md'
- '**.yml'
- '!**.bat'
- '!**/windows_ci_msvc.yml'
- 'cmd/tools/**'
- '!cmd/tools/builders/**.v'
pull_request:
paths-ignore:
- 'vlib/v3/**'
- '**.md'
- '**.yml'
- '!**.bat'
- '!**/windows_ci_msvc.yml'
- '!**/windows-install-sqlite.bat'
- 'cmd/tools/**'
- '!cmd/tools/builders/**.v'
concurrency:
group: windows-${{ github.workflow }}-${{ github.ref == 'refs/heads/master' && github.sha || github.ref }}
cancel-in-progress: true
jobs:
msvc-windows:
runs-on: windows-2022
timeout-minutes: 90
env:
VFLAGS: -cc msvc
VTEST_SHOW_LONGEST_BY_RUNTIME: 3
VTEST_SHOW_LONGEST_BY_COMPTIME: 3
VTEST_SHOW_LONGEST_BY_TOTALTIME: 3
steps:
- uses: actions/checkout@v7.0.1
- name: Install OpenSSL
run: |
choco install openssl -y --no-progress
# choco's openssl package (Win64OpenSSL installer under the hood)
# deploys to `C:\Program Files\OpenSSL\`, matching
# ecdsa.c.v/rsa_pss.c.v's SECOND `#flag windows` fallback path --
# NOT the first one (`...OpenSSL-Win64\...`), confirmed by an
# actual CI run after guessing wrong the first time.
$opensslBin = 'C:\Program Files\OpenSSL\bin'
if (-not (Test-Path $opensslBin)) {
throw "OpenSSL bin directory not found at $opensslBin after choco install"
}
Add-Content -Path $env:GITHUB_PATH -Value $opensslBin
# ecdsa.c.v/rsa_pss.c.v use the unqualified `#flag -lcrypto`,
# which MSVC's linker (unlike gcc/tcc/clang's own `-l` convention,
# which implies a `lib` prefix automatically) passes straight
# through as a literal `crypto.lib` reference. This OpenSSL
# package only ships `libcrypto.lib` (confirmed via a real CI
# failure: `LNK1104: cannot open file 'crypto.lib'`) -- V's own
# `#flag` mechanism has no compiler-specific gating that can
# special-case MSVC here (only OS-name gates and one hardcoded
# `mingw` case are ever actually selected at build time, verified
# by reading vlib/v/builder/cflags.v's get_os_cflags()), so fix
# it here instead: alias the file under the name MSVC expects.
# A plain copy is safe -- a Windows import library doesn't embed
# its own filename.
$libDir = 'C:\Program Files\OpenSSL\lib\VC\x64\MD'
Copy-Item -Path (Join-Path $libDir 'libcrypto.lib') -Destination (Join-Path $libDir 'crypto.lib')
Write-Host "OpenSSL install:"
Get-ChildItem $libDir
- uses: ilammy/msvc-dev-cmd@v1
with:
arch: x64
- name: Verify MSVC tools
run: |
where.exe cl.exe
where.exe link.exe
where.exe dumpbin.exe
$headers = @($env:INCLUDE -split ';' | Where-Object { $_ -and $_.Trim().Length -gt 0 } | ForEach-Object { Join-Path $_ 'd3d11.h' } | Where-Object { Test-Path $_ })
if ($headers.Count -eq 0) {
throw 'd3d11.h not found in INCLUDE; Windows SDK is not visible to the D3D11 multiwindow lane'
}
Write-Host "Found d3d11.h at $($headers[0])"
- name: Build
run: |
echo %VFLAGS%
echo $VFLAGS
.\makev.bat -msvc
.\v.exe symlink
- name: Pkg-config regressions (MSVC dynamic isolation)
run: |
$tests = @(
'vlib\v\pkgconfig\pkgconfig_static_test.v'
'vlib\v\checker\pkgconfig_static_mode_test.v'
'vlib\v\checker\pkgconfig_cross_compile_test.v'
'vlib\v\builder\pkgconfig_link_segment_test.v'
)
foreach ($test in $tests) {
.\v.exe -cc msvc -no-retry-compilation test $test
if ($LASTEXITCODE -ne 0) {
throw "pkg-config regression failed for $test with exit code $LASTEXITCODE"
}
}
- name: Legacy gg import multiwindow isolation
run: v -cc msvc test vlib/gg/legacy_import_multiwindow_isolation_test.v
- name: Prepare multiwindow Job Object watchdog
shell: pwsh
run: |
$source = Join-Path $env:RUNNER_TEMP 'multiwindow_ci_watchdog.v'
$runner = Join-Path $env:RUNNER_TEMP 'multiwindow_ci_watchdog.exe'
@'
module main
import gg.testdata.multiwindow_probe_watchdog
import os
import time
fn main() {
run_ci_watchdog() or {
eprintln(err.msg())
exit(1)
}
}
fn run_ci_watchdog() ! {
if os.args.len < 4 {
return error('usage: multiwindow_ci_watchdog timeout-seconds expected-final-line executable [args...]')
}
timeout_seconds := os.args[1].int()
if timeout_seconds <= 0 {
return error('multiwindow CI watchdog timeout must be positive')
}
expected_final_line := os.args[2]
gate_path := os.join_path(os.temp_dir(), 'multiwindow_ci_gate_${os.getpid()}_${time.now().unix_nano()}')
defer {
os.rm(gate_path) or {}
}
result := multiwindow_probe_watchdog.run(
executable: os.args[3]
args: os.args[4..]
timeout: timeout_seconds * time.second
start_file: gate_path
)!
if result.stdout != '' {
print(result.stdout)
}
if result.stderr != '' {
eprint(result.stderr)
}
if result.timed_out {
return error('multiwindow CI child timed out after ${timeout_seconds} seconds')
}
if !result.reaped {
return error('multiwindow CI child leader was not reaped')
}
if !result.confinement_empty {
return error('multiwindow CI child process confinement is not empty')
}
if result.forced_cleanup {
return error('multiwindow CI child required forced cleanup')
}
if result.exit_code != 0 {
return error('multiwindow CI child exited with ${result.exit_code}')
}
if expected_final_line == '-' {
return
}
mut actual_final_line := ''
for line in result.stdout.split_into_lines() {
if line.trim_space() != '' {
actual_final_line = line.trim_space()
}
}
if actual_final_line != expected_final_line {
return error('multiwindow CI final record mismatch: expected `${expected_final_line}`, got `${actual_final_line}`')
}
}
'@ | Set-Content -Encoding utf8 $source
.\v.exe -cc msvc -o $runner $source
if ($LASTEXITCODE -ne 0) {
throw "multiwindow watchdog compile failed with exit code $LASTEXITCODE"
}
- name: Multiwindow D3D11 WARP regressions and runtime probes
shell: pwsh
env:
VFLAGS: -cc msvc -d gg_multiwindow_d3d11_warp
VGG_MULTIWINDOW_RUNTIME_PROBES: '1'
VGG_MULTIWINDOW_RUNTIME_BACKEND: win32
VGG_MULTIWINDOW_EXAMPLE_UNATTENDED: win32
V_MULTIWINDOW_PROBE_BACKEND: win32
run: |
$runner = Join-Path $env:RUNNER_TEMP 'multiwindow_ci_watchdog.exe'
$vexe = (Resolve-Path .\v.exe).Path
$interactive = Join-Path $env:RUNNER_TEMP 'gg_multiwindow.exe'
$runtime = Join-Path $env:RUNNER_TEMP 'gg_multiwindow_render_runtime.exe'
.\v.exe -cc msvc -d gg_multiwindow -d sokol_d3d11 -d gg_multiwindow_d3d11_warp -subsystem console -o $interactive examples/gg/multiwindow.v
if ($LASTEXITCODE -ne 0) {
throw "interactive multiwindow example compile failed with exit code $LASTEXITCODE"
}
.\v.exe -cc msvc -d gg_multiwindow -d sokol_d3d11 -d gg_multiwindow_d3d11_warp -subsystem console -o $runtime examples/gg/multiwindow_render_runtime.v
if ($LASTEXITCODE -ne 0) {
throw "runtime multiwindow example compile failed with exit code $LASTEXITCODE"
}
$tests = @(
'vlib/x/multiwindow/event_sequence_exhaustion_test.v',
'vlib/x/multiwindow/event_terminal_delivery_test.v',
'vlib/x/multiwindow/internal_fault_matrix_test.v',
'vlib/x/multiwindow/multiwindow_test.v',
'vlib/x/multiwindow/native_operation_proof_test.v',
'vlib/x/multiwindow/render_scheduler_test.v',
'vlib/x/multiwindow/render_target_lease_test.v',
'vlib/x/multiwindow/teardown_contract_test.v',
'vlib/x/multiwindow/win32_render_metrics_test.v',
'vlib/gg/multiwindow_api_d_gg_multiwindow_test.v',
'vlib/gg/multiwindow_buffer_cleanup_d_gg_multiwindow_test.v',
'vlib/gg/multiwindow_render_fault_matrix_d_gg_multiwindow_test.v',
'vlib/gg/multiwindow_render_runtime_contract_test.v',
'vlib/gg/frame_pacing_test.v',
'vlib/gg/draw_fns_api_test.v',
'vlib/gg/draw_rect_empty_test.v'
)
foreach ($test in $tests) {
& $runner 300 '-' $vexe '-cc' 'msvc' '-d' 'gg_multiwindow' '-d' 'sokol_d3d11' '-d' 'gg_multiwindow_d3d11_warp' 'test' $test
if ($LASTEXITCODE -ne 0) {
throw "multiwindow D3D11 WARP test '$test' failed with exit code $LASTEXITCODE"
}
}
& $runner 120 '{"example":"multiwindow_render_runtime","status":"PASS","cleanup":"complete"}' $runtime
if ($LASTEXITCODE -ne 0) {
throw "multiwindow D3D11 WARP runtime example failed with exit code $LASTEXITCODE"
}
& $runner 120 '{"example":"multiwindow","status":"PASS","cleanup":"complete"}' $interactive
if ($LASTEXITCODE -ne 0) {
throw "interactive multiwindow D3D11 WARP example failed with exit code $LASTEXITCODE"
}
- name: All code is formatted
run: v -silent test-cleancode
- name: Test -cc msvc works
run: v -no-retry-compilation run examples/hello_world.v
- name: Install dependencies
run: |
v retry -- v setup-freetype
.\.github\workflows\windows-install-sqlite.bat
- name: v doctor
run: |
v doctor
- name: Verify `v test` works
run: |
echo $VFLAGS
v cmd/tools/test_if_v_test_system_works.v
./cmd/tools/test_if_v_test_system_works
- name: Test pure V math module
run: v -silent -exclude @vlib/math/*.c.v test vlib/math/
- name: Test fasthttp module
run: v -silent test vlib/fasthttp/
- name: Self tests
run: v -silent test-self vlib
- name: Test v->js
run: v -o hi.js examples/js_hello_world.v && node hi.js
- name: Test v binaries
run: v build-vbinaries
- name: Build examples
run: v build-examples
- name: Compile and run the veb example (fasthttp) and check its HTML
run: v run .github/workflows/veb_example_windows_smoke.v
- name: v2 self compilation
run: v -o v2.exe cmd/v && .\v2.exe -o v3.exe cmd/v