Skip to content

Commit

Permalink
Add CI checks with clang-tidy
Browse files Browse the repository at this point in the history
  • Loading branch information
hallfox committed Oct 9, 2024
1 parent cbc13da commit db3f89a
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 25 deletions.
70 changes: 45 additions & 25 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -94,14 +94,7 @@ jobs:
env:
PKG_CONFIG_PATH: /usr/lib/x86_64-linux-gnu/pkgconfig:/opt/bb/lib64/pkgconfig
run: |
cmake -S . -B build/blazingmq -G Ninja \
-DCMAKE_TOOLCHAIN_FILE=${{ github.workspace }}/deps/srcs/bde-tools/BdeBuildSystem/toolchains/linux/gcc-default.cmake \
-DCMAKE_BUILD_TYPE=Debug \
-DBDE_BUILD_TARGET_SAFE=ON \
-DBDE_BUILD_TARGET_64=ON \
-DBDE_BUILD_TARGET_CPP17=ON \
-DCMAKE_PREFIX_PATH=${{ github.workspace }}/deps/srcs/bde-tools/BdeBuildSystem \
-DCMAKE_INSTALL_LIBDIR=lib64
cmake --preset linux-x64-githubci
cmake --build build/blazingmq --parallel 8 --target all
- name: Clean-up build directories before caching
run: |
Expand Down Expand Up @@ -151,14 +144,7 @@ jobs:
env:
PKG_CONFIG_PATH: /usr/lib/x86_64-linux-gnu/pkgconfig:/opt/bb/lib64/pkgconfig
run: |
cmake -S . -B build/blazingmq -G Ninja \
-DCMAKE_TOOLCHAIN_FILE=${{ github.workspace }}/deps/srcs/bde-tools/BdeBuildSystem/toolchains/linux/gcc-default.cmake \
-DCMAKE_BUILD_TYPE=Debug \
-DBDE_BUILD_TARGET_SAFE=ON \
-DBDE_BUILD_TARGET_64=ON \
-DBDE_BUILD_TARGET_CPP17=ON \
-DCMAKE_PREFIX_PATH=${{ github.workspace }}/deps/srcs/bde-tools/BdeBuildSystem \
-DCMAKE_INSTALL_LIBDIR=lib64
cmake --preset linux-x64-githubci
cmake --build build/blazingmq --parallel 8 --target all.t
- name: Run C++ Unit Tests
run: |
Expand Down Expand Up @@ -305,15 +291,7 @@ jobs:
env:
PKG_CONFIG_PATH: /usr/lib/x86_64-linux-gnu/pkgconfig:/opt/bb/lib64/pkgconfig
run: |
cmake -S . -B build/blazingmq -G Ninja \
-DCMAKE_TOOLCHAIN_FILE=${{ github.workspace }}/deps/srcs/bde-tools/BdeBuildSystem/toolchains/linux/gcc-default.cmake \
-DCMAKE_BUILD_TYPE=Debug \
-DBDE_BUILD_TARGET_SAFE=ON \
-DBDE_BUILD_TARGET_64=ON \
-DBDE_BUILD_TARGET_CPP17=ON \
-DCMAKE_PREFIX_PATH=${{ github.workspace }}/deps/srcs/bde-tools/BdeBuildSystem \
-DCMAKE_INSTALL_LIBDIR=lib64 \
-DINSTALL_TARGETS=prometheus
cmake --preset linux-x64-githubci -DINSTALL_TARGETS=prometheus
cmake --build build/blazingmq --parallel 8 --target all
- name: Create prometheus dir
run: mkdir -p prometheus_dir
Expand All @@ -335,6 +313,48 @@ jobs:
- name: Run Prometheus plugin integration test in "push" mode
run: ${{ github.workspace }}/src/plugins/bmqprometheus/tests/bmqprometheus_prometheusstatconsumer_test.py -p ${{ github.workspace }}/build/blazingmq -m push --no-docker

clang_tidy__check:
name: Clang Tidy Check
runs-on: ubuntu-latest
needs: build_dependencies
steps:
- uses: actions/checkout@v4
- name: Get dependencies hash
id: get-hash
run: echo "deps_hash=`cat docker/build_deps.sh | shasum`" >> $GITHUB_OUTPUT
- uses: actions/cache/restore@v4
with:
path: deps
key: deps-${{ steps.get-hash.outputs.deps_hash }}
- name: Set up dependencies
run: |
sudo apt-get update
sudo apt-get install -qy build-essential \
gdb \
curl \
python3.10 \
python3-pip \
cmake \
ninja-build \
pkg-config \
bison \
clang-tidy \
libfl-dev \
libbenchmark-dev \
libgmock-dev \
libz-dev
- name: Install cached non packaged dependencies
working-directory: deps
run: ../docker/build_deps.sh
- name: Configure BlazingMQ
env:
PKG_CONFIG_PATH: /usr/lib/x86_64-linux-gnu/pkgconfig:/opt/bb/lib64/pkgconfig
run: |
CXXFLAGS=-fsyntax-only cmake --preset linux-x64-githubci-cpp03
- name: Run clang-tidy
run: |
run-clang-tidy -p build/blazingmq -checks="-*,clang-analyzer-*"
documentation:
name: "Documentation"
runs-on: ubuntu-latest
Expand Down
27 changes: 27 additions & 0 deletions CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,33 @@
"description": "VCPKG based configuration for building on x86_64-based Linux",
"toolchainFile": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake",
"inherits": "base"
},
{
"name": "linux-x64-githubci",
"description": "GitHub CI based configuration for building on x86_64-based Linux",
"toolchainFile": "$env{GITHUB_WORKSPACE}/deps/srcs/bde-tools/BdeBuildSystem/toolchains/linux/gcc-default.cmake",
"binaryDir": "build/blazingmq",
"generator": "Ninja",
"cacheVariables": {
"CMAKE_EXPORT_COMPILE_COMMANDS": "1",
"CMAKE_BUILD_TYPE": "Debug",
"CMAKE_PREFIX_PATH": "$env{GITHUB_WORKSPACE}/deps/srcs/bde-tools/BdeBuildSystem",
"DCMAKE_INSTALL_LIBDIR": "lib64",
"BDE_BUILD_TARGET_SAFE": true,
"BDE_BUILD_TARGET_64": true,
"BDE_BUILD_TARGET_CPP17": true,
"CMAKE_CXX_STANDARD": "17",
"CMAKE_INSTALL_LIBDIR": "lib64"
}
},
{
"name": "linux-x64-githubci-cpp03",
"description": "GitHub CI based configuration for building on x86_64-based Linux (C++03)",
"inherits": "linux-x64-githubci",
"cacheVariables": {
"BDE_BUILD_TARGET_CPP03": true,
"CMAKE_CXX_STANDARD": "03"
}
}
]
}

0 comments on commit db3f89a

Please sign in to comment.