diff --git a/.github/problem-matchers/register_all.vsh b/.github/problem-matchers/register_all.vsh new file mode 100644 index 00000000000000..72dc9abdbf8004 --- /dev/null +++ b/.github/problem-matchers/register_all.vsh @@ -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}`') +} diff --git a/.github/problem-matchers/v.json b/.github/problem-matchers/v.json new file mode 100644 index 00000000000000..e3620248d374a0 --- /dev/null +++ b/.github/problem-matchers/v.json @@ -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 + } + ] + } + ] +} diff --git a/GNUmakefile b/GNUmakefile index a7f1855f0036ca..feb95bd09995dd 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -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) diff --git a/Makefile b/Makefile index 275aff8c3b4a6e..78ff435881cd74 100644 --- a/Makefile +++ b/Makefile @@ -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 diff --git a/make.bat b/make.bat index f2b8e2171be8ae..9666c0f748884f 100644 --- a/make.bat +++ b/make.bat @@ -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