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:
Daniel Widgren
2026-03-14 16:43:14 +00:00
committed by GitHub
parent b3cbb6afbf
commit cfafb69ddd
5 changed files with 254 additions and 18 deletions
+14 -9
View File
@@ -80,6 +80,7 @@ async function installOTP(otpSpec) {
},
})
core.setOutput('otp-version', otpVersion)
maybeEnableProblemMatchers('erlang')
core.endGroup()
return otpVersion
@@ -101,7 +102,7 @@ async function maybeInstallElixir(elixirSpec) {
},
})
core.setOutput('elixir-version', elixirVersion)
maybeEnableElixirProblemMatchers()
maybeEnableProblemMatchers('elixir')
core.endGroup()
installed = true
@@ -110,14 +111,18 @@ async function maybeInstallElixir(elixirSpec) {
return installed
}
function maybeEnableElixirProblemMatchers() {
const disableProblemMatchers = getInput('disable_problem_matchers', false)
if (disableProblemMatchers === 'false') {
// path.join helps ncc figure this out
const elixirMatchers = path.join(
`${__dirname}/../matchers/elixir-matchers.json`,
)
core.info(`##[add-matcher]${elixirMatchers}`)
function problemMatchersEnabled() {
return 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: path.join(`${__dirname}/../matchers/erlang-matchers.json`),
elixir: path.join(`${__dirname}/../matchers/elixir-matchers.json`),
}
core.info(`##[add-matcher]${matcherFiles[language]}`)
}
}