mirror of
https://github.com/vlang/v.git
synced 2025-09-13 09:25:45 -04:00
ci: ensure that all examples can still be compiled, by v
compiled with tcc on macos
This commit is contained in:
parent
9fc3a24ca6
commit
3223da69a1
6
.github/workflows/macos_ci.yml
vendored
6
.github/workflows/macos_ci.yml
vendored
@ -36,6 +36,8 @@ jobs:
|
|||||||
run: make -j4 && ./v symlink
|
run: make -j4 && ./v symlink
|
||||||
- name: Test symlink
|
- name: Test symlink
|
||||||
run: v run ci/macos_ci.vsh test_symlink
|
run: v run ci/macos_ci.vsh test_symlink
|
||||||
|
- name: v doctor
|
||||||
|
run: v run ci/macos_ci.vsh v_doctor
|
||||||
- name: Test cross compilation to Linux
|
- name: Test cross compilation to Linux
|
||||||
run: v run ci/macos_ci.vsh test_cross_compilation
|
run: v run ci/macos_ci.vsh test_cross_compilation
|
||||||
- name: Build V with -cstrict
|
- name: Build V with -cstrict
|
||||||
@ -62,8 +64,8 @@ jobs:
|
|||||||
run: v run ci/macos_ci.vsh build_blog_autofree
|
run: v run ci/macos_ci.vsh build_blog_autofree
|
||||||
- name: Build examples with -prod
|
- name: Build examples with -prod
|
||||||
run: v run ci/macos_ci.vsh build_examples_prod
|
run: v run ci/macos_ci.vsh build_examples_prod
|
||||||
- name: v doctor
|
- name: Build examples with V build with tcc
|
||||||
run: v run ci/macos_ci.vsh v_doctor
|
run: v run ci/macos_ci.vsh build_examples_v_compiled_with_tcc
|
||||||
- name: V self compilation with -usecache
|
- name: V self compilation with -usecache
|
||||||
run: v run ci/macos_ci.vsh v_self_compilation_usecache
|
run: v run ci/macos_ci.vsh v_self_compilation_usecache
|
||||||
- name: V self compilation with -parallel-cc
|
- name: V self compilation with -parallel-cc
|
||||||
|
@ -2,6 +2,7 @@ import os
|
|||||||
|
|
||||||
enum Command {
|
enum Command {
|
||||||
test_symlink
|
test_symlink
|
||||||
|
v_doctor
|
||||||
test_cross_compilation
|
test_cross_compilation
|
||||||
build_with_cstrict
|
build_with_cstrict
|
||||||
all_code_is_formatted
|
all_code_is_formatted
|
||||||
@ -15,7 +16,7 @@ enum Command {
|
|||||||
build_tetris_autofree
|
build_tetris_autofree
|
||||||
build_blog_autofree
|
build_blog_autofree
|
||||||
build_examples_prod
|
build_examples_prod
|
||||||
v_doctor
|
build_examples_v_compiled_with_tcc
|
||||||
v_self_compilation_usecache
|
v_self_compilation_usecache
|
||||||
v_self_compilation_parallel_cc
|
v_self_compilation_parallel_cc
|
||||||
test_password_input
|
test_password_input
|
||||||
@ -47,6 +48,7 @@ fn run_step(step Command) {
|
|||||||
println('Running ${step}...')
|
println('Running ${step}...')
|
||||||
match step {
|
match step {
|
||||||
.test_symlink { test_symlink() }
|
.test_symlink { test_symlink() }
|
||||||
|
.v_doctor { v_doctor() }
|
||||||
.test_cross_compilation { test_cross_compilation() }
|
.test_cross_compilation { test_cross_compilation() }
|
||||||
.build_with_cstrict { build_with_cstrict() }
|
.build_with_cstrict { build_with_cstrict() }
|
||||||
.all_code_is_formatted { all_code_is_formatted() }
|
.all_code_is_formatted { all_code_is_formatted() }
|
||||||
@ -60,7 +62,7 @@ fn run_step(step Command) {
|
|||||||
.build_tetris_autofree { build_tetris_autofree() }
|
.build_tetris_autofree { build_tetris_autofree() }
|
||||||
.build_blog_autofree { build_blog_autofree() }
|
.build_blog_autofree { build_blog_autofree() }
|
||||||
.build_examples_prod { build_examples_prod() }
|
.build_examples_prod { build_examples_prod() }
|
||||||
.v_doctor { v_doctor() }
|
.build_examples_v_compiled_with_tcc { build_examples_v_compiled_with_tcc() }
|
||||||
.v_self_compilation_usecache { v_self_compilation_usecache() }
|
.v_self_compilation_usecache { v_self_compilation_usecache() }
|
||||||
.v_self_compilation_parallel_cc { v_self_compilation_parallel_cc() }
|
.v_self_compilation_parallel_cc { v_self_compilation_parallel_cc() }
|
||||||
.test_password_input { test_password_input() }
|
.test_password_input { test_password_input() }
|
||||||
@ -69,21 +71,6 @@ fn run_step(step Command) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Helper function to execute commands and exit if they fail
|
|
||||||
fn exec(command string) {
|
|
||||||
result := os.system(command)
|
|
||||||
// or {
|
|
||||||
// eprintln('Command failed: $command\nError: $err')
|
|
||||||
// exit(1)
|
|
||||||
//}
|
|
||||||
// if result.exit_code != 0 {
|
|
||||||
if result != 0 {
|
|
||||||
// eprintln('Command failed with code ${result.exit_code}: ${command}\nOutput: ${result.output}')
|
|
||||||
exit(1)
|
|
||||||
}
|
|
||||||
// println(result.output)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Map enum values to human readable step names
|
// Map enum values to human readable step names
|
||||||
fn get_step_name(step Command) string {
|
fn get_step_name(step Command) string {
|
||||||
return match step {
|
return match step {
|
||||||
@ -101,6 +88,7 @@ fn get_step_name(step Command) string {
|
|||||||
.build_tetris_autofree { 'Build tetris with -autofree' }
|
.build_tetris_autofree { 'Build tetris with -autofree' }
|
||||||
.build_blog_autofree { 'Build blog tutorial with -autofree' }
|
.build_blog_autofree { 'Build blog tutorial with -autofree' }
|
||||||
.build_examples_prod { 'Build examples with -prod' }
|
.build_examples_prod { 'Build examples with -prod' }
|
||||||
|
.build_examples_v_compiled_with_tcc { 'Build examples with V build with tcc' }
|
||||||
.v_doctor { 'v doctor' }
|
.v_doctor { 'v doctor' }
|
||||||
.v_self_compilation_usecache { 'V self compilation with -usecache' }
|
.v_self_compilation_usecache { 'V self compilation with -usecache' }
|
||||||
.v_self_compilation_parallel_cc { 'V self compilation with -parallel-cc' }
|
.v_self_compilation_parallel_cc { 'V self compilation with -parallel-cc' }
|
||||||
@ -110,6 +98,14 @@ fn get_step_name(step Command) string {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Helper function to execute commands and exit if they fail
|
||||||
|
fn exec(command string) {
|
||||||
|
result := os.system(command)
|
||||||
|
if result != 0 {
|
||||||
|
exit(result)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Step functions
|
// Step functions
|
||||||
fn test_symlink() {
|
fn test_symlink() {
|
||||||
exec('v symlink')
|
exec('v symlink')
|
||||||
@ -160,6 +156,11 @@ fn build_examples() {
|
|||||||
exec('v build-examples')
|
exec('v build-examples')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn build_examples_v_compiled_with_tcc() {
|
||||||
|
exec('v -o vtcc -cc tcc cmd/v')
|
||||||
|
exec('./vtcc build-examples') // ensure that examples/veb/veb_example.v etc compiles
|
||||||
|
}
|
||||||
|
|
||||||
fn build_tetris_autofree() {
|
fn build_tetris_autofree() {
|
||||||
exec('v -autofree -o tetris examples/tetris/tetris.v')
|
exec('v -autofree -o tetris examples/tetris/tetris.v')
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user