Skip to content

Commit

Permalink
ci: add a vtcc step (check that vtcc, continues to be able to compile…
Browse files Browse the repository at this point in the history
… with v, and v itself can be compiled with vtcc) (#21000)
  • Loading branch information
spytheman committed Mar 12, 2024
1 parent d6236e1 commit a023fe3
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 0 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/compile_v_with_vtcc.sh
@@ -0,0 +1,40 @@
#!/bin/bash

set -ex

function show() {
printf "\u001b[35m$1\u001b[0m\n"
}

show "Prepare"
rm -rf vtcc/

show "Clone vtcc"
git clone https://github.com/felipensp/vtcc --branch stable --quiet vtcc/
du -s vtcc/
## TODO: just `./v vtcc`, later will cause V, to detect the compiler as tcc (which it is), and add `-fwrapv`, which causes the vtcc compiler to panic currently
show "Compile vtcc"
./v -o vtcc/xx vtcc/
ls -la vtcc/xx
./vtcc/xx --version

show "Generate the C file, for the current V version"
./v -o vlang.c cmd/v
ls -la vlang.c

show "Compile the C file with vtcc"
export tcclib=thirdparty/tcc/lib/tcc
export tccinc=$tcclib/include
./vtcc/xx -o v_compiled_with_vtcc vlang.c -L$tcclib -I$tccinc -lc -ldl -pthread -ltcc1 $tcclib/bt-log.o
ls -la v_compiled_with_vtcc

show "Test the resulting V compiler"
./v_compiled_with_vtcc version
./v_compiled_with_vtcc -showcc run examples/hello_world.v

## TODO: this step passes locally, but fails on the main CI:
## show "Compile and run hello with vtcc"
## ./v_compiled_with_vtcc -showcc -cc ./vtcc/xx run examples/hello_world.v

show "Remove the generated temporary files, so the script can be re-run cleanly"
rm -rf v_compiled_with_vtcc vlang.c vtcc/
3 changes: 3 additions & 0 deletions .github/workflows/v_apps_and_modules_compile_ci.yml
Expand Up @@ -27,6 +27,9 @@ jobs:
sudo apt-get install --quiet -y libgc-dev libsodium-dev libssl-dev sqlite3 libsqlite3-dev libfreetype6-dev libxi-dev libxcursor-dev libgl-dev xfonts-75dpi xfonts-base
sudo apt-get install --quiet -y --no-install-recommends sassc libgit2-dev ## needed by gitly
- name: Test vtcc
run: .github/workflows/compile_v_with_vtcc.sh

- name: Test vsql compilation and examples
run: |
echo "Install vsql"
Expand Down

0 comments on commit a023fe3

Please sign in to comment.