v2 / .github / workflows / tools_ci.yml
249 lines · 241 sloc · 8.18 KB · b555471189ef3d7b38824c5b5dbdac8631126c17
Raw
1name: Tools CI
2
3on:
4 push:
5 paths:
6 - 'cmd/**'
7 - '!cmd/tools/vpm/**'
8 - 'vlib/**'
9 - 'thirdparty/**'
10 - '!**.md'
11 - '**/tools_ci.yml'
12 pull_request:
13 paths:
14 - 'cmd/**'
15 - '!cmd/tools/vpm/**'
16 - 'vlib/**'
17 - 'thirdparty/**'
18 - '!**.md'
19 - '**/tools_ci.yml'
20
21concurrency:
22 group: tools-${{ github.workflow }}-${{ github.ref == 'refs/heads/master' && github.sha || github.ref }}
23 cancel-in-progress: true
24
25jobs:
26 tools-linux:
27 runs-on: ubuntu-22.04
28 timeout-minutes: 20
29 strategy:
30 matrix:
31 cc: [tcc, gcc, clang]
32 fail-fast: false
33 env:
34 VFLAGS: -cc ${{ matrix.cc }}
35 steps:
36 - uses: actions/checkout@v6
37 - name: Build V
38 run: make && ./v -showcc -o v cmd/v && ./v symlink && ./v doctor
39 - name: Code in cmd/ is formatted
40 run: ./v fmt -verify cmd/
41 - name: Check build-tools
42 run: ./v -silent -N -W -check build-tools
43 - name: Test tools
44 run: ./v -silent test-self cmd
45 - name: Test tools (-cstrict)
46 if: ${{ matrix.cc != 'tcc' }}
47 run: ./v -silent -W -cstrict test-self cmd
48 - name: Test sanitized
49 if: ${{ matrix.cc != 'tcc' }}
50 run: |
51 export VNATIVE_SKIP_LIBC_VV=1
52 if [[ ${{ matrix.cc }} == "clang" ]]; then
53 cmd="./v -silent -cc clang -cflags -fsanitize=undefined test-self -ubsan-compiler cmd"
54 echo "$cmd" && $cmd
55 cmd="./v -silent -gc none -cc clang -cflags -fsanitize=memory test-self -msan-compiler cmd"
56 echo "$cmd" && $cmd
57 else
58 cmd="./v -silent -cc gcc -cflags -fsanitize=thread test-self cmd"
59 echo "$cmd" && $cmd
60 cmd="./v -silent -cc gcc -cflags -fsanitize=address,leak,undefined,shift,shift-exponent,shift-base,integer-divide-by-zero,unreachable,vla-bound,null,return,signed-integer-overflow,bounds,bounds-strict,alignment,object-size,float-divide-by-zero,float-cast-overflow,nonnull-attribute,returns-nonnull-attribute,bool,enum,vptr test-self -asan-compiler cmd/tools"
61 echo "$cmd" && $cmd
62 ## cmd="./v -silent -cc gcc -cflags -fsanitize=kernel-address test-self -asan-compiler cmd"
63 ## echo "$cmd" && $cmd
64 fi
65
66 tools-macos:
67 runs-on: macos-14
68 timeout-minutes: 20
69 strategy:
70 matrix:
71 cc: [clang]
72 fail-fast: false
73 env:
74 VFLAGS: -cc ${{ matrix.cc }}
75 steps:
76 - uses: actions/checkout@v6
77 - name: Build V
78 run: make && ./v -showcc -o v cmd/v && ./v symlink && ./v doctor
79 - name: Check build-tools
80 run: ./v -silent -N -W -check build-tools
81 - name: Test tools
82 run: ./v -silent test-self cmd
83 - name: Test tools (-cstrict)
84 run: ./v -silent -W -cstrict test-self cmd
85
86 tools-windows:
87 runs-on: windows-2025
88 timeout-minutes: 20
89 strategy:
90 matrix:
91 cc: [tcc, gcc, msvc]
92 fail-fast: false
93 env:
94 VFLAGS: -cc ${{ matrix.cc }}
95 steps:
96 - uses: actions/checkout@v6
97 - name: Build V
98 run: ./makev.bat -${{ matrix.cc }} && ./v -o v2.exe cmd/v && ./v2 -showcc -o v.exe cmd/v && ./v symlink && ./v doctor
99 - name: Install SQLite (needed by vsqlite tool)
100 run: .\.github\workflows\windows-install-sqlite.bat
101 - name: Check build tools
102 run: ./v build-tools
103 - name: Test tools
104 run: ./v -silent test-self cmd
105 - name: Test tools (-cstrict)
106 if: ${{ matrix.cc == 'msvc' }}
107 run: ./v -silent -W -cstrict test-self cmd
108
109 tools-docker-ubuntu-musl:
110 runs-on: ubuntu-24.04
111 timeout-minutes: 20
112 container:
113 image: thevlang/vlang:ubuntu-build
114 env:
115 V_CI_MUSL: 1
116 V_CI_UBUNTU_MUSL: 1
117 VFLAGS: -cc musl-gcc -gc none
118 volumes:
119 - ${{github.workspace}}:/opt/vlang
120 steps:
121 - name: Checkout
122 uses: actions/checkout@v6
123 - name: Build V
124 run: make && ./v -cg -o v cmd/v && ./v symlink
125 - name: Ensure git commands can be used with no prompts on modern Git versions
126 run: git config --global --add safe.directory /__w/v/v
127 - name: Verify `v test` works
128 run: |
129 ./v cmd/tools/test_if_v_test_system_works.v
130 ./cmd/tools/test_if_v_test_system_works
131 - name: Check build tools
132 run: ./v -silent -N -W -check build-tools
133 - name: Test tools
134 run: ./v -silent test-self cmd
135 - name: Test tools (-cstrict)
136 run: ./v -silent -W -cstrict test-self cmd
137
138 tools-freebsd:
139 runs-on: ubuntu-latest
140 timeout-minutes: 20
141 strategy:
142 matrix:
143 cc: [tcc, gcc, clang]
144 fail-fast: false
145 env:
146 VFLAGS: -cc ${{ matrix.cc }}
147 steps:
148 - uses: actions/checkout@v6
149 - name: Tests tools on FreeBSD with ${{ matrix.cc }}
150 uses: cross-platform-actions/[email protected]
151 with:
152 operating_system: freebsd
153 version: '15.0'
154 memory: 4G
155 shell: sh
156 sync_files: runner-to-vm
157 environment_variables: VFLAGS
158 run: |
159 sudo pkg install -y git sqlite3 gmake boehm-gc-threaded libiconv
160 if [ "$VFLAGS" = "-cc gcc" ]; then
161 sudo pkg install -y gcc
162 fi
163 # Mandatory: hostname not set in VM => some tests fail
164 sudo hostname -s freebsd-ci
165 echo "::group::OS infos"
166 uname -a
167 echo "::endgroup::"
168 # Build V
169 echo "::group::Build V"
170 git config --global --add safe.directory .
171 printf "VFLAGS = %s\n" "$VFLAGS"
172 gmake && ./v -showcc -o v cmd/v && sudo ./v symlink
173 echo "::endgroup::"
174 echo "::group::v doctor"
175 ./v doctor
176 echo "::endgroup::"
177 # Code in cmd/ is formatted
178 echo "::group::Check code in cmd/ is formatted"
179 ./v fmt -verify cmd/
180 echo "::endgroup::"
181 # Check build-tools
182 echo "::group::Check build tools"
183 ./v -silent -N -W -check build-tools
184 echo "::endgroup::"
185 # Test tools
186 echo "::group::Test tools"
187 ./v -silent test-self cmd
188 echo "::endgroup::"
189 # Test tools (-cstrict)
190 if [ "$VFLAGS" != "-cc tcc" ]; then
191 echo "::group::Test tools (-cstrict)"
192 ./v -silent -W -cstrict test-self cmd
193 echo "::endgroup::"
194 fi
195
196 tools-openbsd:
197 runs-on: ubuntu-latest
198 timeout-minutes: 20
199 strategy:
200 matrix:
201 cc: [tcc, clang]
202 fail-fast: false
203 env:
204 VFLAGS: -cc ${{ matrix.cc }}
205 steps:
206 - uses: actions/checkout@v6
207 - name: Tests tools on OpenBSD with ${{ matrix.cc }}
208 uses: cross-platform-actions/[email protected]
209 with:
210 operating_system: openbsd
211 version: '7.8'
212 memory: 4G
213 shell: sh
214 sync_files: runner-to-vm
215 environment_variables: VFLAGS
216 run: |
217 sudo pkg_add git sqlite3 gmake boehm-gc libiconv
218 # Mandatory: hostname not set in VM => some tests fail
219 sudo hostname -s openbsd-ci
220 echo "::group::OS infos"
221 uname -a
222 echo "::endgroup::"
223 # Build V
224 echo "::group::Build V"
225 git config --global --add safe.directory .
226 printf "VFLAGS = %s\n" "$VFLAGS"
227 gmake && ./v -showcc -o v cmd/v && sudo ./v symlink
228 echo "::endgroup::"
229 echo "::group::v doctor"
230 ./v doctor
231 echo "::endgroup::"
232 # Code in cmd/ is formatted
233 echo "::group::Check code in cmd/ is formatted"
234 ./v fmt -verify cmd/
235 echo "::endgroup::"
236 # Check build-tools
237 echo "::group::Check build tools"
238 ./v -silent -N -W -check build-tools
239 echo "::endgroup::"
240 # Test tools
241 echo "::group::Test tools"
242 ./v -silent test-self cmd
243 echo "::endgroup::"
244 # Test tools (-cstrict)
245 if [ "$VFLAGS" != "-cc tcc" ]; then
246 echo "::group::Test tools (-cstrict)"
247 ./v -silent -W -cstrict test-self cmd
248 echo "::endgroup::"
249 fi
250