Skip to content

Commit

Permalink
#132 Add Clang-Tidy check
Browse files Browse the repository at this point in the history
Signed-off-by: vityaman <[email protected]>
  • Loading branch information
vityaman committed Jul 29, 2024
1 parent 3ab090e commit 589f084
Show file tree
Hide file tree
Showing 10 changed files with 342 additions and 225 deletions.
31 changes: 23 additions & 8 deletions .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,26 +17,32 @@ jobs:
strategy:
matrix:
cmake_build_type: [Asan, Release]
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v3
- name: Checkout
uses: actions/checkout@v3

- name: Install dependencies
run: |
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
sudo add-apt-repository "deb http://apt.llvm.org/noble/ llvm-toolchain-noble-18 main"
sudo apt update
sudo apt install build-essential
sudo apt install clang-format-18 clang-tidy-18
- name: Setup ccache
uses: hendrikmuhs/[email protected]
with:
create-symlink: true
key: ${{ github.job }}-${{ matrix.os }}
key: ${{ github.job }}-${{ matrix.cmake_build_type }}

- name: Clang-Format
working-directory: ${{github.workspace}}/ports/cpp
run: |
( \
find source test -iname '*.hpp' -o -iname '*.cpp' \
| xargs clang-format -Werror --dry-run \
--fallback-style=Google --verbose \
)
find source test -iname '*.hpp' -o -iname '*.cpp' \
| xargs clang-format-18 -Werror --dry-run \
--fallback-style=Google --verbose
- name: Configure
working-directory: ${{github.workspace}}/ports/cpp
run: |
Expand All @@ -46,11 +52,20 @@ jobs:
-DANTLR4C3_DEVELOPER=ON \
-DCMAKE_BUILD_TYPE=${{ matrix.cmake_build_type }} \
..
- name: Build
working-directory: ${{github.workspace}}/ports/cpp/build
run: make

- name: Unit Test
working-directory: ${{github.workspace}}/ports/cpp/build/test
run: |
ctest
cat Testing/Temporary/LastTest.log
- name: Clang-Tidy on sources
if: matrix.cmake_build_type == 'Release'
working-directory: ${{github.workspace}}/ports/cpp
run: |
find source -iname '*.hpp' -o -iname '*.cpp' \
| xargs clang-tidy-18 -p build/compile_commands.json
1 change: 1 addition & 0 deletions ports/cpp/.clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
Language: Cpp
BasedOnStyle: Google

ColumnLimit: 80
AccessModifierOffset: -2

AllowShortFunctionsOnASingleLine: None
Expand Down
22 changes: 22 additions & 0 deletions ports/cpp/.clang-tidy
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
Checks: '-*,
bugprone-*,
cert-*,
concurrency-*,
cppcoreguidelines-*,
google-*,
hicpp-*,
misc-*,
-misc-no-recursion,
modernize-*,
-modernize-use-trailing-return-type,
performance-*,
readability-*'
WarningsAsErrors: '*'
HeaderFileExtensions:
- hpp
ImplementationFileExtensions:
- cpp
HeaderFilterRegex: ''
FormatStyle: '.clang-format'
SystemHeaders: false
Loading

0 comments on commit 589f084

Please sign in to comment.