Skip to content

v2: more flat ast fixes (#27303) #25

v2: more flat ast fixes (#27303)

v2: more flat ast fixes (#27303) #25

Workflow file for this run

name: CI Linux
on:
workflow_dispatch:
push:
branches:
- master
paths-ignore:
- '**.md'
- '**.yml'
- '!**/linux_ci.yml'
- 'cmd/tools/**'
- '!cmd/tools/builders/**.v'
pull_request:
paths-ignore:
- '**.md'
- '**.yml'
- '!**/linux_ci.yml'
- 'cmd/tools/**'
- '!cmd/tools/builders/**.v'
concurrency:
group: linux-${{ github.workflow }}-${{ github.ref == 'refs/heads/master' && github.sha || github.ref }}
cancel-in-progress: true
jobs:
tcc-linux:
runs-on: ubuntu-24.04
timeout-minutes: 121
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@v6
- uses: ./.github/actions/cache-apt-packages-action
- name: Build v
run: make -j4 && ./v symlink
- name: Build v with -prealloc
run: v run ci/linux_ci.vsh build_v_with_prealloc
- name: All code is formatted
run: v run ci/linux_ci.vsh all_code_is_formatted_tcc
- name: Install dependencies for examples and tools
run: v run ci/linux_ci.vsh install_dependencies_for_examples_and_tools_tcc
- name: Test v->c
run: v run ci/linux_ci.vsh test_v_to_c_tcc
- name: v self compilation
run: v run ci/linux_ci.vsh v_self_compilation_tcc
- name: v doctor
run: v run ci/linux_ci.vsh v_doctor_tcc
- name: Verify `v test` works
run: v run ci/linux_ci.vsh verify_v_test_works_tcc
- name: Test pure V math module
run: v run ci/linux_ci.vsh test_pure_v_math_module_tcc
- name: Test inline assembly on linux
run: v run ci/linux_ci.vsh test_inline_assembly
- name: Self tests
run: v run ci/linux_ci.vsh self_tests_tcc
- name: Build examples
run: v run ci/linux_ci.vsh build_examples_tcc
- name: Run the submodule example, using a relative path
run: v run ci/linux_ci.vsh run_submodule_example_tcc
- name: Build v tools
run: v run ci/linux_ci.vsh build_tools_tcc
- name: Build v binaries
run: v run ci/linux_ci.vsh build_vbinaries_tcc
- name: Build benches
run: v run ci/linux_ci.vsh build_benches_tcc
- name: Run a VSH script
run: v run ci/linux_ci.vsh run_vsh_script_tcc
- name: Test v tutorials
run: v run ci/linux_ci.vsh test_v_tutorials_tcc
- name: Build cmd/tools/fast
run: v run ci/linux_ci.vsh build_fast_tcc
- name: V self compilation with -usecache
run: v run ci/linux_ci.vsh v_self_compilation_usecache_tcc
- name: Test password input
run: v run ci/linux_ci.vsh test_password_input_tcc
- name: Test readline
run: v run ci/linux_ci.vsh test_readline_tcc
- name: Test leak detector
run: v run ci/linux_ci.vsh test_leak_detector_tcc
- name: Test leak detector not being active for normal compile
run: v run ci/linux_ci.vsh test_leak_detector_not_active_tcc
gcc-linux:
runs-on: ubuntu-24.04
timeout-minutes: 121
env:
VTEST_SHOW_LONGEST_BY_RUNTIME: 3
VTEST_SHOW_LONGEST_BY_COMPTIME: 3
VTEST_SHOW_LONGEST_BY_TOTALTIME: 3
steps:
- uses: actions/checkout@v6
- uses: ./.github/actions/cache-apt-packages-action
- name: Build V
run: make -j4 && ./v symlink
- name: V2 x64 native checks
run: |
set -e
./v test vlib/v2/abi vlib/v2/gen/x64
./v test vlib/v2/ssa/optimize
V2_VERIFY_STRICT=1 ./v test vlib/v2/ssa/optimize
tmp="$(mktemp -d)"
trap 'rm -rf "$tmp"' EXIT
check_empty_stderr() {
label="$1"
stderr="$2"
if [ -s "$stderr" ]; then
echo "::error::$label wrote to stderr"
cat "$stderr"
return 1
fi
}
check_stdout() {
label="$1"
expected="$2"
actual="$3"
if ! cmp -s "$expected" "$actual"; then
echo "::error::$label stdout mismatch"
echo "expected:"
cat "$expected"
echo "actual:"
cat "$actual"
return 1
fi
}
write_fizz_buzz_expected() {
i=1
while [ "$i" -le 100 ]; do
if [ $((i % 15)) -eq 0 ]; then
echo FizzBuzz
elif [ $((i % 3)) -eq 0 ]; then
echo Fizz
elif [ $((i % 5)) -eq 0 ]; then
echo Buzz
else
echo "$i"
fi
i=$((i + 1))
done
}
./v -v2 -b x64 examples/hello_world.v -o "$tmp/hello_world"
"$tmp/hello_world" > "$tmp/hello_world.out" 2> "$tmp/hello_world.err"
printf 'Hello, World!\n' > "$tmp/hello_world.expected"
check_empty_stderr hello_world "$tmp/hello_world.err"
check_stdout hello_world "$tmp/hello_world.expected" "$tmp/hello_world.out"
./v -v2 -b x64 examples/fizz_buzz.v -o "$tmp/fizz_buzz"
"$tmp/fizz_buzz" > "$tmp/fizz_buzz.out" 2> "$tmp/fizz_buzz.err"
write_fizz_buzz_expected > "$tmp/fizz_buzz.expected"
check_empty_stderr fizz_buzz "$tmp/fizz_buzz.err"
check_stdout fizz_buzz "$tmp/fizz_buzz.expected" "$tmp/fizz_buzz.out"
- name: All code is formatted
run: v run ci/linux_ci.vsh all_code_is_formatted_gcc
- name: Install dependencies for examples and tools
run: v run ci/linux_ci.vsh install_dependencies_for_examples_and_tools_gcc
- name: Recompile V with -cstrict and gcc
run: v run ci/linux_ci.vsh recompile_v_with_cstrict_gcc
- name: Valgrind v.c
run: v run ci/linux_ci.vsh valgrind_v_c_gcc
- name: Run sanitizers
run: v run ci/linux_ci.vsh run_sanitizers_gcc
- name: v self compilation
run: v run ci/linux_ci.vsh v_self_compilation_gcc
- name: v self compilation with -usecache
run: v run ci/linux_ci.vsh v_self_compilation_usecache_gcc
- name: Verify `v test` works
run: v run ci/linux_ci.vsh verify_v_test_works_gcc
- name: Test pure V math module
run: v run ci/linux_ci.vsh test_pure_v_math_module_gcc
- name: Self tests
run: v run ci/linux_ci.vsh self_tests_gcc
- name: Self tests (-prod)
run: v run ci/linux_ci.vsh self_tests_prod_gcc
- name: Self tests (-cstrict)
run: v run ci/linux_ci.vsh self_tests_cstrict_gcc
- name: Build examples
run: v run ci/linux_ci.vsh build_examples_gcc
- name: Build tetris with -autofree
run: v run ci/linux_ci.vsh build_tetris_autofree_gcc
- name: Build blog tutorial with -autofree
run: v run ci/linux_ci.vsh build_blog_autofree_gcc
- name: Build option_test.c.v with -autofree
run: v run ci/linux_ci.vsh build_option_test_autofree_gcc
- name: V self compilation with -parallel-cc
run: v run ci/linux_ci.vsh v_self_compilation_parallel_cc_gcc
- name: Build modules
run: v run ci/linux_ci.vsh build_modules_gcc
- name: compile vdoctor.v with -prod
run: v run ci/linux_ci.vsh compile_vdoctor_prod_gcc
- name: compile vup.v with -prod
run: v run ci/linux_ci.vsh compile_vup_prod_gcc
clang-linux:
runs-on: ubuntu-24.04
timeout-minutes: 121
env:
VFLAGS: -cc clang
VTEST_SHOW_LONGEST_BY_RUNTIME: 3
VTEST_SHOW_LONGEST_BY_COMPTIME: 3
VTEST_SHOW_LONGEST_BY_TOTALTIME: 3
steps:
- uses: actions/checkout@v6
- uses: ./.github/actions/cache-apt-packages-action
- name: Build V
run: make -j4 && ./v symlink
- name: All code is formatted
run: v run ci/linux_ci.vsh all_code_is_formatted_clang
- name: Install dependencies for examples and tools
run: v run ci/linux_ci.vsh install_dependencies_for_examples_and_tools_clang
- name: Recompile V with -cstrict and clang
run: v run ci/linux_ci.vsh recompile_v_with_cstrict_clang
- name: Valgrind
run: v run ci/linux_ci.vsh valgrind_clang
- name: Run sanitizers
run: v run ci/linux_ci.vsh run_sanitizers_clang
- name: v self compilation
run: v run ci/linux_ci.vsh v_self_compilation_clang
- name: v self compilation with -usecache
run: v run ci/linux_ci.vsh v_self_compilation_usecache_clang
- name: Verify `v test` works
run: v run ci/linux_ci.vsh verify_v_test_works_clang
- name: Test pure V math module
run: v run ci/linux_ci.vsh test_pure_v_math_module_clang
- name: Self tests
run: v run ci/linux_ci.vsh self_tests_clang
- name: Self tests (vprod)
run: v run ci/linux_ci.vsh self_tests_vprod_clang
- name: Self tests (-cstrict)
run: v run ci/linux_ci.vsh self_tests_cstrict_clang
- name: Build examples
run: v run ci/linux_ci.vsh build_examples_clang
- name: Build examples with -autofree
run: v run ci/linux_ci.vsh build_examples_autofree_clang
- name: Build modules
run: v run ci/linux_ci.vsh build_modules_clang