From 43cc09274987b23240b3c5dec0c9498c7b2b3f80 Mon Sep 17 00:00:00 2001 From: Johannes Schmidt Date: Thu, 4 Sep 2025 13:32:14 +0200 Subject: [PATCH] Add Github Problem Matchers actions for GCC/MSVC MSVC needs two matchers: One general matcher for regular single-line warnings, and one multi-line matcher for template warnings that originate from a template in MSVC's library. In the latter case, MSVC prints the path to the actual file that should be annotated several lines down and all lines in between the first line and that line need to be matched by one of the regexps. --- .github/problem-matchers/gcc.json | 17 +++++++++++ .github/problem-matchers/msvc.json | 49 ++++++++++++++++++++++++++++++ .github/workflows/linux.yml | 3 ++ .github/workflows/windows.yml | 4 +++ 4 files changed, 73 insertions(+) create mode 100644 .github/problem-matchers/gcc.json create mode 100644 .github/problem-matchers/msvc.json diff --git a/.github/problem-matchers/gcc.json b/.github/problem-matchers/gcc.json new file mode 100644 index 000000000..e43b91c6f --- /dev/null +++ b/.github/problem-matchers/gcc.json @@ -0,0 +1,17 @@ +{ + "problemMatcher": [ + { + "owner": "gcc-problem-matcher", + "pattern": [ + { + "regexp": "^(?:(?:\\.\\.?)?\\/)?(?:icinga2\\/)?(.*?):(\\d+):(\\d*):?\\s+(?:fatal\\s+)?(warning|error):\\s+(.*)$", + "file": 1, + "line": 2, + "column": 3, + "severity": 4, + "message": 5 + } + ] + } + ] +} diff --git a/.github/problem-matchers/msvc.json b/.github/problem-matchers/msvc.json new file mode 100644 index 000000000..ba0aa32a4 --- /dev/null +++ b/.github/problem-matchers/msvc.json @@ -0,0 +1,49 @@ +{ + "problemMatcher": [ + { + "owner": "msvc-problem-matcher", + "pattern": [ + { + "regexp": "^([^\\s].*icinga2.*)\\((\\d+),?(\\d+)?(?:,\\d+,\\d+)?\\):\\s(error|warning|info)\\s(\\w{1,2}\\d+):\\s([^\\s].*?)\\s\\[(.*)\\]$", + "file": 1, + "line": 2, + "column": 3, + "severity": 4, + "code": 5, + "message": 6, + "fromPath": 7 + } + ] + }, + { + "owner": "msvc-template-problem-matcher", + "pattern": [ + { + "regexp": "^(?:[^\\s].*Microsoft.*)\\(\\d+,?\\d+?(?:,\\d+,\\d+)?\\):\\s(error|warning|info)\\s(\\w{1,2}\\d+):\\s([^\\s].*?)\\s\\[(.*)\\]$", + "severity": 1, + "code": 2, + "message": 3, + "fromPath": 4 + }, + { + "regexp": "^\\s*(?:[^\\s].*Microsoft.*)\\(\\d+,?\\d+?(?:,\\d+,\\d+)?\\):.*$" + }, + { + "regexp": "^\\s*\\(compiling source file '.*?'\\)$" + }, + { + "regexp": "^\\s*(?:[^\\s].*Microsoft.*)\\(\\d+,?\\d+?(?:,\\d+,\\d+)?\\):.*$" + }, + { + "regexp": "^\\s+the template instantiation context \\(the oldest one first\\) is$" + }, + { + "regexp": "^\\s*([^\\s].*icinga2.*)\\((\\d+),?(\\d+)?(?:,\\d+,\\d+)?\\):$", + "file": 1, + "line": 2, + "column": 3 + } + ] + } + ] +} diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index ac09815de..8fd8c080f 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -69,6 +69,9 @@ jobs: - name: Checkout HEAD uses: actions/checkout@v5 + - name: Turn on Problem Matcher + run: echo "::add-matcher::.github/problem-matchers/gcc.json" + - name: Restore/backup ccache uses: actions/cache@v4 with: diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index be5ffe25e..3dd237ee6 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -38,6 +38,10 @@ jobs: Set-PSDebug -Trace 1 & .\doc\win-dev.ps1 + - name: Turn on Problem Matcher + run: | + Write-Host "::add-matcher::.github/problem-matchers/msvc.json" + - name: Binary run: | Set-PSDebug -Trace 1