Skip to content

Commit

Permalink
ci: add a problem matcher support, to get error/warning/notice annota…
Browse files Browse the repository at this point in the history
…tions in V CI jobs (#22790)
  • Loading branch information
spytheman authored Nov 7, 2024
1 parent f3b1674 commit 0eaa857
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 1 deletion.
19 changes: 19 additions & 0 deletions .github/problem-matchers/register_all.vsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// The task of this program, is to register all available .json files
// in this folder with Github Actions, so that it can make annotations
// for all found notices/warnings/errors produced by the V compiler
// while running the CI jobs.
// Those annotations provide a way to get a quick overview for failures,
// without having to scroll into the detailed logs produced by each job.

const github_job = getenv('GITHUB_JOB')

if github_job == '' {
exit(0)
}

dump(github_job)
chdir(@VEXEROOT)!
for f in walk_ext('.github/problem-matchers/', '.json').sorted() {
println('::add-matcher::${real_path(f)}')
println('registered matcher: `${f}`')
}
18 changes: 18 additions & 0 deletions .github/problem-matchers/v.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"__comment": "Based on https://github.com/python/cpython/blob/main/.github/problem-matchers/gcc.json",
"problemMatcher": [
{
"owner": "v-problem-matcher",
"pattern": [
{
"regexp": "^(.*):(\\d+):(\\d+):\\s+(?:fatal\\s+)?(warning|error|notice):\\s+(.*)$",
"file": 1,
"line": 2,
"column": 3,
"severity": 4,
"message": 5
}
]
}
]
}
1 change: 1 addition & 0 deletions GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ endif
@$(VEXE) run cmd/tools/detect_tcc.v
@echo "V has been successfully built"
@$(VEXE) -version
@$(VEXE) run .github/problem-matchers/register_all.vsh

clean:
rm -rf $(TMPTCC)
Expand Down
4 changes: 3 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@ v:
./v1 -no-parallel -o v2 $(VFLAGS) cmd/v
./v2 -o v $(VFLAGS) cmd/v
rm -rf v1 v2
@echo "V has been successfully built"
./v run ./cmd/tools/detect_tcc.v
@echo "V has been successfully built"
./v version
./v run .github/problem-matchers/register_all.vsh

check:
./v test-all
1 change: 1 addition & 0 deletions make.bat
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,7 @@ echo ^> To add V to your PATH, run `%V_EXE% symlink`.
echo.
echo | set /p="V version: "
"%V_EXE%" version
"%V_EXE%" run .github/problem-matchers/register_all.vsh
goto :eof

:usage
Expand Down

0 comments on commit 0eaa857

Please sign in to comment.