-
Couldn't load subscription status.
- Fork 597
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
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
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
|
|
That's a change mostly to our CI jobs, so let's just see if this turns out useful. If not, we can still improve it or drop it again (which I don't hope we'll need to do). |
| << "#pragma warning( disable : 4244 )" << std::endl | ||
| << "#pragma warning( disable : 4800 )" << std::endl | ||
| << "#else /* _MSC_VER */" << std::endl | ||
| << "#pragma GCC diagnostic push" << std::endl | ||
| << "#pragma GCC diagnostic ignored \"-Wunused-parameter\"" << std::endl | ||
| << "#pragma GCC diagnostic ignored \"-Wunused-variable\"" << std::endl |
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.
Disabled warnings for unused parameters/variables on generated files (similar to how it had already been on MSVC, or at least I assume that's what the disabled warnings on MSVC are)
MSVC warnings 4244 and 4800 have nothing to do with unused symbols.
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 know that, I was just reusing the #ifdef block. To me, this was a non-exhaustive list, per platform, of warnings we don't want in our generated files. We may also add more warnings later in case they come up.
PS: I now realize this probably needs a version for __clang__ too. I'll add it to #10609.
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.
So you didn't just mix them up while attempting to restore OS symmetry, but you explicitly think the changes highlighted above were a good idea on their own?

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 -Wextraon 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_WARNINGon amazonlinux:2