Skip to content

Commit

Permalink
518 integrate clang tidy workflow with config file (#519)
Browse files Browse the repository at this point in the history
clang-tidy action now uses tidy config instead, updates config to scan for bugprone-* checks, and adds new .dockerignore for clang-tidy container.
  • Loading branch information
mwaxmonsky authored May 14, 2024
1 parent 8c4cff0 commit be095e8
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 6 deletions.
6 changes: 4 additions & 2 deletions .clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ Checks: >
-readability-simplify-boolean-expr,
-readability-magic-numbers,-warnings-as-errors,
-readability-non-const-parameter,
-readability-isolate-declaration,
-readability-isolate-declaration,
bugprone-*,
-bugprone-signal-handler,
WarningsAsErrors: '*'

Expand All @@ -69,4 +71,4 @@ CheckOptions:
- key: readability-implicit-bool-conversion.AllowIntegerConditions
value: 1
- key: readability-implicit-bool-conversion.AllowPointerConditions
value: 1
value: 1
8 changes: 4 additions & 4 deletions .github/workflows/clang-tidy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:

steps:
- name: Check out code, generate compile commands
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
token: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -26,21 +26,21 @@ jobs:
INCLUDE_FILES=$(find include -type f \( -name '*.hpp' -o -name '*.h' -o -name '*.cuh' -o -name '*.inl' \) | grep -v jit | grep -v '.inl' | grep -v '.cuh' )
echo "scanning include files:"
echo ${INCLUDE_FILES} | tr " " "\n"
docker run --name include-scans -e INCLUDE_FILES="${INCLUDE_FILES}" -t micm-clang-tidy bash -c 'time clang-tidy -p ./build/ -checks=-*,bugprone-* -header-filter=$(pwd)/include/.* --extra-arg "-lcudart_static" --extra-arg "-std=c++20" ${INCLUDE_FILES} -- -Iinclude/ -isystem ./cuda-build/_deps/json-src/include'
docker run --name include-scans -e INCLUDE_FILES="${INCLUDE_FILES}" -t micm-clang-tidy bash -c 'time clang-tidy -p ./build/ --config-file="./.clang-tidy" -header-filter=$(pwd)/include/.* --extra-arg "-lcudart_static" --extra-arg "-std=c++20" ${INCLUDE_FILES} -- -Iinclude/ -isystem ./cuda-build/_deps/json-src/include'
continue-on-error: true

- name: Scan CUDA source
run: |
SOURCE_FILES=$(find src -type f \( -name '*.cu' -o -name '*.hpp' -o -name '*.h' -o -name '*.cpp' \))
echo "scanning src files:"
echo ${SOURCE_FILES} | tr " " "\n"
docker run --name source-scans -e SOURCE_FILES="${SOURCE_FILES}" -t micm-clang-tidy bash -c 'time clang-tidy -p ./cuda-build/ -checks=-*,bugprone-* -header-filter=$(pwd)/include/.* --extra-arg "-lcudart_static" --extra-arg "-std=c++20" --extra-arg "--cuda-gpu-arch=sm_70" ${SOURCE_FILES} -- -Iinclude/ -isystem ./cuda-build/_deps/googletest-src/googletest/include -isystem ./cuda-build/_deps/json-src/include'
docker run --name source-scans -e SOURCE_FILES="${SOURCE_FILES}" -t micm-clang-tidy bash -c 'time clang-tidy -p ./cuda-build/ --config-file="./.clang-tidy" -header-filter=$(pwd)/include/.* --extra-arg "-lcudart_static" --extra-arg "-std=c++20" --extra-arg "--cuda-gpu-arch=sm_70" ${SOURCE_FILES} -- -Iinclude/ -isystem ./cuda-build/_deps/googletest-src/googletest/include -isystem ./cuda-build/_deps/json-src/include'
continue-on-error: true

- name: Scan Test files
run: |
TEST_FILES=$(find test -type f \( -name '*.hpp' -o -name '*.h' -o -name '*.cpp' -o -name '*.cuh' -o -name '*.cu' \) ! -path 'test/tutorial/*' ! -path '**/*.cuh' ! -path '**/*jit*' )
echo "scanning test files:"
echo ${TEST_FILES} | tr " " "\n"
docker run --name test-scans -e TEST_FILES="${TEST_FILES}" -t micm-clang-tidy bash -c 'time clang-tidy -p ./cuda-build/ -checks=-*,bugprone-* -header-filter=$(pwd)/include/.* --extra-arg "-lcudart_static" --extra-arg "-std=c++20" --extra-arg "--cuda-gpu-arch=sm_70" ${TEST_FILES} -- -Iinclude/ -isystem ./cuda-build/_deps/googletest-src/googletest/include -isystem ./cuda-build/_deps/json-src/include'
docker run --name test-scans -e TEST_FILES="${TEST_FILES}" -t micm-clang-tidy bash -c 'time clang-tidy -p ./cuda-build/ --config-file="./.clang-tidy" -header-filter=$(pwd)/include/.* --extra-arg "-lcudart_static" --extra-arg "-std=c++20" --extra-arg "--cuda-gpu-arch=sm_70" ${TEST_FILES} -- -Iinclude/ -isystem ./cuda-build/_deps/googletest-src/googletest/include -isystem ./cuda-build/_deps/json-src/include'
continue-on-error: true
16 changes: 16 additions & 0 deletions docker/Dockerfile.clang-tidy.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# ignore all
*

# include things to copy
!CMakeLists.txt
!src/
!docs/
!libs/
!test/
!etc/
!examples/
!cmake/
!packaging
!include/
!examples
!.clang-tidy

0 comments on commit be095e8

Please sign in to comment.