Skip to content

Commit

Permalink
add clang-tidy-pr-comments
Browse files Browse the repository at this point in the history
Signed-off-by: Y.Hisaki <[email protected]>
  • Loading branch information
yhisaki committed Dec 8, 2024
1 parent 196ca1d commit 137318f
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 2 deletions.
14 changes: 12 additions & 2 deletions clang-tidy/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ runs:
- name: Install Clang-Tidy
run: |
sudo apt-get -yqq update
sudo apt-get -yqq install clang-tidy libomp-dev
sudo apt-get -yqq install clang-tidy-15 libomp-15-dev
shell: bash

- name: Set git config
Expand Down Expand Up @@ -139,7 +139,7 @@ runs:
if: ${{ steps.get-target-files.outputs.target-files != '' }}
run: |
mkdir /tmp/clang-tidy-result
run-clang-tidy -p build/ -export-fixes /tmp/clang-tidy-result/fixes.yaml -j $(nproc) ${{ steps.get-target-files.outputs.target-files }} > /tmp/clang-tidy-result/report.log || true
run-clang-tidy-15 -p build/ -export-fixes /tmp/clang-tidy-result/fixes.yaml -j $(nproc) -use-color false ${{ steps.get-target-files.outputs.target-files }} > /tmp/clang-tidy-result/report.log || true
echo "${{ github.event.number }}" > /tmp/clang-tidy-result/pr-id.txt
echo "${{ github.event.pull_request.head.repo.full_name }}" > /tmp/clang-tidy-result/pr-head-repo.txt
echo "${{ github.event.pull_request.head.ref }}" > /tmp/clang-tidy-result/pr-head-ref.txt
Expand All @@ -151,6 +151,16 @@ runs:
with:
files: /tmp/clang-tidy-result/report.log

- name: Setup Problem Matcher
if: ${{ steps.check-report-txt-existence.outputs.exists == 'true' }}
run: echo "::add-matcher::$GITHUB_ACTION_PATH/problem-matcher.json"
shell: bash

- name: Show clang-tidy result
if: ${{ steps.check-report-txt-existence.outputs.exists == 'true' }}
run: cat /tmp/clang-tidy-result/report.log
shell: bash

- name: Check if the fixes.yaml file exists
id: check-fixes-yaml-existence
uses: autowarefoundation/autoware-github-actions/check-file-existence@v1
Expand Down
18 changes: 18 additions & 0 deletions clang-tidy/problem-matcher.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"problemMatcher": [
{
"owner": "clang-tidy",
"pattern": [
{
"regexp": "^(.*):(\\d+):(\\d+):\\s(warning|error):\\s(.*)\\s\\[(.*)\\]$",
"file": 1,
"line": 2,
"column": 3,
"severity": 4,
"message": 5,
"code": 6
}
]
}
]
}

0 comments on commit 137318f

Please sign in to comment.