Skip to content

Commit db3f89a

Browse files
committed
Add CI checks with clang-tidy
1 parent cbc13da commit db3f89a

File tree

2 files changed

+72
-25
lines changed

2 files changed

+72
-25
lines changed

.github/workflows/build.yaml

+45-25
Original file line numberDiff line numberDiff line change
@@ -94,14 +94,7 @@ jobs:
9494
env:
9595
PKG_CONFIG_PATH: /usr/lib/x86_64-linux-gnu/pkgconfig:/opt/bb/lib64/pkgconfig
9696
run: |
97-
cmake -S . -B build/blazingmq -G Ninja \
98-
-DCMAKE_TOOLCHAIN_FILE=${{ github.workspace }}/deps/srcs/bde-tools/BdeBuildSystem/toolchains/linux/gcc-default.cmake \
99-
-DCMAKE_BUILD_TYPE=Debug \
100-
-DBDE_BUILD_TARGET_SAFE=ON \
101-
-DBDE_BUILD_TARGET_64=ON \
102-
-DBDE_BUILD_TARGET_CPP17=ON \
103-
-DCMAKE_PREFIX_PATH=${{ github.workspace }}/deps/srcs/bde-tools/BdeBuildSystem \
104-
-DCMAKE_INSTALL_LIBDIR=lib64
97+
cmake --preset linux-x64-githubci
10598
cmake --build build/blazingmq --parallel 8 --target all
10699
- name: Clean-up build directories before caching
107100
run: |
@@ -151,14 +144,7 @@ jobs:
151144
env:
152145
PKG_CONFIG_PATH: /usr/lib/x86_64-linux-gnu/pkgconfig:/opt/bb/lib64/pkgconfig
153146
run: |
154-
cmake -S . -B build/blazingmq -G Ninja \
155-
-DCMAKE_TOOLCHAIN_FILE=${{ github.workspace }}/deps/srcs/bde-tools/BdeBuildSystem/toolchains/linux/gcc-default.cmake \
156-
-DCMAKE_BUILD_TYPE=Debug \
157-
-DBDE_BUILD_TARGET_SAFE=ON \
158-
-DBDE_BUILD_TARGET_64=ON \
159-
-DBDE_BUILD_TARGET_CPP17=ON \
160-
-DCMAKE_PREFIX_PATH=${{ github.workspace }}/deps/srcs/bde-tools/BdeBuildSystem \
161-
-DCMAKE_INSTALL_LIBDIR=lib64
147+
cmake --preset linux-x64-githubci
162148
cmake --build build/blazingmq --parallel 8 --target all.t
163149
- name: Run C++ Unit Tests
164150
run: |
@@ -305,15 +291,7 @@ jobs:
305291
env:
306292
PKG_CONFIG_PATH: /usr/lib/x86_64-linux-gnu/pkgconfig:/opt/bb/lib64/pkgconfig
307293
run: |
308-
cmake -S . -B build/blazingmq -G Ninja \
309-
-DCMAKE_TOOLCHAIN_FILE=${{ github.workspace }}/deps/srcs/bde-tools/BdeBuildSystem/toolchains/linux/gcc-default.cmake \
310-
-DCMAKE_BUILD_TYPE=Debug \
311-
-DBDE_BUILD_TARGET_SAFE=ON \
312-
-DBDE_BUILD_TARGET_64=ON \
313-
-DBDE_BUILD_TARGET_CPP17=ON \
314-
-DCMAKE_PREFIX_PATH=${{ github.workspace }}/deps/srcs/bde-tools/BdeBuildSystem \
315-
-DCMAKE_INSTALL_LIBDIR=lib64 \
316-
-DINSTALL_TARGETS=prometheus
294+
cmake --preset linux-x64-githubci -DINSTALL_TARGETS=prometheus
317295
cmake --build build/blazingmq --parallel 8 --target all
318296
- name: Create prometheus dir
319297
run: mkdir -p prometheus_dir
@@ -335,6 +313,48 @@ jobs:
335313
- name: Run Prometheus plugin integration test in "push" mode
336314
run: ${{ github.workspace }}/src/plugins/bmqprometheus/tests/bmqprometheus_prometheusstatconsumer_test.py -p ${{ github.workspace }}/build/blazingmq -m push --no-docker
337315

