Skip to content

Commit

Permalink
ci: make examples/build_examples.vsh print more details about failure…
Browse files Browse the repository at this point in the history
…s, and about the used V executable
  • Loading branch information
spytheman committed Dec 8, 2024
1 parent 00e6a09 commit 31139d5
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions examples/build_examples.vsh
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
#!/usr/bin/env -S v

import os

const vexe = os.quoted_path(@VEXE)

fn println_one_of_many(msg string, entry_idx int, entries_len int) {
eprintln('${entry_idx + 1:2}/${entries_len:-2} ${msg}')
}

print('v version: ${execute('v version').output}')
println('v executable: ${vexe}')
print('v version: ${execute('${vexe} version').output}')
examples_dir := join_path(@VMODROOT, 'examples')
mut all_entries := walk_ext(examples_dir, '.v')
Expand All @@ -31,13 +36,17 @@ mut err := 0
mut failures := []string{}
chdir(examples_dir)!
for entry_idx, entry in entries {
cmd := 'v -N -W ${entry}'
cmd := '${vexe} -N -W ${entry}'
println_one_of_many('compile with: ${cmd}', entry_idx, entries.len)
ret := execute(cmd)
if ret.exit_code != 0 {
err++
eprintln('>>> FAILURE')
failures << cmd
eprintln('>>> FAILURE')
eprintln('>>> err:')
eprintln('----------------------------------------------------------------------------------')
eprintln(ret.output)
eprintln('----------------------------------------------------------------------------------')
}
}
Expand Down

0 comments on commit 31139d5

Please sign in to comment.