[CI] Add a clang-tidy build #12
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: clang-tidy | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
jobs: | |
clang-tidy: | |
runs-on: ubuntu-24.04 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Setup Environment | |
env: | |
PROTOBUF_VERSION: '23.3' | |
ABSEIL_CPP_VERSION: '20230125.3' | |
CXX_STANDARD: '14' | |
run: | | |
sudo apt update -y | |
sudo apt install -y --no-install-recommends --no-install-suggests \ | |
build-essential | |
sudo -E ./ci/setup_cmake.sh | |
sudo -E ./ci/setup_ci_environment.sh | |
sudo -E ./ci/setup_googletest.sh | |
sudo -E ./ci/install_abseil.sh | |
sudo -E ./ci/install_protobuf.sh | |
sudo -E ./ci/setup_grpc.sh -m -p protobuf -p abseil-cpp | |
# WITH_OPENTRACING_SHIM and WITH_ETW is not present and will be excluded. | |
- name: Prepare CMake | |
run: | | |
TOPDIR=$(pwd) | |
mkdir -p build && cd build | |
echo "Running cmake..." | |
CC="clang" CXX="clang++" cmake .. \ | |
-DCMAKE_CXX_STANDARD=14 \ | |
-DWITH_STL=CXX14 \ | |
-DWITH_OTLP_HTTP=ON \ | |
-DWITH_OTLP_FILE=ON \ | |
-DWITH_PROMETHEUS=ON \ | |
-DWITH_ZIPKIN=ON \ | |
-DWITH_ABSEIL=ON \ | |
-DWITH_ELASTICSEARCH=ON \ | |
-DWITH_OTLP_HTTP_COMPRESSION=ON \ | |
-DWITH_EXAMPLES=ON \ | |
-DWITH_EXAMPLES_HTTP=ON \ | |
-DBUILD_W3CTRACECONTEXT_TEST=ON \ | |
-DWITH_METRICS_EXEMPLAR_PREVIEW=ON \ | |
-DWITH_ASYNC_EXPORT_PREVIEW=ON \ | |
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON \ | |
-DWITH_OTLP_GRPC=ON \ | |
-DWITH_OTLP_GRPC_SSL_MTLS_PREVIEW=ON | |
cd .. | |
- name: Run Clang-Tidy | |
run: | | |
chmod +x tools/clang-tidy.sh | |
./tools/clang-tidy.sh | tee clang-tidy-output.log | |
- uses: actions/upload-artifact@v4 | |
if: success() || failure() | |
with: | |
name: Logs (clang-tidy) | |
path: clang-tidy-output.log | |
- name: Count Warnings | |
run: | | |
COUNT=$(grep -c "warning:" clang-tidy-output.log) | |
echo "clang-tidy reported ${COUNT} warning(s)" |