#132 Add Clang-Format and Clang-Tidy checks #32
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CMake | |
on: | |
push: | |
branches: ["main"] | |
paths: | |
- "ports/cpp/**" | |
- ".github/workflows/*" | |
pull_request: | |
branches: ["main"] | |
paths: | |
- "ports/cpp/**" | |
- ".github/workflows/*" | |
jobs: | |
build: | |
strategy: | |
matrix: | |
cmake_build_type: [Asan, Release] | |
runs-on: ubuntu-24.04 | |
steps: | |
- 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.cmake_build_type }} | |
- name: Clang-Format | |
working-directory: ${{github.workspace}}/ports/cpp | |
run: | | |
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: | | |
mkdir build | |
cd build | |
cmake \ | |
-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 |