]> git.ipfire.org Git - thirdparty/git.git/commitdiff
ci: add a problem matcher for GitHub Actions
authorJohannes Schindelin <johannes.schindelin@gmx.de>
Fri, 10 Apr 2020 17:18:13 +0000 (00:18 +0700)
committerJunio C Hamano <gitster@pobox.com>
Fri, 10 Apr 2020 17:30:40 +0000 (10:30 -0700)
With this patch, test failures will be annotated with a helpful,
clickable message in GitHub Actions. For details, see
https://github.com/actions/toolkit/blob/master/docs/problem-matchers.md

Note: we need to set `TEST_SHELL_PATH` to Bash so that the problem
matcher is fed a file and line number for each test failure.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Đoàn Trần Công Danh <congdanhqx@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
ci/git-problem-matcher.json [new file with mode: 0644]
ci/lib.sh

diff --git a/ci/git-problem-matcher.json b/ci/git-problem-matcher.json
new file mode 100644 (file)
index 0000000..506dfbd
--- /dev/null
@@ -0,0 +1,16 @@
+{
+    "problemMatcher": [
+        {
+            "owner": "git-test-suite",
+            "pattern": [
+                {
+                    "regexp": "^([^ :]+\\.sh):(\\d+): (error|warning|info):\\s+(.*)$",
+                    "file": 1,
+                    "line": 2,
+                    "severity": 3,
+                    "message": 4
+                }
+            ]
+        }
+    ]
+}
index ff24c547c8bb56a244eb5b1b3ca11e4bd32ea31a..dac36886e3744fba251506be53d48034adcecd17 100755 (executable)
--- a/ci/lib.sh
+++ b/ci/lib.sh
@@ -157,6 +157,11 @@ then
        MAKEFLAGS="$MAKEFLAGS --jobs=10"
        test windows != "$CI_OS_NAME" ||
        GIT_TEST_OPTS="--no-chain-lint --no-bin-wrappers $GIT_TEST_OPTS"
+
+       # https://github.com/actions/toolkit/blob/master/docs/commands.md#problem-matchers
+       echo "::add-matcher::ci/git-problem-matcher.json"
+       test linux-musl = "$jobname" ||
+       MAKEFLAGS="$MAKEFLAGS TEST_SHELL_PATH=/bin/sh"
 else
        echo "Could not identify CI type" >&2
        env >&2