Skip to content

Commit

Permalink
ci: add a separate cmd/tools testing job (#21344)
Browse files Browse the repository at this point in the history
  • Loading branch information
ttytm committed Apr 25, 2024
1 parent 40da0f7 commit 25da8ff
Show file tree
Hide file tree
Showing 5 changed files with 129 additions and 28 deletions.
25 changes: 14 additions & 11 deletions .github/workflows/linux_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,16 @@ on:
- '**.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: ${{ github.workflow }}-${{ github.ref == 'refs/heads/master' && github.sha || github.ref }}
Expand Down Expand Up @@ -64,9 +69,9 @@ jobs:
- name: Test pure V math module
run: ./v -exclude @vlib/math/*.c.v test vlib/math/
- name: Self tests
run: ./v test-self
run: ./v test-self vlib
# - name: Self tests (-cstrict)
# run: V_CI_CSTRICT=1 ./v -cstrict test-self
# run: V_CI_CSTRICT=1 ./v -cstrict test-self vlib
- name: Build examples
run: ./v -W build-examples
- name: Run the submodule example, using a relative path
Expand Down Expand Up @@ -156,11 +161,11 @@ jobs:
- name: Test pure V math module
run: ./v -exclude @vlib/math/*.c.v test vlib/math/
- name: Self tests
run: ./v test-self
run: ./v test-self vlib
- name: Self tests (-prod)
run: ./v -o vprod -prod cmd/v && ./vprod test-self
run: ./v -o vprod -prod cmd/v && ./vprod test-self vlib
- name: Self tests (-cstrict)
run: VTEST_JUST_ESSENTIAL=1 V_CI_CSTRICT=1 ./v -cc gcc -cstrict test-self
run: VTEST_JUST_ESSENTIAL=1 V_CI_CSTRICT=1 ./v -cc gcc -cstrict test-self vlib
- name: Build examples
run: ./v build-examples
- name: Build tetris with -autofree
Expand Down Expand Up @@ -259,13 +264,11 @@ jobs:
- name: Test pure V math module
run: ./v -exclude @vlib/math/*.c.v test vlib/math/
- name: Self tests
run: ./v test-self
run: ./v test-self vlib
- name: Self tests (vprod)
run: |
./v -o vprod -prod cmd/v
./vprod test-self
run: ./v -o vprod -prod cmd/v && ./vprod test-self vlib
- name: Self tests (-cstrict)
run: VTEST_JUST_ESSENTIAL=1 V_CI_CSTRICT=1 ./vprod -cstrict test-self
run: VTEST_JUST_ESSENTIAL=1 V_CI_CSTRICT=1 ./vprod -cstrict test-self vlib

- name: Build examples
run: ./v build-examples
Expand Down Expand Up @@ -334,4 +337,4 @@ jobs:
# - name: quick debug
# run: ./v -stats vlib/strconv/format_test.v
# - name: Self tests
# run: ./v test-self
# run: ./v test-self vlib
6 changes: 5 additions & 1 deletion .github/workflows/macos_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,15 @@ on:
- '**.md'
- '**.yml'
- '!**/macos_ci.yml'
- 'cmd/tools'
- '!cmd/tools/builders/**.v'
pull_request:
paths-ignore:
- '**.md'
- '**.yml'
- '!**/macos_ci.yml'
- 'cmd/tools'
- '!cmd/tools/builders/**.v'

concurrency:
group: ${{ github.workflow }}-${{ github.ref == 'refs/heads/master' && github.sha || github.ref }}
Expand Down Expand Up @@ -63,7 +67,7 @@ jobs:
- name: Test pure V math module
run: ./v -exclude @vlib/math/*.c.v test vlib/math/
- name: Self tests
run: VJOBS=1 ./v test-self
run: VJOBS=1 ./v test-self vlib
- name: Build examples
run: ./v build-examples
- name: Build tetris with -autofree
Expand Down
20 changes: 8 additions & 12 deletions .github/workflows/sanitized_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ on:
- '!**'
- '!**.md'
- '!**.yml'
- 'cmd/tools/vtest*'
- 'cmd/tools/builders/**.v'
- 'vlib/builtin/**.v'
- 'vlib/strconv/**.v'
- 'vlib/strings/**.v'
Expand All @@ -44,8 +42,6 @@ on:
pull_request:
paths:
- '!**'
- 'cmd/tools/vtest*'
- 'cmd/tools/builders/**.v'
- 'vlib/builtin/**.v'
- 'vlib/strconv/**.v'
- 'vlib/strings/**.v'
Expand Down Expand Up @@ -94,7 +90,7 @@ jobs:
- name: Ensure code is well formatted
run: ./v test-cleancode
- name: Self tests (-fsanitize=undefined)
run: ./v -cflags "-fsanitize=undefined" -o v2 cmd/v && ./v2 -cflags -fsanitize=undefined test-self
run: ./v -cflags "-fsanitize=undefined" -o v2 cmd/v && ./v2 -cflags -fsanitize=undefined test-self vlib
- name: Build examples (V compiled with -fsanitize=undefined)
run: ./v2 build-examples

Expand Down Expand Up @@ -141,11 +137,11 @@ jobs:
- name: Ensure code is well formatted
run: ./v test-cleancode
- name: Self tests (-fsanitize=address)
run: ASAN_OPTIONS=detect_leaks=0 ./v -cflags "-fsanitize=address,pointer-compare,pointer-subtract" test-self
run: ASAN_OPTIONS=detect_leaks=0 ./v -cflags "-fsanitize=address,pointer-compare,pointer-subtract" test-self vlib
- name: Self tests (V compiled with -fsanitize=address)
run:
./v -cflags -fsanitize=address -o v cmd/v &&
ASAN_OPTIONS=detect_leaks=0 ./v -cc tcc test-self -asan-compiler
ASAN_OPTIONS=detect_leaks=0 ./v -cc tcc test-self -asan-compiler vlib
- name: Build examples (V compiled with -fsanitize=address)
run: ASAN_OPTIONS=detect_leaks=0 ./v build-examples

Expand Down Expand Up @@ -175,7 +171,7 @@ jobs:
## .\.github\workflows\windows-install-sqlite.bat
## - name: Self tests (TODO: /fsanitize=address)
## run: |
## .\v.exe -cflags "/fsanitize=address" test-self
## .\v.exe -cflags "/fsanitize=address" test-self vlib

tests-sanitize-address-gcc:
runs-on: ubuntu-20.04
Expand All @@ -197,11 +193,11 @@ jobs:
- name: Ensure code is well formatted
run: ./v test-cleancode
- name: Self tests (-fsanitize=address)
run: ASAN_OPTIONS=detect_leaks=0 ./v -cflags -fsanitize=address test-self
run: ASAN_OPTIONS=detect_leaks=0 ./v -cflags -fsanitize=address test-self vlib
- name: Self tests (V compiled with -fsanitize=address)
run:
./v -cflags -fsanitize=address,pointer-compare,pointer-subtract -o v cmd/v &&
ASAN_OPTIONS=detect_leaks=0 ./v -cc tcc test-self -asan-compiler
ASAN_OPTIONS=detect_leaks=0 ./v -cc tcc test-self -asan-compiler vlib
- name: Build examples (V compiled with -fsanitize=address)
run: ASAN_OPTIONS=detect_leaks=0 ./v build-examples

Expand All @@ -225,10 +221,10 @@ jobs:
- name: Ensure code is well formatted
run: ./v test-cleancode
- name: Self tests (-fsanitize=memory)
run: ./v -cflags -fsanitize=memory test-self
run: ./v -cflags -fsanitize=memory test-self vlib
- name: Self tests (V compiled with -fsanitize=memory)
run: |
./v -cflags -fsanitize=memory -o v cmd/v
./v -cc tcc test-self -msan-compiler
./v -cc tcc test-self -msan-compiler vlib
- name: Build examples (V compiled with -fsanitize=memory)
run: ./v build-examples
94 changes: 94 additions & 0 deletions .github/workflows/tools_ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
name: Tools CI

on:
push:
paths:
- 'cmd/**'
- '!cmd/tools/vpm/**'
- 'vlib/**'
- 'thirdparty/**'
- '!**.md'
- '**/tools_ci.yml'
pull_request:
paths:
- 'cmd/**'
- '!cmd/tools/vpm/**'
- 'vlib/**'
- 'thirdparty/**'
- '!**.md'
- '**/tools_ci.yml'

concurrency:
group: ${{ github.workflow }}-${{ github.ref == 'refs/heads/master' && github.sha || github.ref }}
cancel-in-progress: true

jobs:
linux:
runs-on: ubuntu-20.04
strategy:
matrix:
cc: [tcc, gcc, clang]
fail-fast: false
env:
VFLAGS: -cc ${{ matrix.cc }}
steps:
- uses: actions/checkout@v4
- name: Build V
run: make -j4 && ./v -showcc -o v cmd/v && ./v doctor
- name: Test
run: ./v test-self cmd
- name: Test (-cstrict)
if: ${{ matrix.cc != 'tcc' }}
run: ./v -W -cstrict test-self cmd
- name: Test sanitized
if: ${{ matrix.cc != 'tcc' }}
run: |
if [[ ${{ matrix.cc }} == "clang" ]]; then
cmd="./v -cc clang -cflags -fsanitize=undefined test-self cmd"
echo $cmd && $cmd
cmd="./v -cc clang -cflags -fsanitize=memory test-self cmd"
echo $cmd && $cmd
else
# TODO: enable thread sanitizer after switching to ubuntu-22.04. Ref. https://github.com/orgs/community/discussions/63391
# cmd="./v -cc gcc -cflags -fsanitize=thread test-self cmd"
# echo $cmd && $cmd
cmd="./v -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 cmd/tools"
echo $cmd && $cmd
# cmd="./v -cc gcc -cflags -fsanitize=kernel-address test-self cmd"
# echo $cmd && $cmd
fi
macos:
runs-on: macos-12
strategy:
matrix:
cc: [clang]
fail-fast: false
env:
VFLAGS: -cc ${{ matrix.cc }}
steps:
- uses: actions/checkout@v4
- name: Build V
run: make -j4 && ./v -showcc -o v cmd/v && ./v doctor
- name: Test
run: ./v test-self cmd
- name: Test (-cstrict)
run: ./v -W -cstrict test-self cmd

windows:
runs-on: windows-2019
strategy:
matrix:
cc: [tcc, gcc, msvc]
fail-fast: false
env:
VFLAGS: -cc ${{ matrix.cc }}
steps:
- uses: actions/checkout@v4
- name: Build V
run: ./make.bat -${{ matrix.cc }} && ./v -o v2.exe cmd/v && ./v2 -showcc -o v.exe cmd/v && ./v doctor
- name: Test
run: ./v test-self cmd
- name: Test (-cstrict)
if: ${{ matrix.cc == 'msvc' }}
run: ./v -W -cstrict test-self cmd
12 changes: 8 additions & 4 deletions .github/workflows/windows_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,15 @@ on:
- '**.md'
- '**.yml'
- '!**/windows_ci.yml'
- 'cmd/tools'
- '!cmd/tools/builders/**.v'
pull_request:
paths-ignore:
- '**.md'
- '**.yml'
- '!**/windows_ci.yml'
- 'cmd/tools'
- '!cmd/tools/builders/**.v'

concurrency:
group: ${{ github.workflow }}-${{ github.ref == 'refs/heads/master' && github.sha || github.ref }}
Expand Down Expand Up @@ -50,7 +54,7 @@ jobs:
- name: Test pure V math module
run: ./v -exclude @vlib/math/*.c.v test vlib/math/
- name: Self tests
run: .\v.exe test-self
run: .\v.exe test-self vlib
# - name: Test
# run: .\v.exe test-all
- name: Build option_test.c.v with -autofree
Expand Down Expand Up @@ -101,7 +105,7 @@ jobs:
- name: Self tests
run: |
./v -cg cmd\tools\vtest-self.v
./v test-self
./v test-self vlib
# - name: Test
# run: .\v.exe test-all
- name: Test v->js
Expand Down Expand Up @@ -154,7 +158,7 @@ jobs:
- name: Test pure V math module
run: ./v -exclude @vlib/math/*.c.v test vlib/math/
- name: Self tests
run: ./v test-self
run: ./v test-self vlib
- name: Test v->js
run: ./v -o hi.js examples/hello_v_js.v && node hi.js
- name: Test v binaries
Expand Down Expand Up @@ -196,7 +200,7 @@ jobs:
# run: ./v doc clipboard
#
# - name: Self tests
# run: ./v test-self
# run: ./v test-self vlib
# - name: Test v->js
# run: ./v -o hi.js examples/hello_v_js.v && node hi.js
# - name: Test v binaries
Expand Down

0 comments on commit 25da8ff

Please sign in to comment.