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