316+
clang_tidy__check:
317+
name: Clang Tidy Check
318+
runs-on: ubuntu-latest
319+
needs: build_dependencies
320+
steps:
321+
- uses: actions/checkout@v4
322+
- name: Get dependencies hash
323+
id: get-hash
324+
run: echo "deps_hash=`cat docker/build_deps.sh | shasum`" >> $GITHUB_OUTPUT
325+
- uses: actions/cache/restore@v4
326+
with:
327+
path: deps
328+
key: deps-${{ steps.get-hash.outputs.deps_hash }}
329+
- name: Set up dependencies
330+
run: |
331+
sudo apt-get update
332+
sudo apt-get install -qy build-essential \
333+
gdb \
334+
curl \
335+
python3.10 \
336+
python3-pip \
337+
cmake \
338+
ninja-build \
339+
pkg-config \
340+
bison \
341+
clang-tidy \
342+
libfl-dev \
343+
libbenchmark-dev \
344+
libgmock-dev \
345+
libz-dev
346+
- name: Install cached non packaged dependencies
347+
working-directory: deps
348+
run: ../docker/build_deps.sh
349+
- name: Configure BlazingMQ
350+
env:
351+
PKG_CONFIG_PATH: /usr/lib/x86_64-linux-gnu/pkgconfig:/opt/bb/lib64/pkgconfig
352+
run: |
353+
CXXFLAGS=-fsyntax-only cmake --preset linux-x64-githubci-cpp03
354+
- name: Run clang-tidy
355+
run: |
356+
run-clang-tidy -p build/blazingmq -checks="-*,clang-analyzer-*"
357+
338358
documentation:
339359
name: "Documentation"
340360
runs-on: ubuntu-latest

CMakePresets.json

+27
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,33 @@
4040
"description": "VCPKG based configuration for building on x86_64-based Linux",
4141
"toolchainFile": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake",
4242
"inherits": "base"
43+
},
44+
{
45+
"name": "linux-x64-githubci",
46+
"description": "GitHub CI based configuration for building on x86_64-based Linux",
47+
"toolchainFile": "$env{GITHUB_WORKSPACE}/deps/srcs/bde-tools/BdeBuildSystem/toolchains/linux/gcc-default.cmake",
48+
"binaryDir": "build/blazingmq",
49+
"generator": "Ninja",
50+
"cacheVariables": {
51+
"CMAKE_EXPORT_COMPILE_COMMANDS": "1",
52+
"CMAKE_BUILD_TYPE": "Debug",
53+
"CMAKE_PREFIX_PATH": "$env{GITHUB_WORKSPACE}/deps/srcs/bde-tools/BdeBuildSystem",
54+
"DCMAKE_INSTALL_LIBDIR": "lib64",
55+
"BDE_BUILD_TARGET_SAFE": true,
56+
"BDE_BUILD_TARGET_64": true,
57+
"BDE_BUILD_TARGET_CPP17": true,
58+
"CMAKE_CXX_STANDARD": "17",
59+
"CMAKE_INSTALL_LIBDIR": "lib64"
60+
}
61+
},
62+
{
63+
"name": "linux-x64-githubci-cpp03",
64+
"description": "GitHub CI based configuration for building on x86_64-based Linux (C++03)",
65+
"inherits": "linux-x64-githubci",
66+
"cacheVariables": {
67+
"BDE_BUILD_TARGET_CPP03": true,
68+
"CMAKE_CXX_STANDARD": "03"
69+
}
4370
}
4471
]
4572
}

0 commit comments

Comments
 (0)