ci: add a problem matcher for GitHub Actions
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>
Johannes Schindelin committed
Apr 11, 2020 at 00:18 UTC
676eb0c1ce0d380478eb16bdc5a3f2a7bc01c1d2
2 files changed
+21
ci/git-problem-matcher.json
new
+16
@@ -0,0 +1,16 @@
1
+{
2
+ "problemMatcher": [
3
+ {
4
+ "owner": "git-test-suite",
5
+ "pattern": [
6
+ {
7
+ "regexp": "^([^ :]+\\.sh):(\\d+): (error|warning|info):\\s+(.*)$",
8
+ "file": 1,
9
+ "line": 2,
10
+ "severity": 3,
11
+ "message": 4
12
+ }
13
+ ]
14
+ }
15
+ ]
16
+}
ci/lib.sh
+5
@@ -157,6 +157,11 @@ then
157
MAKEFLAGS="$MAKEFLAGS --jobs=10"
158
test windows != "$CI_OS_NAME" ||
159
GIT_TEST_OPTS="--no-chain-lint --no-bin-wrappers $GIT_TEST_OPTS"
160
+
161
+ # https://github.com/actions/toolkit/blob/master/docs/commands.md#problem-matchers
162
+ echo "::add-matcher::ci/git-problem-matcher.json"
163
+ test linux-musl = "$jobname" ||
164
+ MAKEFLAGS="$MAKEFLAGS TEST_SHELL_PATH=/bin/sh"
165
else
166
echo "Could not identify CI type" >&2
167
env >&2