Skip to content

Commit 651fd37

Browse files
dschosgn
authored andcommitted
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 <[email protected]> Signed-off-by: Đoàn Trần Công Danh <[email protected]>
1 parent bcf50f3 commit 651fd37

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

ci/git-problem-matcher.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,11 @@ then
157157
MAKEFLAGS="$MAKEFLAGS --jobs=10"
158158
test windows != "$CI_OS_NAME" ||
159159
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"
160165
else
161166
echo "Could not identify CI type" >&2
162167
env >&2

0 commit comments

Comments
 (0)