Skip to content
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

Integration of mull with GitHub Annotations #738

Closed
ligurio opened this issue Jul 9, 2020 · 5 comments
Closed

Integration of mull with GitHub Annotations #738

ligurio opened this issue Jul 9, 2020 · 5 comments
Labels

Comments

@ligurio
Copy link
Contributor

ligurio commented Jul 9, 2020

There is a feature in GitHub when CI post to it an output of static analysers or test output it annotates source code which triggered error. Example:

image

It would be nice to support mull in GitHub Annotations.

GitHub Annotations supported by:

@chgans
Copy link

chgans commented Oct 16, 2020

AFAIU, for CirrusCI you just need to generate a Junit report.

I actually do this in CI, I convert clang-tidy and clazy into a fake test suite report, I use a slightly modified version of https://github.com/PSPDFKit-labs/clang-tidy-to-junit

Basically as long as mull outputs it's diagnostic the same way as clang-tidy, you can use that script.
clang-tidy diagnostics are very similar (same as?) to regular clang/gcc compiler disgnostic messages

See attached screenshot for Jenkins visuals

Screenshot_20201017_095714

@AlexDenisov
Copy link
Member

I believe it's resolved via #917

@AlexDenisov
Copy link
Member

Actually, I'm having issues seeing #917 working, so I'll reopen this one.

@AlexDenisov AlexDenisov reopened this Jan 26, 2022
@daantimmer
Copy link

daantimmer commented Feb 8, 2023

@AlexDenisov I too ran in to this issue and noticed it has nothing to do with mull's github annotations reporter. The generated annotations are fine. What does not work is when mull-runner is executed through ctest. Then ctest prepends each output line with a number of which test executable is executed.
I created a test action to only echo the mull's reporter output with and without what cmake is doing to the output and removing the ctest output makes the github annotation report work as expected:

This does not work:

        echo "1: [info] Github Annotations:"
        echo "1: ::warning file=--redacted--cpp,line=9,col=48,endLine=9,endColumn=49::[cxx_sub_to_add] Replaced - with +"

This does work:

        echo "[info] Github Annotations:"
        echo "::warning file=--redacted--cpp,line=9,col=48,endLine=9,endColumn=49::[cxx_sub_to_add] Replaced - with +"

See:
image

A simple test action that can be used:

---
name: Test Annotate

on:
  push:
  pull_request:
    types: [opened, synchronize, reopened]
  workflow_dispatch:

permissions:
  contents: read

concurrency:
  group: ${{ github.ref }}-${{ github.workflow }}
  cancel-in-progress: true

jobs:
  TestAnnotate:
    runs-on: [--toyourliking--]
    steps:
    - name: Generate Warning Annotations with ctest output
      run: |
        echo "1: [info] Github Annotations:"
        echo "1: ::warning file=redacted,line=9,col=48,endLine=9,endColumn=49::[cxx_sub_to_add] Replaced - with +"
        echo "1: ::warning file=redacted,line=59,col=15,endLine=59,endColumn=17::[cxx_ge_to_gt] Replaced >= with >"
        echo "1: ::warning file=redacted,line=59,col=27,endLine=59,endColumn=29::[cxx_le_to_lt] Replaced <= with <"
    - name: Generate Warning Annotations without ctest output
      run: |
        echo "[info] Github Annotations:"
        echo "::warning file=redacted,line=9,col=48,endLine=9,endColumn=49::[cxx_sub_to_add] Replaced - with +"
        echo "::warning file=redacted,line=59,col=15,endLine=59,endColumn=17::[cxx_ge_to_gt] Replaced >= with >"
        echo "::warning file=redacted,line=59,col=27,endLine=59,endColumn=29::[cxx_le_to_lt] Replaced <= with <"

Ofc replace redacted with whatever you want in your own test repo and the same applies to the runs-on field

@AlexDenisov
Copy link
Member

I was missing the annotations due to the relative path in the logs (../foo.cpp didn't match foo.cpp).
Now fixed #1028

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants