ci: Extend PHPUnit problem matcher to annotate more test outcomes

The matcher only annotated failures whose output matched a single
layout ("Failed asserting that..." followed by a blank line and
file:line). Extend it so more of the output PHPUnit produces is
surfaced as GitHub annotations:

- Failures with no blank line before file:line
- Failures with a custom assertion message ahead of "Failed asserting",
  with and without a blank line (e.g. BBCTest attribute breakout)
- Risky tests and skipped tests that have a reason, as warnings
- Skipped tests with no reason (header followed by file:line), as warnings
- Tests skipped through @depends, which print no file:line, as warnings

The warning-level matchers exclude "Failed asserting" lines so failures
are not annotated a second time.
This commit is contained in:
John Rayes
2026-10-22 16:48:57 +05:30
committed by Shivam Mathur
parent 7769f838bc
commit fd2044be8d
+66 -15
View File
@@ -3,21 +3,72 @@
{
"owner": "phpunit",
"pattern": [
{
"regexp": "^\\d+\\)\\s.*$"
},
{
"regexp": "^(.*Failed\\sasserting\\sthat.*)$",
"message": 1
},
{
"regexp": "^\\s*$"
},
{
"regexp": "^(.*):(\\d+)$",
"file": 1,
"line": 2
}
{ "regexp": "^\\d+\\)\\s.*$" },
{ "regexp": "^(.*Failed\\sasserting\\sthat.*)$", "message": 1 },
{ "regexp": "^\\s*$" },
{ "regexp": "^(.*):(\\d+)$", "file": 1, "line": 2 }
]
},
{
"owner": "phpunit-no-blank",
"pattern": [
{ "regexp": "^\\d+\\)\\s.*$" },
{ "regexp": "^(.*Failed\\sasserting\\sthat.*)$", "message": 1 },
{ "regexp": "^(.*):(\\d+)$", "file": 1, "line": 2 }
]
},
{
"owner": "phpunit-custom-message",
"pattern": [
{ "regexp": "^\\d+\\)\\s.*$" },
{ "regexp": "^(?!.*Failed\\sasserting)(?!.*:\\d+$)(.+)$", "message": 1 },
{ "regexp": "^.*Failed\\sasserting\\sthat.*$" },
{ "regexp": "^(.*):(\\d+)$", "file": 1, "line": 2 }
]
},
{
"owner": "phpunit-custom-message-blank",
"pattern": [
{ "regexp": "^\\d+\\)\\s.*$" },
{ "regexp": "^(?!.*Failed\\sasserting)(?!.*:\\d+$)(.+)$", "message": 1 },
{ "regexp": "^.*Failed\\sasserting\\sthat.*$" },
{ "regexp": "^\\s*$" },
{ "regexp": "^(.*):(\\d+)$", "file": 1, "line": 2 }
]
},
{
"owner": "phpunit-other-blank",
"severity": "warning",
"pattern": [
{ "regexp": "^\\d+\\)\\s.*$" },
{ "regexp": "^(?!.*Failed\\sasserting)(?!.*:\\d+$)(.+)$", "message": 1 },
{ "regexp": "^\\s*$" },
{ "regexp": "^(.*):(\\d+)$", "file": 1, "line": 2 }
]
},
{
"owner": "phpunit-other",
"severity": "warning",
"pattern": [
{ "regexp": "^\\d+\\)\\s.*$" },
{ "regexp": "^(?!.*Failed\\sasserting)(?!.*:\\d+$)(.+)$", "message": 1 },
{ "regexp": "^(.*):(\\d+)$", "file": 1, "line": 2 }
]
},
{
"owner": "phpunit-skipped-no-reason",
"severity": "warning",
"pattern": [
{ "regexp": "^(\\d+\\)\\s.*)$", "message": 1 },
{ "regexp": "^(.*):(\\d+)$", "file": 1, "line": 2 }
]
},
{
"owner": "phpunit-skipped-depends",
"severity": "warning",
"pattern": [
{ "regexp": "^\\d+\\)\\s(.*)$" },
{ "regexp": "^(This test depends on .*)$", "message": 1 }
]
}
]