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

feat(clang-tidy): add clang-tidy-pr-comments #328

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@
- 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-14 libomp-14-dev clang-tidy-15
shell: bash

- name: Set git config
Expand Down Expand Up @@ -113,7 +113,7 @@
if [ "${{ inputs.target-files }}" != "" ]; then
target_files="${{ inputs.target-files }}"
else
mapfile -t package_paths < <(colcon list --paths-only --packages-select ${{ inputs.target-packages }})

Check warning on line 116 in clang-tidy/action.yaml

View workflow job for this annotation

GitHub Actions / spell-check-differential

Unknown word (mapfile)
ignore_patterns=()
ignore_patterns+=( -not -path "*/test/*" )
if [ -f ${{ inputs.clang-tidy-ignore-path }} ]; then
Expand All @@ -139,7 +139,7 @@
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 -clang-tidy-binary /usr/bin/clang-tidy-14 -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 "exit_code=$?" >> $GITHUB_ENV
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
Expand All @@ -152,6 +152,16 @@
with:
files: /tmp/clang-tidy-result/report.log

- name: Setup Problem Matcher
if: ${{ steps.check-report-log-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-log-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
}
]
}
]
}
Loading