-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
184 lines (179 loc) · 7.89 KB
/
Copy pathwindows_ci_tcc.yml
File metadata and controls
184 lines (179 loc) · 7.89 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
name: CI Windows TCC
on:
push:
branches:
- master
paths-ignore:
- 'vlib/v3/**'
- '**.md'
- '**.yml'
- '!**.bat'
- '!**/windows_ci_tcc.yml'
- 'cmd/tools/**'
- '!cmd/tools/builders/**.v'
pull_request:
paths-ignore:
- 'vlib/v3/**'
- '**.md'
- '**.yml'
- '!**.bat'
- '!**/windows_ci_tcc.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:
tcc-windows:
runs-on: windows-2022
timeout-minutes: 60
env:
VFLAGS: -cc tcc -no-retry-compilation
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
Write-Host "OpenSSL install:"
Get-ChildItem 'C:\Program Files\OpenSSL\lib\VC\x64\MD'
Write-Host "OpenSSL bin DLLs:"
Get-ChildItem $opensslBin -Filter *.dll
# TCC resolves `-lcrypto`/`-lssl` by searching the -L dir for
# `lib<name>.def` FIRST (confirmed against tinycc's own source,
# tcc_add_library's PE search-pattern array: "%s/%s.def",
# "%s/lib%s.def", "%s/%s.dll", "%s/lib%s.dll"), and when a .def
# file is found, tccpe.c's pe_load_def reads the file's own
# `LIBRARY <name>` directive via get_token() to get the DLL
# filename to embed in the import table. Confirmed against
# tinycc's own source that get_token() does NOT strip surrounding
# double quotes, and the extracted name is used AS-IS with no
# `.dll` extension appended. This OpenSSL 4.0.1 package's
# libcrypto.def/libssl.def declare `LIBRARY "libcrypto-4-x64"` /
# `LIBRARY "libssl-4-x64"` -- quoted, no extension -- so TCC
# embeds the LITERAL string `"libcrypto-4-x64"` (quote characters
# included, no `.dll`) as the runtime DLL name. `"` is illegal in
# a Windows filename, so NO real file can ever match that name --
# guaranteeing STATUS_DLL_NOT_FOUND (exit -1073741515, empty
# output) for every TCC-linked test touching
# crypto.ecdsa/crypto.rsa_pss/net.quic, confirmed via an actual CI
# failure, regardless of what DLLs actually exist in bin\ (MSVC
# is unaffected: it reads the DLL name from the .lib's own
# build-time metadata, which is already a valid, unquoted,
# extensioned filename). A file-aliasing workaround (mirroring
# msvc-windows' crypto.lib/libcrypto.lib alias) CANNOT fix this --
# you cannot create a file whose name contains a literal `"` on
# Windows. Fix at the source instead: rewrite each .def's LIBRARY
# line in place, stripping the quotes and appending `.dll` if
# missing, before TCC ever reads it. The rewritten name
# (`libcrypto-4-x64.dll`) already exists as a real file in bin\
# (this package ships both v3 and v4 runtime DLLs side by side),
# so no aliasing is needed once the .def itself is correct.
$libDir = 'C:\Program Files\OpenSSL\lib\VC\x64\MD'
foreach ($name in @('libcrypto', 'libssl')) {
$defPath = Join-Path $libDir "$name.def"
if (-not (Test-Path $defPath)) {
Write-Host "$name.def not found at $defPath, skipping LIBRARY-line fix"
continue
}
$lines = Get-Content $defPath
$fixedAny = $false
$newLines = $lines | ForEach-Object {
if ($_ -match '^(\s*LIBRARY\s+)"?([^"\s]+)"?\s*$') {
$dllName = $Matches[2]
if ($dllName -notmatch '\.dll$') {
$dllName = "$dllName.dll"
}
Write-Host "${name}: rewriting LIBRARY line '$_' -> 'LIBRARY $dllName'"
$fixedAny = $true
"LIBRARY $dllName"
} else {
$_
}
}
if ($fixedAny) {
Set-Content -Path $defPath -Value $newLines
} else {
Write-Host "${name}: no LIBRARY line found to rewrite in $defPath"
}
}
- name: Build with makev.bat -tcc
run: |
.\makev.bat -tcc
.\v.exe symlink
- name: Pkg-config regression (TCC dynamic isolation)
run: |
.\v.exe -cc tcc -no-retry-compilation test vlib\v\checker\pkgconfig_static_mode_test.v
if ($LASTEXITCODE -ne 0) {
throw "pkg-config TCC isolation regression failed with exit code $LASTEXITCODE"
}
- name: All code is formatted
run: v -silent test-cleancode
- name: Test new v.c
run: |
v -o v.c cmd/v
$direct_c_flags = @(
'-Ithirdparty/zip'
'-Ithirdparty/cJSON'
'-Ithirdparty/mbedtls/library'
'-Ithirdparty/mbedtls/include'
'-Ithirdparty/mbedtls/3rdparty/everest/include'
'-Ithirdparty/mbedtls/3rdparty/everest/include/everest'
'-Ithirdparty/mbedtls/3rdparty/everest/include/everest/kremlib'
'-Ithirdparty/vschannel'
)
# Match makev.bat's Windows stack reserve; the direct TCC-built
# compiler can otherwise crash while compiling net.http-heavy scripts.
.\thirdparty\tcc\tcc.exe -Werror -w @direct_c_flags -ladvapi32 -lws2_32 -bt10 '-Wl,-stack=33554432' v.c
- name: Install dependencies
run: |
v retry -- v setup-freetype
.\.github\workflows\windows-install-sqlite.bat
- name: v -g self
run: v -g self
- name: v doctor
run: |
v doctor
- name: Verify `v test` works
run: |
v cmd/tools/test_if_v_test_system_works.v
.\cmd\tools\test_if_v_test_system_works.exe
- name: Legacy gg import multiwindow isolation
run: v test vlib/gg/legacy_import_multiwindow_isolation_test.v
- name: Verify `v vlib/v/gen/c/coutput_test.v` works
run: v vlib/v/gen/c/coutput_test.v
- name: Make sure running TCC64 instead of TCC32
run: v test .github\workflows\make_sure_ci_run_with_64bit_compiler_test.v
- name: Test ./v doc -v clipboard *BEFORE building tools*
run: v doc -v clipboard
- name: Test v build-tools
run: v -silent -W build-tools
- name: Test pure V math module
run: v -silent -exclude @vlib/math/*.c.v test vlib/math/
- name: Multiwindow render runtime contract
run: .\v.exe -silent vlib\gg\multiwindow_render_runtime_contract_test.v
- 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 && .\v3.exe -o v4.exe cmd/v