-
Notifications
You must be signed in to change notification settings - Fork 596
Add Github Problem Matchers actions for GCC/MSVC #10551
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
1996600
to
9be5de1
Compare
Shouldn't the warnings show up in the "Files changed" tab? If I look at this right now, I even see "Unchanged files with check annotations" at the bottom, so if there was a warning within the actually changed lines of the PR, I'd expect it to show there?
I've seen this before, but only because I made the mistake to try the Copilot "feature" to explain pipeline errors and is said this message from a cleanup step at the end was the cause for a C++ compile error way before that was actually the error failing the pipeline. So not new, but if it wasn't for that, I'd have never seen it before and also didn't look into it further.
Something like that would have been my future plan, but if the warnings don't even show up in a useful place, that wouldn't be of much help.
I mean it's possible to submit completely custom status checks (see cla-bot for example), but then you're down to writing a custom GitHub API/webhook integration for a linter (I don't know if you can show more than ok/failed from a GH Actions workflow). But my hope would have been that these problem matchers give all we need basically for free. |
I've just pushed my commit that adds a test warning again (I had previously removed it) to see if that works. It didn't work before because the problem matcher didn't know what to do with the file paths we get in our warnings (i.e. "/icinga2/lib/foo/bar" or "../lib/foo/bar"). I've adapted the regex to strip away the prefixes and now the annotations seem to point to actual files. However, it still seems like only links to changed files actually work. I would have expected that links from Checks to files not changed in the PR would lead to the master branch version of the file, but it then seems to link to the first file in "Files Changed". So lets see if links from Checks and annotations in Files Changed work now. Edit: Seems to work. |
We're mounting the source into the container at a location that's different from the path used on the runner directly: icinga2/.github/workflows/linux.yml Lines 87 to 88 in 87df80d
So yeah, there's a good chance that it can only handle (absolute) paths if they point into the directory the source is checkout out to on the runner. |
da29eeb
to
4d72f29
Compare
It seems I misunderstood multi-line matching. From the docs it seemed
|
f8af569
to
35943b9
Compare
I think the regexes should be ok now. I've also added a commit that turns on |
35943b9
to
847ba8f
Compare
1020c6b
to
6350246
Compare
f5a4028
to
b4347c2
Compare
The only way I could do this was add a second matcher, because the variables file, line and column can only be matched in a single expression. I really wish these actions were more flexible so you could match multi-line errors in a single expression or could conditionally overwrite variables in successive matches (or concatenate in case of message). But what do I expect from something that was made for VS Code by Microsoft and then ported to Github. 🤷 |
|
dd4e7e0
to
274343d
Compare
|
274343d
to
276b91e
Compare
debian:*|ubuntu:*) | ||
CMAKE_OPTS+=(-DICINGA2_LTO_BUILD=ON) | ||
CMAKE_OPTS+=(-DICINGA2_LTO_BUILD=ON -DCMAKE_{C,CXX}_FLAGS="${WARN_FLAGS}") | ||
source <(dpkg-buildflags --export=sh) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The purpose of source <(dpkg-buildflags --export=sh)
is to initialize environment variables like CXXFLAGS
. If you now set CMAKE_CXX_FLAGS
, doesn't that ignore the environment variable? According to the documentation:
CMAKE_CXX_FLAGS
: Initialized by theCXXFLAGS
environment variable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I knew that dpkg-buildflags
initialized the env-vars, but what CMake does in this case is a bit sad. There is CMAKE_CXX_FLAGS_INIT
that takes the env-vars into account, but it's only supposed to be for toolchain files.
Now I could either concat the bash or the CMake variables, but I think the bash ones are easier and cleaner.
.github/workflows/windows.yml
Outdated
Write-Host "::add-matcher::.github/problem-matchers/msvc.json" | ||
Write-Host "::add-matcher::.github/problem-matchers/msvc-templates.json" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does that actually need two files? The value of "problemMatcher"
in the JSON is an array, so couldn't both be placed in the same file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I tried that and it didn't work. I don't remember exactly if it always took the first matcher or the last, but they didn't work in parallel.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've looked it up: I tried that in 7c6476b. Only the second matcher did anything. But I made updates to the regex after that, so I'll give it another shot with the current regexes.
1cabc3f
to
ec1fabf
Compare
If any other warnings feel superfluous we can disable those as well (many warnings in |
bac2871
to
b7da8c5
Compare
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.
With some exceptions.
b7da8c5
to
47a9dab
Compare
|
Closes #10545
This PR adds Github Problem Matchers for GCC and MSVC. Warnings are highlighted during compilation and annotations are added at the top of the runner page after they finish. If these annotations appear in files that are part of a PR, they area also highlighted on the "Files changed" page, directly in the code and with a warning symbol in the file list.
I've also enabled
-Wall -Wextra
on all Linux runners now. We can still discuss this and disable individual warnings we disagree with via-Wno-foo
.This PR also removes a few various non-code-related warnings.
BOOST_COROUTINES_NO_DEPRECATION_WARNING
on amazonlinux:2