Skip to content

Commit

Permalink
Add clang-tidy PR comment bot
Browse files Browse the repository at this point in the history
  • Loading branch information
nsmithtt committed Nov 14, 2024
1 parent 30d6fff commit 39e44ae
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
17 changes: 17 additions & 0 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,12 +107,29 @@ jobs:
cmake --install ${{ steps.strings.outputs.build-output-dir }} --component Test
- name: Lint
id: lint
shell: bash
if: matrix.build.enable_perf == 'OFF'
run: |
source env/activate
cmake --build ${{ steps.strings.outputs.build-output-dir }} -- clang-tidy
- name: Clang-tidy PR Comments
uses: platisd/clang-tidy-pr-comments@v1
if: failure() && steps.lint.outcome == 'failure'
with:
# The GitHub token (or a personal access token)
github_token: ${{ secrets.GITHUB_TOKEN }}
# The path to the clang-tidy fixes generated above
clang_tidy_fixes: ${{ steps.strings.outputs.build-output-dir }}/clang-tidy-fixes.yml
# Optionally set to true if you want the Action to request
# changes in case warnings are found
request_changes: false
# Optionally set the number of comments per review
# to avoid GitHub API timeouts for heavily loaded
# pull requests
suggestions_per_comment: 10

- name: Run Test
shell: bash
run: |
Expand Down
2 changes: 1 addition & 1 deletion cmake/modules/LintTools.cmake
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# clang-tidy setup
add_custom_target(clang-tidy-filter-out-external-srcs COMMAND python3 ${TTMLIR_SOURCE_DIR}/tools/scripts/filter-compile-commands.py ${TTMLIR_BINARY_DIR}/compile_commands.json "${TTMLIR_SOURCE_DIR}")
add_custom_target(clang-tidy COMMAND run-clang-tidy.py -p ${PROJECT_BINARY_DIR} -warnings-as-errors '*' -extra-arg-before=-DDISABLE_STATIC_ASSERT_TESTS -extra-arg-before=-D__cpp_structured_bindings=202400 DEPENDS clang-tidy-filter-out-external-srcs)
add_custom_target(clang-tidy COMMAND run-clang-tidy.py -p ${PROJECT_BINARY_DIR} -export-fixes clang-tidy-fixes.yaml -warnings-as-errors '*' -extra-arg-before=-DDISABLE_STATIC_ASSERT_TESTS -extra-arg-before=-D__cpp_structured_bindings=202400 DEPENDS clang-tidy-filter-out-external-srcs)
add_custom_target(clang-format COMMAND git-clang-format)

0 comments on commit 39e44ae

Please sign in to comment.