Skip to content

Commit 78a6467

Browse files
ci(profiling): add a clang-tidy check
1 parent c6edb37 commit 78a6467

File tree

3 files changed

+26
-1
lines changed

3 files changed

+26
-1
lines changed

.gitlab/native.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,24 @@ include:
2121
echo -e "\e[0Ksection_start:`date +%s`:cargo_test[collapsed=true]\r\e[0Kcargo test"
2222
cargo test --no-fail-fast --locked
2323
echo -e "\e[0Ksection_end:`date +%s`:cargo_test\r\e[0K"
24+
25+
"clang-tidy profiling":
26+
stage: tests
27+
image: registry.ddbuild.io/images/mirror/ubuntu:25.04
28+
tags: ["arch:amd64"]
29+
timeout: 20m
30+
needs: []
31+
before_script:
32+
- apt-get update && apt-get install -y clang clang-tidy cmake bc python3 python3-pip python3-venv curl
33+
- curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain stable -y
34+
- source "$HOME/.cargo/env"
35+
- python3 -m venv /tmp/venv
36+
- source /tmp/venv/bin/activate
37+
- python3 -m pip install setuptools wheel cmake setuptools_rust cython wrapt bytecode envier lz4 grpcio protobuf
38+
script:
39+
- |
40+
echo -e "\e[0Ksection_start:`date +%s`:clang_tidy_build[collapsed=true]\r\e[0Kclang-tidy on profiling C++ code"
41+
source /tmp/venv/bin/activate
42+
python3 -c "import cython; print(cython.__file__)"
43+
ddtrace/internal/datadog/profiling/build_standalone.sh --clangtidy Debug all
44+
echo -e "\e[0Ksection_end:`date +%s`:clang_tidy_build\r\e[0K"

ddtrace/internal/datadog/profiling/build_standalone.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ cmake_args=(
103103
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON
104104
-DCMAKE_VERBOSE_MAKEFILE=ON
105105
-DLIB_INSTALL_DIR=$(realpath $MY_DIR)/lib
106-
-DPython3_ROOT_DIR=$(python3 -c "import sysconfig; print(sysconfig.get_config_var('prefix'))")
106+
-DPython3_ROOT_DIR=$(python3 -c "import sys; print(sys.prefix)")
107107
-DNATIVE_EXTENSION_LOCATION=$(realpath $MY_DIR)/../../native
108108
-DEXTENSION_SUFFIX=$(python3 -c "import sysconfig; print(sysconfig.get_config_var('EXT_SUFFIX'))")
109109
)

ddtrace/internal/datadog/profiling/stack/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ set_target_properties(
3939
include(FetchContent)
4040
include(AnalysisFunc)
4141
include(FindCppcheck)
42+
include(FindClangtidy)
4243

4344
find_package(Python3 COMPONENTS Interpreter Development)
4445

@@ -71,6 +72,9 @@ add_cppcheck_target(
7172
SRC
7273
${CMAKE_CURRENT_SOURCE_DIR}/src)
7374

75+
# Static analysis
76+
add_clangtidy_target(${EXTENSION_NAME})
77+
7478
# Never build with native unwinding, since this is not currently used
7579
target_compile_definitions(${EXTENSION_NAME} PRIVATE UNWIND_NATIVE_DISABLE)
7680

0 commit comments

Comments
 (0)