mirror of
https://github.com/erlef/setup-beam.git
synced 2026-07-23 07:06:07 +00:00
feat: add Erlang problem matchers (#433)
* feat: add Erlang problem matchers for erlc, dialyzer, CT, and EUnit Adds GitHub Actions problem matchers for Erlang tooling, matching the existing Elixir matcher support. Covers erlc errors/warnings (which also catches dialyzer output), Common Test failures, and EUnit failures. Closes #390 * chore: rebuild dist bundle and format test file * refactor: move Erlang matchers into installOTP function Moves maybeEnableErlangProblemMatchers() call inside installOTP(), between setOutput and endGroup, matching the Elixir pattern. * refactor: extract generic maybeEnableProblemMatchers function Replaces separate maybeEnableErlangProblemMatchers and maybeEnableElixirProblemMatchers with a single generic maybeEnableProblemMatchers(language) and a problemMatchersEnabled() helper. * fix: use static paths for ncc to resolve matcher JSON files ncc cannot trace dynamic template literals, so the matcher JSON files were not being copied to dist/. Use a static map of paths instead.
This commit is contained in:
Vendored
+66
@@ -0,0 +1,66 @@
|
||||
{
|
||||
"problemMatcher": [
|
||||
{
|
||||
"owner": "erlc-warning",
|
||||
"severity": "warning",
|
||||
"pattern": [
|
||||
{
|
||||
"regexp": "^(\\S+):(\\d+):(\\d+): [wW]arning: (.+)$",
|
||||
"file": 1,
|
||||
"line": 2,
|
||||
"column": 3,
|
||||
"message": 4
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"owner": "erlc-error",
|
||||
"severity": "error",
|
||||
"pattern": [
|
||||
{
|
||||
"regexp": "^(\\S+):(\\d+):(\\d+): (?![wW]arning)(.+)$",
|
||||
"file": 1,
|
||||
"line": 2,
|
||||
"column": 3,
|
||||
"message": 4
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"owner": "ct-failure",
|
||||
"severity": "error",
|
||||
"pattern": [
|
||||
{
|
||||
"regexp": "^(\\S+) failed on line (\\d+)$",
|
||||
"file": 1,
|
||||
"line": 2
|
||||
},
|
||||
{
|
||||
"regexp": "^Reason: (.+)$",
|
||||
"message": 1
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"owner": "eunit-failure",
|
||||
"severity": "error",
|
||||
"pattern": [
|
||||
{
|
||||
"regexp": "^\\S+: .+\\.\\.\\.\\*failed\\*$"
|
||||
},
|
||||
{
|
||||
"regexp": "^in function .+ \\((.+), line (\\d+)\\)$",
|
||||
"file": 1,
|
||||
"line": 2
|
||||
},
|
||||
{
|
||||
"regexp": "^in call from .+$"
|
||||
},
|
||||
{
|
||||
"regexp": "^\\*\\*error:(.+)$",
|
||||
"message": 1
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
Vendored
+14
-9
@@ -57588,6 +57588,7 @@ async function installOTP(otpSpec) {
|
||||
},
|
||||
})
|
||||
setOutput('otp-version', otpVersion)
|
||||
maybeEnableProblemMatchers('erlang')
|
||||
endGroup()
|
||||
|
||||
return otpVersion
|
||||
@@ -57609,7 +57610,7 @@ async function maybeInstallElixir(elixirSpec) {
|
||||
},
|
||||
})
|
||||
setOutput('elixir-version', elixirVersion)
|
||||
maybeEnableElixirProblemMatchers()
|
||||
maybeEnableProblemMatchers('elixir')
|
||||
endGroup()
|
||||
|
||||
installed = true
|
||||
@@ -57618,14 +57619,18 @@ async function maybeInstallElixir(elixirSpec) {
|
||||
return installed
|
||||
}
|
||||
|
||||
function maybeEnableElixirProblemMatchers() {
|
||||
const disableProblemMatchers = setup_beam_getInput('disable_problem_matchers', false)
|
||||
if (disableProblemMatchers === 'false') {
|
||||
// path.join helps ncc figure this out
|
||||
const elixirMatchers = external_node_path_namespaceObject.join(
|
||||
__nccwpck_require__.ab + "elixir-matchers.json",
|
||||
)
|
||||
info(`##[add-matcher]${elixirMatchers}`)
|
||||
function problemMatchersEnabled() {
|
||||
return setup_beam_getInput('disable_problem_matchers', false) === 'false'
|
||||
}
|
||||
|
||||
// path.join with static strings helps ncc resolve and bundle the JSON files
|
||||
function maybeEnableProblemMatchers(language) {
|
||||
if (problemMatchersEnabled()) {
|
||||
const matcherFiles = {
|
||||
erlang: external_node_path_namespaceObject.join(__nccwpck_require__.ab + "erlang-matchers.json"),
|
||||
elixir: external_node_path_namespaceObject.join(__nccwpck_require__.ab + "elixir-matchers.json"),
|
||||
}
|
||||
info(`##[add-matcher]${matcherFiles[language]}`)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user