v2 / .github / workflows / sanitized_ci.yml
325 lines · 315 sloc · 12.42 KB · a51ed8416224e15d17196584165f9fae71ec613f
Raw
1name: Sanitized CI
2
3## Running these jobs is slow (over ~1 hour, sometimes even 2)
4## so we run them only when there is a chance that the generated
5## C code could have changed, or for some critical vlib modules,
6## like `builtin`, `os`, `sync`, where they have demonstrated
7## their usefulness by catching actual very hard to find bugs.
8## The cost of this selective running is delayed feedback when
9## there are bugs in other V modules.
10## The positive is *much faster CI runs* for most V contributors,
11## that make PRs that are not concerning V itself, or the critical
12## V modules.
13
14on:
15 workflow_dispatch:
16 push:
17 paths:
18 - '!**'
19 - '!**.md'
20 - '!**.yml'
21 - 'vlib/builtin/**.v'
22 - 'vlib/strconv/**.v'
23 - 'vlib/strings/**.v'
24 - 'vlib/math/**.v'
25 - 'vlib/math/big/**.v'
26 - 'vlib/arrays/**.v'
27 - 'vlib/crypto/ecdsa/**.v'
28 - 'vlib/datatypes/**.v'
29 - 'vlib/os/**.v'
30 - 'vlib/sync/**.v'
31 - 'vlib/v/tests/**.v'
32 - 'vlib/v/ast/**.v'
33 - 'vlib/v/scanner/**.v'
34 - 'vlib/v/parser/**.v'
35 - 'vlib/v/checker/**.v'
36 - 'vlib/v/gen/c/**.v'
37 - 'vlib/v/builder/**.v'
38 - 'vlib/v/cflag/**.v'
39 - 'vlib/v/live/**.v'
40 - 'vlib/v/util/**.v'
41 - 'vlib/v/markused/**.v'
42 - 'vlib/v/preludes/**.v'
43 - 'vlib/v/embed_file/**.v'
44 - 'vlib/x/json2/**.v'
45 - '**/sanitized_ci.yml'
46 pull_request:
47 paths:
48 - '!**'
49 - 'vlib/builtin/**.v'
50 - 'vlib/strconv/**.v'
51 - 'vlib/strings/**.v'
52 - 'vlib/math/**.v'
53 - 'vlib/math/big/**.v'
54 - 'vlib/arrays/**.v'
55 - 'vlib/crypto/ecdsa/**.v'
56 - 'vlib/datatypes/**.v'
57 - 'vlib/os/**.v'
58 - 'vlib/sync/**.v'
59 - 'vlib/v/tests/**.v'
60 - 'vlib/v/ast/**.v'
61 - 'vlib/v/scanner/**.v'
62 - 'vlib/v/parser/**.v'
63 - 'vlib/v/checker/**.v'
64 - 'vlib/v/gen/c/**.v'
65 - 'vlib/v/builder/**.v'
66 - 'vlib/v/cflag/**.v'
67 - 'vlib/v/live/**.v'
68 - 'vlib/v/util/**.v'
69 - 'vlib/v/markused/**.v'
70 - 'vlib/v/preludes/**.v'
71 - 'vlib/v/embed_file/**.v'
72 - 'vlib/x/json2/**.v'
73 - '**/sanitized_ci.yml'
74
75concurrency:
76 group: sanitized-${{ github.workflow }}-${{ github.ref == 'refs/heads/master' && github.sha || github.ref }}
77 cancel-in-progress: true
78
79jobs:
80 sanitize-undefined-clang:
81 runs-on: ubuntu-22.04
82 timeout-minutes: 120
83 env:
84 VFLAGS: -cc clang -cflags -fno-omit-frame-pointer
85 VJOBS: 1
86 UBSAN_OPTIONS: print_stacktrace=1:halt_on_error=1:print_suppressions=0:suppressions=/home/runner/work/v/v/.github/workflows/run_sanitizers_undefined.suppressions
87 VNATIVE_SKIP_LIBC_VV: 1
88 VTEST_SHOW_LONGEST_BY_RUNTIME: 3
89 VTEST_SHOW_LONGEST_BY_COMPTIME: 3
90 VTEST_SHOW_LONGEST_BY_TOTALTIME: 3
91 steps:
92 - uses: actions/checkout@v6
93 - uses: ./.github/actions/cache-apt-packages-action
94 - name: Build V
95 run: make -j4 && ./v symlink
96 - name: V doctor
97 run: ./v doctor
98 - name: Ensure code is well formatted
99 run: ./v -silent test-cleancode
100 - name: Install dependencies
101 run: |
102 .github/workflows/disable_azure_mirror.sh
103 ./v retry -- sudo apt update
104 ./v retry -- sudo apt install --quiet -y postgresql libpq-dev libssl-dev sqlite3 libsqlite3-dev valgrind
105 ./v retry -- sudo apt install --quiet -y libfreetype6-dev libxi-dev libxcursor-dev libgl-dev libxrandr-dev libasound2-dev libegl-dev
106 ./v retry -- sudo apt install clang
107 - name: Recompile V with -cstrict
108 run: ./v -cg -cstrict -o v cmd/v
109 - name: Self tests (-fsanitize=undefined)
110 run: |
111 ./v -cflags -fsanitize=undefined -o v2 cmd/v
112 ./v2 -cflags -fsanitize=undefined -silent test-self vlib
113 - name: Build examples (V compiled with -fsanitize=undefined)
114 run: ./v2 -silent build-examples
115
116 sanitize-undefined-gcc:
117 runs-on: ubuntu-22.04
118 timeout-minutes: 120
119 env:
120 VFLAGS: -cc gcc -cflags -fno-omit-frame-pointer
121 VJOBS: 1
122 UBSAN_OPTIONS: print_stacktrace=1:halt_on_error=1:print_suppressions=0:suppressions=/home/runner/work/v/v/.github/workflows/run_sanitizers_undefined.suppressions
123 VNATIVE_SKIP_LIBC_VV: 1
124 VTEST_SHOW_LONGEST_BY_RUNTIME: 3
125 VTEST_SHOW_LONGEST_BY_COMPTIME: 3
126 VTEST_SHOW_LONGEST_BY_TOTALTIME: 3
127 steps:
128 - uses: actions/checkout@v6
129 - uses: ./.github/actions/cache-apt-packages-action
130 - name: Build V
131 run: make -j4 && ./v symlink
132 - name: V doctor
133 run: ./v doctor
134 - name: Ensure code is well formatted
135 run: ./v -silent test-cleancode
136 - name: Install dependencies
137 run: |
138 .github/workflows/disable_azure_mirror.sh
139 ./v retry -- sudo apt update
140 ./v retry -- sudo apt install --quiet -y postgresql libpq-dev libssl-dev sqlite3 libsqlite3-dev valgrind
141 ./v retry -- sudo apt install --quiet -y libfreetype6-dev libxi-dev libxcursor-dev libgl-dev libxrandr-dev libasound2-dev libegl-dev
142 - name: Recompile V with -cstrict
143 run: ./v -cg -cstrict -o v cmd/v
144 - name: Self tests (-fsanitize=undefined)
145 run: |
146 ./v -cflags -fsanitize=undefined -o v2 cmd/v
147 ./v2 -cflags -fsanitize=undefined -silent test-self vlib
148 - name: Build examples (V compiled with -fsanitize=undefined)
149 run: ./v2 -silent build-examples
150
151 sanitize-address-clang:
152 runs-on: ubuntu-22.04
153 timeout-minutes: 300
154 env:
155 VFLAGS: -cc clang -cflags -fno-omit-frame-pointer
156 VJOBS: 1
157 ASAN_OPTIONS: detect_leaks=1
158 LSAN_OPTIONS: max_leaks=1:print_suppressions=0:suppressions=/home/runner/work/v/v/.github/workflows/run_sanitizers_leak.suppressions
159 VNATIVE_SKIP_LIBC_VV: 1
160 VTEST_SHOW_LONGEST_BY_RUNTIME: 3
161 VTEST_SHOW_LONGEST_BY_COMPTIME: 3
162 VTEST_SHOW_LONGEST_BY_TOTALTIME: 3
163 steps:
164 - uses: actions/checkout@v6
165 - uses: ./.github/actions/cache-apt-packages-action
166 - name: Build V
167 run: make -j4 && ./v symlink
168 - name: V doctor
169 run: ./v doctor
170 - name: Ensure code is well formatted
171 run: ./v -silent test-cleancode
172 - name: Install dependencies
173 run: |
174 .github/workflows/disable_azure_mirror.sh
175 ./v retry -- sudo apt update
176 ./v retry -- sudo apt install --quiet -y postgresql libpq-dev libssl-dev sqlite3 libsqlite3-dev valgrind
177 ./v retry -- sudo apt install --quiet -y libfreetype6-dev libxi-dev libxcursor-dev libgl-dev libxrandr-dev libasound2-dev libegl-dev
178 ./v retry -- sudo apt install clang
179 - name: Recompile V with -cstrict
180 run: ./v -cg -cstrict -o v cmd/v
181 - name: Self tests (-fsanitize=address)
182 run: ./v -cflags -fsanitize=address,pointer-compare,pointer-subtract -silent test-self vlib
183 - name: Test vlib/v/tests/ (V compiled with -fsanitize=address)
184 run: |
185 ./v -cflags -fsanitize=address -o v cmd/v
186 ./v -cc tcc -silent test-self -asan-compiler vlib/v/tests/
187 - name: Build examples (V compiled with -fsanitize=address)
188 run: ./v -silent build-examples
189
190 sanitize-address-msvc:
191 runs-on: windows-2025
192 timeout-minutes: 30
193 env:
194 VFLAGS: -cc msvc
195 VJOBS: 1
196 VNATIVE_SKIP_LIBC_VV: 1
197 VTEST_SHOW_LONGEST_BY_RUNTIME: 3
198 VTEST_SHOW_LONGEST_BY_COMPTIME: 3
199 VTEST_SHOW_LONGEST_BY_TOTALTIME: 3
200 steps:
201 - uses: actions/checkout@v6
202 - name: Build
203 run: |
204 echo %VFLAGS%
205 echo $VFLAGS
206 .\makev.bat -msvc
207 .\v.exe self
208 - name: V doctor
209 run: .\v.exe doctor
210 - name: Ensure code is well formatted
211 run: .\v.exe -silent test-cleancode
212 # - name: Install dependencies
213 # run: |
214 # .\v.exe setup-freetype
215 # .\.github\workflows\windows-install-sqlite.bat
216 # - name: Self tests (/fsanitize=address) # TODO:
217 # run: .\v.exe -cflags "/fsanitize=address" -silent test-self vlib
218
219 sanitize-address-gcc:
220 runs-on: ubuntu-22.04
221 timeout-minutes: 300
222 env:
223 VFLAGS: -cc gcc -cflags -fno-omit-frame-pointer
224 VJOBS: 1
225 ASAN_OPTIONS: detect_leaks=1
226 LSAN_OPTIONS: max_leaks=1:print_suppressions=0:suppressions=/home/runner/work/v/v/.github/workflows/run_sanitizers_leak.suppressions
227 VNATIVE_SKIP_LIBC_VV: 1
228 VTEST_SHOW_LONGEST_BY_RUNTIME: 3
229 VTEST_SHOW_LONGEST_BY_COMPTIME: 3
230 VTEST_SHOW_LONGEST_BY_TOTALTIME: 3
231 steps:
232 - uses: actions/checkout@v6
233 - uses: ./.github/actions/cache-apt-packages-action
234 - name: Build V
235 run: make -j4 && ./v symlink
236 - name: V doctor
237 run: ./v doctor
238 - name: Ensure code is well formatted
239 run: ./v -silent test-cleancode
240 - name: Install dependencies
241 run: |
242 .github/workflows/disable_azure_mirror.sh
243 ./v retry -- sudo apt update
244 ./v retry -- sudo apt install --quiet -y postgresql libpq-dev libssl-dev sqlite3 libsqlite3-dev valgrind
245 ./v retry -- sudo apt install --quiet -y libfreetype6-dev libxi-dev libxcursor-dev libgl-dev libxrandr-dev libasound2-dev libegl-dev
246 ./v retry -- sudo apt install clang
247 - name: Recompile V with -cstrict
248 run: ./v -cg -cstrict -o v cmd/v
249 - name: Self tests (-fsanitize=address)
250 run: ./v -cflags -fsanitize=address -silent test-self vlib
251 - name: Test vlib/v/tests/ (V compiled with -fsanitize=address)
252 run: |
253 ./v -cflags -fsanitize=address,pointer-compare,pointer-subtract -o v cmd/v
254 ./v -cc tcc -silent test-self -asan-compiler vlib/v/tests/
255 - name: Build examples (V compiled with -fsanitize=address)
256 run: ./v -silent build-examples
257
258 sanitize-memory-clang:
259 runs-on: ubuntu-22.04
260 timeout-minutes: 240
261 env:
262 VFLAGS: -cc clang -gc none -cflags -fno-omit-frame-pointer
263 VJOBS: 1
264 VNATIVE_SKIP_LIBC_VV: 1
265 VTEST_SHOW_LONGEST_BY_RUNTIME: 3
266 VTEST_SHOW_LONGEST_BY_COMPTIME: 3
267 VTEST_SHOW_LONGEST_BY_TOTALTIME: 3
268 steps:
269 - uses: actions/checkout@v6
270 - uses: ./.github/actions/cache-apt-packages-action
271 - name: Build V
272 run: make -j4 && ./v symlink
273 - name: V doctor
274 run: ./v doctor
275 - name: Ensure code is well formatted
276 run: ./v -silent test-cleancode
277 - name: Install dependencies
278 run: |
279 .github/workflows/disable_azure_mirror.sh
280 ./v retry -- sudo apt update
281 ./v retry -- sudo apt install --quiet -y postgresql libpq-dev libssl-dev sqlite3 libsqlite3-dev valgrind
282 ./v retry -- sudo apt install --quiet -y libfreetype6-dev libxi-dev libxcursor-dev libgl-dev libxrandr-dev libasound2-dev libegl-dev
283 ./v retry -- sudo apt install clang
284 - name: Recompile V with clang and -cstrict
285 run: ./v -cc clang -cg -cstrict -o v cmd/v
286 - name: Self tests (-fsanitize=memory)
287 run: ./v -cflags -fsanitize=memory -silent test-self -msan-compiler vlib
288 - name: Test vlib/v/tests/ (V compiled with -fsanitize=memory)
289 run: |
290 ./v -cflags -fsanitize=memory -o v cmd/v
291 ./v -cc tcc -silent test-self -msan-compiler vlib/v/tests/
292 - name: Build examples (V compiled with -fsanitize=memory)
293 run: ./v -silent build-examples
294
295 sanitize-address-clang-without-gc:
296 runs-on: ubuntu-22.04
297 timeout-minutes: 300
298 env:
299 VFLAGS: -cc clang -gc none -cflags -fno-omit-frame-pointer
300 VJOBS: 1
301 LSAN_OPTIONS: detect_leaks=0
302 VNATIVE_SKIP_LIBC_VV: 1
303 VTEST_SHOW_LONGEST_BY_RUNTIME: 3
304 VTEST_SHOW_LONGEST_BY_COMPTIME: 3
305 VTEST_SHOW_LONGEST_BY_TOTALTIME: 3
306 steps:
307 - uses: actions/checkout@v6
308 - uses: ./.github/actions/cache-apt-packages-action
309 - name: Build V
310 run: make -j4 && ./v symlink
311 - name: V doctor
312 run: ./v doctor
313 - name: Ensure code is well formatted
314 run: ./v -silent test-cleancode
315 - name: Install dependencies
316 run: |
317 .github/workflows/disable_azure_mirror.sh
318 ./v retry -- sudo apt update
319 ./v retry -- sudo apt install --quiet -y postgresql libpq-dev libssl-dev sqlite3 libsqlite3-dev valgrind
320 ./v retry -- sudo apt install --quiet -y libfreetype6-dev libxi-dev libxcursor-dev libgl-dev libxrandr-dev libasound2-dev libegl-dev
321 ./v retry -- sudo apt install clang
322 - name: Recompile V with -cstrict
323 run: ./v -cg -cstrict -o v cmd/v
324 - name: Self tests (-fsanitize=address)
325 run: ./v -cflags -fsanitize=address -silent test-self vlib
326