| 1 | name: CI Linux |
| 2 | |
| 3 | on: |
| 4 | workflow_dispatch: |
| 5 | push: |
| 6 | branches: |
| 7 | - master |
| 8 | paths-ignore: |
| 9 | - '**.md' |
| 10 | - '**.yml' |
| 11 | - '!**/linux_ci.yml' |
| 12 | - 'cmd/tools/**' |
| 13 | - '!cmd/tools/builders/**.v' |
| 14 | pull_request: |
| 15 | paths-ignore: |
| 16 | - '**.md' |
| 17 | - '**.yml' |
| 18 | - '!**/linux_ci.yml' |
| 19 | - 'cmd/tools/**' |
| 20 | - '!cmd/tools/builders/**.v' |
| 21 | |
| 22 | concurrency: |
| 23 | group: linux-${{ github.workflow }}-${{ github.ref == 'refs/heads/master' && github.sha || github.ref }} |
| 24 | cancel-in-progress: true |
| 25 | |
| 26 | jobs: |
| 27 | tcc-linux: |
| 28 | runs-on: ubuntu-24.04 |
| 29 | timeout-minutes: 121 |
| 30 | env: |
| 31 | VFLAGS: -cc tcc -no-retry-compilation |
| 32 | VTEST_SHOW_LONGEST_BY_RUNTIME: 3 |
| 33 | VTEST_SHOW_LONGEST_BY_COMPTIME: 3 |
| 34 | VTEST_SHOW_LONGEST_BY_TOTALTIME: 3 |
| 35 | steps: |
| 36 | - uses: actions/checkout@v6 |
| 37 | - uses: ./.github/actions/cache-apt-packages-action |
| 38 | - name: Build v |
| 39 | run: make -j4 && ./v symlink |
| 40 | - name: Build v with -prealloc |
| 41 | run: v run ci/linux_ci.vsh build_v_with_prealloc |
| 42 | - name: All code is formatted |
| 43 | run: v run ci/linux_ci.vsh all_code_is_formatted_tcc |
| 44 | - name: Install dependencies for examples and tools |
| 45 | run: v run ci/linux_ci.vsh install_dependencies_for_examples_and_tools_tcc |
| 46 | - name: Test v->c |
| 47 | run: v run ci/linux_ci.vsh test_v_to_c_tcc |
| 48 | - name: v self compilation |
| 49 | run: v run ci/linux_ci.vsh v_self_compilation_tcc |
| 50 | - name: v doctor |
| 51 | run: v run ci/linux_ci.vsh v_doctor_tcc |
| 52 | - name: Verify `v test` works |
| 53 | run: v run ci/linux_ci.vsh verify_v_test_works_tcc |
| 54 | - name: Test pure V math module |
| 55 | run: v run ci/linux_ci.vsh test_pure_v_math_module_tcc |
| 56 | - name: Test inline assembly on linux |
| 57 | run: v run ci/linux_ci.vsh test_inline_assembly |
| 58 | - name: Self tests |
| 59 | run: v run ci/linux_ci.vsh self_tests_tcc |
| 60 | - name: Build examples |
| 61 | run: v run ci/linux_ci.vsh build_examples_tcc |
| 62 | - name: Run the submodule example, using a relative path |
| 63 | run: v run ci/linux_ci.vsh run_submodule_example_tcc |
| 64 | - name: Build v tools |
| 65 | run: v run ci/linux_ci.vsh build_tools_tcc |
| 66 | - name: Build v binaries |
| 67 | run: v run ci/linux_ci.vsh build_vbinaries_tcc |
| 68 | - name: Build benches |
| 69 | run: v run ci/linux_ci.vsh build_benches_tcc |
| 70 | - name: Run a VSH script |
| 71 | run: v run ci/linux_ci.vsh run_vsh_script_tcc |
| 72 | - name: Test v tutorials |
| 73 | run: v run ci/linux_ci.vsh test_v_tutorials_tcc |
| 74 | - name: Build cmd/tools/fast |
| 75 | run: v run ci/linux_ci.vsh build_fast_tcc |
| 76 | - name: V self compilation with -usecache |
| 77 | run: v run ci/linux_ci.vsh v_self_compilation_usecache_tcc |
| 78 | - name: Test password input |
| 79 | run: v run ci/linux_ci.vsh test_password_input_tcc |
| 80 | - name: Test readline |
| 81 | run: v run ci/linux_ci.vsh test_readline_tcc |
| 82 | - name: Test leak detector |
| 83 | run: v run ci/linux_ci.vsh test_leak_detector_tcc |
| 84 | - name: Test leak detector not being active for normal compile |
| 85 | run: v run ci/linux_ci.vsh test_leak_detector_not_active_tcc |
| 86 | |
| 87 | gcc-linux: |
| 88 | runs-on: ubuntu-24.04 |
| 89 | timeout-minutes: 121 |
| 90 | env: |
| 91 | VTEST_SHOW_LONGEST_BY_RUNTIME: 3 |
| 92 | VTEST_SHOW_LONGEST_BY_COMPTIME: 3 |
| 93 | VTEST_SHOW_LONGEST_BY_TOTALTIME: 3 |
| 94 | steps: |
| 95 | - uses: actions/checkout@v6 |
| 96 | - uses: ./.github/actions/cache-apt-packages-action |
| 97 | - name: Build V |
| 98 | run: make -j4 && ./v symlink |
| 99 | - name: backend x64 regressions |
| 100 | run: | |
| 101 | set -e |
| 102 | |
| 103 | VJOBS=1 ./v test \ |
| 104 | vlib/v2/abi \ |
| 105 | vlib/v2/gen/x64/x64_abi_test.v \ |
| 106 | vlib/v2/gen/x64/x64_backend_diagnostics_test.v \ |
| 107 | vlib/v2/gen/x64/x64_object_format_test.v \ |
| 108 | vlib/v2/gen/x64/x64_pe_linker_test.v \ |
| 109 | vlib/v2/ssa/tree_sumtype_lowering_test.v |
| 110 | VJOBS=1 ./v test -run-only test_module_qualified_alias_array_field_index_has_alias_element_type,test_module_storage_legacy_direct_import_nested_module_selector_uses_declared_leaf_module,test_module_storage_flat_direct_import_nested_module_selector_uses_declared_leaf_module vlib/v2/ssa/module_storage_test.v |
| 111 | VJOBS=1 ./v test -run-only test_x64_linux_math_log_20_stdout_exact_bytes,test_x64_linux_generic_sumtype_direct_wrap_stdout_exact_bytes,test_x64_linux_generic_sumtype_repeated_base_specialization_stdout_exact_bytes,test_x64_linux_generic_sumtype_receiver_size_stdout_exact_bytes,test_x64_linux_generic_sumtype_insert_size_stdout_exact_bytes,test_x64_linux_struct_float_fields_stdout_exact_bytes,test_x64_linux_union_f64_bits_stdout_exact_bytes,test_x64_linux_f64_str_interpolation_stdout_exact_bytes,test_x64_linux_f64_for_interpolation_stdout_exact_bytes,test_x64_linux_formatted_int_interpolation_stdout_exact_bytes,test_x64_linux_formatted_int_width_100_interpolation_stdout_exact_bytes,test_x64_linux_formatted_f64_interpolation_stdout_exact_bytes,test_x64_linux_formatted_string_return_lifetime_stdout_exact_bytes,test_x64_linux_spectral_reduced_formatted_stdout_exact_bytes,test_x64_linux_bits_len32_stdout_exact_bytes,test_x64_linux_rand_u32n_interface_result_stdout_exact_bytes,test_x64_linux_rand_intn_range_interface_result_stdout_exact_bytes,test_x64_linux_textscanner_embedded_parser_stdout_exact_bytes,test_x64_linux_struct_positional_side_effect_stdout_exact_bytes,test_x64_linux_struct_named_side_effect_stdout_exact_bytes,test_x64_linux_unrelated_same_shape_struct_stdout_exact_bytes,test_x64_linux_named_init_embedded_value_stdout_exact_bytes,test_x64_linux_get_raw_line_example_stdin_stdout_exact_bytes,test_x64_linux_mini_calculator_example_stdin_stdout_exact_bytes,test_x64_linux_mini_calculator_recursive_descent_example_stdin_stdout_exact_bytes,test_x64_linux_external_c_flag_source_uses_hosted_link_with_compile_flags vlib/v2/gen/x64/x64_runtime_smoke_test.v |
| 112 | VJOBS=1 ./v test -run-only test_non_generic_concrete_sumtype_return_wraps_variant,test_option_concrete_sumtype_return_wraps_variant,test_generic_sumtype_declared_param_order_is_preserved_for_crossed_variants,test_worker_clone_sees_sumtype_decl_variant_cache,test_sumtype_decl_variant_cache_records_concrete_generic_variants_only,test_generic_sumtype_match_uses_full_specialization_when_generic_base_repeats,test_flat_direct_generic_sumtype_match_uses_full_specialization_when_generic_base_repeats,test_generic_sumtype_match_smartcast_scans_full_specialization_body,test_flat_direct_generic_sumtype_match_smartcast_scans_full_specialization_body,test_nested_module_concrete_generic_sumtype_base_does_not_fall_back_to_local_tree,test_leaf_module_concrete_generic_sumtype_base_fallback_beats_parent_module_tree vlib/v2/transformer/monomorphize_test.v |
| 113 | ./v test vlib/v2/builder/native_test.v vlib/v2/builder/target_os_test.v |
| 114 | ./v test vlib/v2/ssa/optimize |
| 115 | V2_VERIFY_STRICT=1 ./v test vlib/v2/ssa/optimize |
| 116 | |
| 117 | - name: backend x64 examples |
| 118 | run: | |
| 119 | set -e |
| 120 | |
| 121 | tmp="$(mktemp -d)" |
| 122 | trap 'rm -rf "$tmp"' EXIT |
| 123 | |
| 124 | check_empty_stderr() { |
| 125 | label="$1" |
| 126 | stderr="$2" |
| 127 | if [ -s "$stderr" ]; then |
| 128 | echo "::error::$label wrote to stderr" |
| 129 | cat "$stderr" |
| 130 | return 1 |
| 131 | fi |
| 132 | } |
| 133 | |
| 134 | check_stdout() { |
| 135 | label="$1" |
| 136 | expected="$2" |
| 137 | actual="$3" |
| 138 | if ! cmp -s "$expected" "$actual"; then |
| 139 | echo "::error::$label stdout mismatch" |
| 140 | echo "expected:" |
| 141 | cat "$expected" |
| 142 | echo "actual:" |
| 143 | cat "$actual" |
| 144 | return 1 |
| 145 | fi |
| 146 | } |
| 147 | |
| 148 | run_native_x64_example() { |
| 149 | source="$1" |
| 150 | name="$2" |
| 151 | expected="$3" |
| 152 | shift 3 |
| 153 | |
| 154 | ./v -v2 -no-parallel -b x64 "$source" -o "$tmp/$name" |
| 155 | "$tmp/$name" "$@" > "$tmp/$name.out" 2> "$tmp/$name.err" |
| 156 | check_empty_stderr "$name" "$tmp/$name.err" |
| 157 | check_stdout "$name" "$expected" "$tmp/$name.out" |
| 158 | } |
| 159 | |
| 160 | run_native_x64_example_with_stdin() { |
| 161 | source="$1" |
| 162 | name="$2" |
| 163 | input="$3" |
| 164 | expected="$4" |
| 165 | shift 4 |
| 166 | |
| 167 | ./v -v2 -no-parallel -b x64 "$source" -o "$tmp/$name" |
| 168 | "$tmp/$name" "$@" < "$input" > "$tmp/$name.out" 2> "$tmp/$name.err" |
| 169 | check_empty_stderr "$name" "$tmp/$name.err" |
| 170 | check_stdout "$name" "$expected" "$tmp/$name.out" |
| 171 | } |
| 172 | |
| 173 | run_native_x64_example_capture() { |
| 174 | source="$1" |
| 175 | name="$2" |
| 176 | shift 2 |
| 177 | |
| 178 | ./v -v2 -no-parallel -b x64 "$source" -o "$tmp/$name" |
| 179 | "$tmp/$name" "$@" > "$tmp/$name.out" 2> "$tmp/$name.err" |
| 180 | check_empty_stderr "$name" "$tmp/$name.err" |
| 181 | } |
| 182 | |
| 183 | check_random_ips_stdout() { |
| 184 | label="$1" |
| 185 | actual="$2" |
| 186 | python3 - "$label" "$actual" <<'PY' |
| 187 | import sys |
| 188 | |
| 189 | label = sys.argv[1] |
| 190 | path = sys.argv[2] |
| 191 | lines = open(path, "r", encoding="utf-8").read().splitlines() |
| 192 | if len(lines) != 10: |
| 193 | raise SystemExit(f"{label}: expected 10 lines, got {len(lines)}") |
| 194 | rows = [] |
| 195 | for line in lines: |
| 196 | parts = line.split(".") |
| 197 | if len(parts) != 4: |
| 198 | raise SystemExit(f"{label}: invalid IPv4 shape: {line!r}") |
| 199 | row = [] |
| 200 | for part in parts: |
| 201 | if not part.isdigit(): |
| 202 | raise SystemExit(f"{label}: non-numeric octet in {line!r}") |
| 203 | value = int(part) |
| 204 | if value < 0 or value > 254: |
| 205 | raise SystemExit(f"{label}: octet out of range in {line!r}") |
| 206 | row.append(value) |
| 207 | rows.append(tuple(row)) |
| 208 | if len(set(rows)) < 3: |
| 209 | raise SystemExit(f"{label}: output has too little row diversity") |
| 210 | if all(row[1] == 0 for row in rows) and all(row[3] == 0 for row in rows): |
| 211 | raise SystemExit(f"{label}: suspicious old x.0.x.0 pattern") |
| 212 | PY |
| 213 | } |
| 214 | |
| 215 | check_rule110_stdout() { |
| 216 | label="$1" |
| 217 | actual="$2" |
| 218 | width="$3" |
| 219 | python3 - "$label" "$actual" "$width" <<'PY' |
| 220 | import sys |
| 221 | |
| 222 | label = sys.argv[1] |
| 223 | path = sys.argv[2] |
| 224 | width = int(sys.argv[3]) |
| 225 | lines = open(path, "r", encoding="utf-8").read().splitlines() |
| 226 | title = "Rule 110 V Implementation" |
| 227 | title_lines = [idx for idx, line in enumerate(lines) if title in line] |
| 228 | if not title_lines: |
| 229 | raise SystemExit(f"{label}: missing title") |
| 230 | idx = title_lines[0] |
| 231 | generations = lines[idx + 1:] |
| 232 | if generations and generations[0] == "": |
| 233 | generations = generations[1:] |
| 234 | if len(generations) != width: |
| 235 | raise SystemExit(f"{label}: expected {width} generation lines, got {len(generations)}") |
| 236 | for line in generations: |
| 237 | if len(line) != width: |
| 238 | raise SystemExit(f"{label}: generation line has width {len(line)}, expected {width}: {line!r}") |
| 239 | if any(ch not in " *" for ch in line): |
| 240 | raise SystemExit(f"{label}: invalid generation chars: {line!r}") |
| 241 | if not any("*" in line for line in generations): |
| 242 | raise SystemExit(f"{label}: expected at least one live cell") |
| 243 | if len(set(generations)) < 3: |
| 244 | raise SystemExit(f"{label}: expected at least 3 distinct generation lines") |
| 245 | PY |
| 246 | } |
| 247 | |
| 248 | write_v_run_expected() { |
| 249 | source="$1" |
| 250 | expected="$2" |
| 251 | shift 2 |
| 252 | stderr="$tmp/$(basename "$expected").stderr" |
| 253 | ./v run "$source" "$@" > "$expected" 2> "$stderr" |
| 254 | check_empty_stderr "v run $source $*" "$stderr" |
| 255 | } |
| 256 | |
| 257 | write_v_run_expected_with_stdin() { |
| 258 | source="$1" |
| 259 | input="$2" |
| 260 | expected="$3" |
| 261 | shift 3 |
| 262 | stderr="$tmp/$(basename "$expected").stderr" |
| 263 | ./v run "$source" "$@" < "$input" > "$expected" 2> "$stderr" |
| 264 | check_empty_stderr "v run $source $*" "$stderr" |
| 265 | } |
| 266 | |
| 267 | write_fizz_buzz_expected() { |
| 268 | i=1 |
| 269 | while [ "$i" -le 100 ]; do |
| 270 | if [ $((i % 15)) -eq 0 ]; then |
| 271 | echo FizzBuzz |
| 272 | elif [ $((i % 3)) -eq 0 ]; then |
| 273 | echo Fizz |
| 274 | elif [ $((i % 5)) -eq 0 ]; then |
| 275 | echo Buzz |
| 276 | else |
| 277 | echo "$i" |
| 278 | fi |
| 279 | i=$((i + 1)) |
| 280 | done |
| 281 | } |
| 282 | |
| 283 | write_hanoi_expected() { |
| 284 | python3 - <<'PY' |
| 285 | def hanoi(n, a, b, c): |
| 286 | if n == 1: |
| 287 | print(f"Disc 1 from {a} to {c}...") |
| 288 | else: |
| 289 | hanoi(n - 1, a, c, b) |
| 290 | print(f"Disc {n} from {a} to {c}...") |
| 291 | hanoi(n - 1, b, a, c) |
| 292 | |
| 293 | hanoi(7, "A", "B", "C") |
| 294 | PY |
| 295 | } |
| 296 | |
| 297 | write_sudoku_expected() { |
| 298 | python3 - <<'PY' |
| 299 | import sys |
| 300 | |
| 301 | puzzle = [ |
| 302 | [0, 3, 0, 0, 7, 0, 0, 0, 0], |
| 303 | [0, 0, 0, 1, 3, 5, 0, 0, 0], |
| 304 | [0, 0, 1, 0, 0, 0, 0, 5, 0], |
| 305 | [1, 0, 0, 0, 6, 0, 0, 0, 3], |
| 306 | [4, 0, 0, 8, 0, 3, 0, 0, 1], |
| 307 | [7, 0, 0, 0, 2, 0, 0, 0, 6], |
| 308 | [0, 0, 0, 0, 0, 0, 2, 1, 0], |
| 309 | [0, 0, 0, 4, 1, 2, 0, 0, 5], |
| 310 | [0, 0, 0, 0, 0, 0, 0, 7, 4], |
| 311 | ] |
| 312 | solution = [ |
| 313 | [2, 3, 5, 6, 7, 8, 1, 4, 9], |
| 314 | [9, 4, 7, 1, 3, 5, 8, 6, 2], |
| 315 | [6, 8, 1, 2, 4, 9, 3, 5, 7], |
| 316 | [1, 2, 8, 7, 6, 4, 5, 9, 3], |
| 317 | [4, 5, 6, 8, 9, 3, 7, 2, 1], |
| 318 | [7, 9, 3, 5, 2, 1, 4, 8, 6], |
| 319 | [3, 6, 4, 9, 5, 7, 2, 1, 8], |
| 320 | [8, 7, 9, 4, 1, 2, 6, 3, 5], |
| 321 | [5, 1, 2, 3, 8, 6, 9, 7, 4], |
| 322 | ] |
| 323 | |
| 324 | def append_grid(lines, label, grid): |
| 325 | lines.append(label) |
| 326 | for i, row in enumerate(grid): |
| 327 | if i % 3 == 0 and i != 0: |
| 328 | lines.append("- - - - - - - - - - - -") |
| 329 | line = "" |
| 330 | for j, value in enumerate(row): |
| 331 | if j % 3 == 0 and j != 0: |
| 332 | line += " | " |
| 333 | line += f"{value} " |
| 334 | lines.append(line) |
| 335 | |
| 336 | lines = [] |
| 337 | append_grid(lines, "Sudoku Puzzle:", puzzle) |
| 338 | lines.append("Solving...") |
| 339 | append_grid(lines, "Solution:", solution) |
| 340 | out = ("\n".join(lines) + "\n").encode() |
| 341 | if len(out) != 582: |
| 342 | raise SystemExit(f"sudoku stdout oracle shape changed: {len(out)} bytes") |
| 343 | sys.stdout.buffer.write(out) |
| 344 | PY |
| 345 | } |
| 346 | |
| 347 | write_tree_of_nodes_expected() { |
| 348 | cat <<'EOF' |
| 349 | tree structure: |
| 350 | Node{ |
| 351 | value: 10 |
| 352 | left: Tree(Node{ |
| 353 | value: 30 |
| 354 | left: Tree(Empty{}) |
| 355 | right: Tree(Empty{}) |
| 356 | }) |
| 357 | right: Tree(Node{ |
| 358 | value: 20 |
| 359 | left: Tree(Empty{}) |
| 360 | right: Tree(Empty{}) |
| 361 | }) |
| 362 | } |
| 363 | tree size: 3 |
| 364 | EOF |
| 365 | } |
| 366 | |
| 367 | write_js_hello_world_expected() { |
| 368 | printf 'Hello from V.js (0)\nHello from V.js (1)\nHello from V.js (2)\n' |
| 369 | } |
| 370 | |
| 371 | write_vascii_expected() { |
| 372 | python3 - <<'PY' |
| 373 | from pathlib import Path |
| 374 | import sys |
| 375 | |
| 376 | source = Path("examples/vascii.v").read_text(encoding="utf-8") |
| 377 | start_marker = "println('" |
| 378 | end_marker = "')" |
| 379 | if source.count(start_marker) != 1: |
| 380 | raise SystemExit("vascii stdout oracle expects one single-quoted println literal") |
| 381 | start = source.index(start_marker) + len(start_marker) |
| 382 | end = source.rindex(end_marker) |
| 383 | if source[end + len(end_marker):].strip() != "}": |
| 384 | raise SystemExit("vascii stdout oracle expects the println literal to be the final main statement") |
| 385 | |
| 386 | out = bytearray() |
| 387 | literal = source[start:end] |
| 388 | i = 0 |
| 389 | while i < len(literal): |
| 390 | ch = literal[i] |
| 391 | if ch == "\\": |
| 392 | i += 1 |
| 393 | if i >= len(literal): |
| 394 | raise SystemExit("unterminated escape in vascii literal") |
| 395 | escaped = literal[i] |
| 396 | if escaped == "n": |
| 397 | out.append(10) |
| 398 | elif escaped == "t": |
| 399 | out.append(9) |
| 400 | elif escaped == "r": |
| 401 | out.append(13) |
| 402 | elif escaped == "\\": |
| 403 | out.append(92) |
| 404 | elif escaped == "'": |
| 405 | out.append(39) |
| 406 | elif escaped == '"': |
| 407 | out.append(34) |
| 408 | else: |
| 409 | out.extend(escaped.encode("utf-8")) |
| 410 | else: |
| 411 | out.extend(ch.encode("utf-8")) |
| 412 | i += 1 |
| 413 | out.append(10) |
| 414 | sys.stdout.buffer.write(out) |
| 415 | PY |
| 416 | } |
| 417 | |
| 418 | write_rune_expected() { |
| 419 | printf '\360\237\230\200\n@\n' |
| 420 | } |
| 421 | |
| 422 | printf 'Hello, World!\n' > "$tmp/hello_world.expected" |
| 423 | write_fizz_buzz_expected > "$tmp/fizz_buzz.expected" |
| 424 | write_hanoi_expected > "$tmp/hanoi.expected" |
| 425 | write_sudoku_expected > "$tmp/sudoku.expected" |
| 426 | printf 'HELLO WORLD\nHELLO WORLD\nHELLO WORLD\n' > "$tmp/function_types.expected" |
| 427 | printf '5\n3\n' > "$tmp/submodule.expected" |
| 428 | printf '1\n1\n2\n3\n5\n8\n13\n21\n34\n55\n89\n' > "$tmp/fibonacci_10.expected" |
| 429 | printf '120\n' > "$tmp/dump_factorial.expected" |
| 430 | write_v_run_expected examples/primes.v "$tmp/primes_20.expected" 20 |
| 431 | write_tree_of_nodes_expected > "$tmp/tree_of_nodes.expected" |
| 432 | write_js_hello_world_expected > "$tmp/js_hello_world.expected" |
| 433 | write_vascii_expected > "$tmp/vascii.expected" |
| 434 | write_rune_expected > "$tmp/rune.expected" |
| 435 | write_v_run_expected examples/graphs/bfs.v "$tmp/bfs.expected" |
| 436 | write_v_run_expected examples/graphs/bfs3.v "$tmp/bfs3.expected" |
| 437 | write_v_run_expected examples/graphs/dfs.v "$tmp/dfs.expected" |
| 438 | write_v_run_expected examples/graphs/dijkstra.v "$tmp/dijkstra.expected" |
| 439 | write_v_run_expected examples/graphs/topological_sorting_greedy.v "$tmp/topological_sorting_greedy.expected" |
| 440 | write_v_run_expected examples/graphs/topological_sorting_dfs.v "$tmp/topological_sorting_dfs.expected" |
| 441 | write_v_run_expected examples/graphs/dfs2.v "$tmp/dfs2.expected" |
| 442 | write_v_run_expected examples/graphs/minimal_spann_tree_prim.v "$tmp/minimal_spann_tree_prim.expected" |
| 443 | write_v_run_expected examples/graphs/bellman-ford.v "$tmp/bellman_ford.expected" |
| 444 | write_v_run_expected examples/binary_search_tree.v "$tmp/binary_search_tree.expected" |
| 445 | printf 'wrong format\nempty input\n' > "$tmp/errors.expected" |
| 446 | write_v_run_expected examples/custom_error.v "$tmp/custom_error.expected" |
| 447 | write_v_run_expected examples/spectral.v "$tmp/spectral_10.expected" 10 |
| 448 | printf 'length of random array is 1000\nbefore quick sort whether array is sorted: false\nafter quick sort whether array is sorted: true\n' > "$tmp/quick_sort.expected" |
| 449 | printf 'hello\nworld\n' > "$tmp/get_raw_line.in" |
| 450 | write_v_run_expected_with_stdin examples/get_raw_line.v "$tmp/get_raw_line.in" "$tmp/get_raw_line.expected" |
| 451 | printf '3+4*2\nexit\n' > "$tmp/mini_calculator.in" |
| 452 | write_v_run_expected_with_stdin examples/mini_calculator.v "$tmp/mini_calculator.in" "$tmp/mini_calculator.expected" |
| 453 | printf '3+4*2\nexit\n' > "$tmp/mini_calculator_recursive_descent.in" |
| 454 | write_v_run_expected_with_stdin examples/mini_calculator_recursive_descent.v "$tmp/mini_calculator_recursive_descent.in" "$tmp/mini_calculator_recursive_descent.expected" |
| 455 | |
| 456 | run_native_x64_example examples/hello_world.v hello_world "$tmp/hello_world.expected" |
| 457 | run_native_x64_example examples/fizz_buzz.v fizz_buzz "$tmp/fizz_buzz.expected" |
| 458 | run_native_x64_example examples/hanoi.v hanoi "$tmp/hanoi.expected" |
| 459 | run_native_x64_example examples/sudoku.v sudoku "$tmp/sudoku.expected" |
| 460 | run_native_x64_example examples/function_types.v function_types "$tmp/function_types.expected" |
| 461 | run_native_x64_example examples/submodule/main.v submodule "$tmp/submodule.expected" |
| 462 | run_native_x64_example examples/fibonacci.v fibonacci "$tmp/fibonacci_10.expected" 10 |
| 463 | run_native_x64_example examples/dump_factorial.v dump_factorial "$tmp/dump_factorial.expected" |
| 464 | run_native_x64_example examples/primes.v primes "$tmp/primes_20.expected" 20 |
| 465 | run_native_x64_example examples/tree_of_nodes.v tree_of_nodes "$tmp/tree_of_nodes.expected" |
| 466 | run_native_x64_example examples/js_hello_world.v js_hello_world "$tmp/js_hello_world.expected" |
| 467 | run_native_x64_example examples/vascii.v vascii "$tmp/vascii.expected" |
| 468 | run_native_x64_example examples/rune.v rune "$tmp/rune.expected" |
| 469 | run_native_x64_example examples/graphs/bfs.v bfs "$tmp/bfs.expected" |
| 470 | run_native_x64_example examples/graphs/bfs3.v bfs3 "$tmp/bfs3.expected" |
| 471 | run_native_x64_example examples/graphs/dfs.v dfs "$tmp/dfs.expected" |
| 472 | run_native_x64_example examples/graphs/dijkstra.v dijkstra "$tmp/dijkstra.expected" |
| 473 | run_native_x64_example examples/graphs/topological_sorting_greedy.v topological_sorting_greedy "$tmp/topological_sorting_greedy.expected" |
| 474 | run_native_x64_example examples/graphs/topological_sorting_dfs.v topological_sorting_dfs "$tmp/topological_sorting_dfs.expected" |
| 475 | run_native_x64_example examples/graphs/dfs2.v dfs2 "$tmp/dfs2.expected" |
| 476 | run_native_x64_example examples/graphs/minimal_spann_tree_prim.v minimal_spann_tree_prim "$tmp/minimal_spann_tree_prim.expected" |
| 477 | run_native_x64_example examples/graphs/bellman-ford.v bellman_ford "$tmp/bellman_ford.expected" |
| 478 | run_native_x64_example examples/binary_search_tree.v binary_search_tree "$tmp/binary_search_tree.expected" |
| 479 | run_native_x64_example examples/errors.v errors "$tmp/errors.expected" |
| 480 | run_native_x64_example examples/custom_error.v custom_error "$tmp/custom_error.expected" |
| 481 | run_native_x64_example examples/spectral.v spectral "$tmp/spectral_10.expected" 10 |
| 482 | run_native_x64_example examples/quick_sort.v quick_sort "$tmp/quick_sort.expected" |
| 483 | run_native_x64_example_with_stdin examples/get_raw_line.v get_raw_line "$tmp/get_raw_line.in" "$tmp/get_raw_line.expected" |
| 484 | run_native_x64_example_with_stdin examples/mini_calculator.v mini_calculator "$tmp/mini_calculator.in" "$tmp/mini_calculator.expected" |
| 485 | run_native_x64_example_with_stdin examples/mini_calculator_recursive_descent.v mini_calculator_recursive_descent "$tmp/mini_calculator_recursive_descent.in" "$tmp/mini_calculator_recursive_descent.expected" |
| 486 | run_native_x64_example_capture examples/random_ips.v random_ips |
| 487 | check_random_ips_stdout random_ips "$tmp/random_ips.out" |
| 488 | run_native_x64_example_capture examples/rule110.v rule110 31 |
| 489 | check_rule110_stdout rule110 "$tmp/rule110.out" 31 |
| 490 | - name: All code is formatted |
| 491 | run: v run ci/linux_ci.vsh all_code_is_formatted_gcc |
| 492 | - name: Install dependencies for examples and tools |
| 493 | run: v run ci/linux_ci.vsh install_dependencies_for_examples_and_tools_gcc |
| 494 | - name: Recompile V with -cstrict and gcc |
| 495 | run: v run ci/linux_ci.vsh recompile_v_with_cstrict_gcc |
| 496 | - name: Valgrind v.c |
| 497 | run: v run ci/linux_ci.vsh valgrind_v_c_gcc |
| 498 | - name: Run sanitizers |
| 499 | run: v run ci/linux_ci.vsh run_sanitizers_gcc |
| 500 | - name: v self compilation |
| 501 | run: v run ci/linux_ci.vsh v_self_compilation_gcc |
| 502 | - name: v self compilation with -usecache |
| 503 | run: v run ci/linux_ci.vsh v_self_compilation_usecache_gcc |
| 504 | - name: Verify `v test` works |
| 505 | run: v run ci/linux_ci.vsh verify_v_test_works_gcc |
| 506 | - name: Test pure V math module |
| 507 | run: v run ci/linux_ci.vsh test_pure_v_math_module_gcc |
| 508 | - name: Self tests |
| 509 | run: v run ci/linux_ci.vsh self_tests_gcc |
| 510 | - name: Self tests (-prod) |
| 511 | run: v run ci/linux_ci.vsh self_tests_prod_gcc |
| 512 | - name: Self tests (-cstrict) |
| 513 | run: v run ci/linux_ci.vsh self_tests_cstrict_gcc |
| 514 | - name: Build examples |
| 515 | run: v run ci/linux_ci.vsh build_examples_gcc |
| 516 | - name: Build tetris with -autofree |
| 517 | run: v run ci/linux_ci.vsh build_tetris_autofree_gcc |
| 518 | - name: Build blog tutorial with -autofree |
| 519 | run: v run ci/linux_ci.vsh build_blog_autofree_gcc |
| 520 | - name: Build option_test.c.v with -autofree |
| 521 | run: v run ci/linux_ci.vsh build_option_test_autofree_gcc |
| 522 | - name: V self compilation with -parallel-cc |
| 523 | run: v run ci/linux_ci.vsh v_self_compilation_parallel_cc_gcc |
| 524 | - name: Build modules |
| 525 | run: v run ci/linux_ci.vsh build_modules_gcc |
| 526 | - name: compile vdoctor.v with -prod |
| 527 | run: v run ci/linux_ci.vsh compile_vdoctor_prod_gcc |
| 528 | - name: compile vup.v with -prod |
| 529 | run: v run ci/linux_ci.vsh compile_vup_prod_gcc |
| 530 | |
| 531 | clang-linux: |
| 532 | runs-on: ubuntu-24.04 |
| 533 | timeout-minutes: 121 |
| 534 | env: |
| 535 | VFLAGS: -cc clang |
| 536 | VTEST_SHOW_LONGEST_BY_RUNTIME: 3 |
| 537 | VTEST_SHOW_LONGEST_BY_COMPTIME: 3 |
| 538 | VTEST_SHOW_LONGEST_BY_TOTALTIME: 3 |
| 539 | steps: |
| 540 | - uses: actions/checkout@v6 |
| 541 | - uses: ./.github/actions/cache-apt-packages-action |
| 542 | - name: Build V |
| 543 | run: make -j4 && ./v symlink |
| 544 | - name: All code is formatted |
| 545 | run: v run ci/linux_ci.vsh all_code_is_formatted_clang |
| 546 | - name: Install dependencies for examples and tools |
| 547 | run: v run ci/linux_ci.vsh install_dependencies_for_examples_and_tools_clang |
| 548 | - name: Recompile V with -cstrict and clang |
| 549 | run: v run ci/linux_ci.vsh recompile_v_with_cstrict_clang |
| 550 | - name: Valgrind |
| 551 | run: v run ci/linux_ci.vsh valgrind_clang |
| 552 | - name: Run sanitizers |
| 553 | run: v run ci/linux_ci.vsh run_sanitizers_clang |
| 554 | - name: v self compilation |
| 555 | run: v run ci/linux_ci.vsh v_self_compilation_clang |
| 556 | - name: v self compilation with -usecache |
| 557 | run: v run ci/linux_ci.vsh v_self_compilation_usecache_clang |
| 558 | - name: Verify `v test` works |
| 559 | run: v run ci/linux_ci.vsh verify_v_test_works_clang |
| 560 | - name: Test pure V math module |
| 561 | run: v run ci/linux_ci.vsh test_pure_v_math_module_clang |
| 562 | - name: Self tests |
| 563 | run: v run ci/linux_ci.vsh self_tests_clang |
| 564 | - name: Self tests (vprod) |
| 565 | run: v run ci/linux_ci.vsh self_tests_vprod_clang |
| 566 | - name: Self tests (-cstrict) |
| 567 | run: v run ci/linux_ci.vsh self_tests_cstrict_clang |
| 568 | - name: Build examples |
| 569 | run: v run ci/linux_ci.vsh build_examples_clang |
| 570 | - name: Build examples with -autofree |
| 571 | run: v run ci/linux_ci.vsh build_examples_autofree_clang |
| 572 | - name: Build modules |
| 573 | run: v run ci/linux_ci.vsh build_modules_clang |
| 574 | |