Skip to content

Commit 70e07e2

Browse files
committed
wip
1 parent 9f96750 commit 70e07e2

7 files changed

Lines changed: 51 additions & 29 deletions

File tree

.github/workflows/dev.yml

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,32 @@ name: "Development"
22
on: [pull_request, workflow_dispatch, workflow_call]
33

44
jobs:
5-
format-and-verify-configurations:
5+
verify:
66
runs-on: ubuntu-22.04-arm
77
container:
88
image: datadog/docker-library:dd-trace-cpp-ci-23768e9-arm64
9+
env:
10+
BUILD_DIR: .build
911
steps:
1012
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
1113
- name: Check format
1214
run: bin/check-format
1315
- name: Shellcheck
1416
run: find bin/ -executable -type f -print0 | xargs -0 shellcheck
15-
- name: Verify environment variable allowlist
17+
- name: Verify getenv usage
1618
run: bin/check-environment-variables
19+
- name: Configure
20+
run: bin/with-toolchain llvm cmake . -B ${BUILD_DIR} --preset ci-clang
21+
- name: Build
22+
run: cmake --build ${BUILD_DIR} -j --target config-inversion -v
1723
- name: Verify supported configurations metadata
1824
run: |
1925
tmp_dir="$(mktemp -d)"
2026
trap 'rm -rf "$tmp_dir"' EXIT
21-
cp metadata/supported-configurations.json "$tmp_dir/supported-configurations.json"
22-
bin/generate-supported-configurations
23-
if ! diff -q "$tmp_dir/supported-configurations.json" metadata/supported-configurations.json >/dev/null 2>&1; then
24-
echo "ERROR: metadata/supported-configurations.json got out of sync with implemented configurations. Please run bin/generate-supported-configurations locally."
25-
diff -u "$tmp_dir/supported-configurations.json" metadata/supported-configurations.json || true
27+
./${BUILD_DIR}/tools/config-inversion --output-file "${tmp_dir}/ci-supported-configurations.json"
28+
if ! diff -q "$tmp_dir/ci-supported-configurations.json" "supported-configurations.json" >/dev/null 2>&1; then
29+
echo "ERROR: supported-configurations.json got out of sync with implemented configurations. Please run `./config-inversion --output-file supported-configurations.json` locally."
30+
diff -u "$tmp_dir/supported-configurations.json" supported-configurations.json || true
2631
exit 1
2732
fi
2833
@@ -39,7 +44,7 @@ jobs:
3944
- runner: ubuntu-22.04
4045
arch: x64
4146
docker-arch: amd64
42-
needs: format-and-verify-configurations
47+
needs: verify
4348
runs-on: ${{ matrix.runner }}
4449
container:
4550
image: datadog/docker-library:dd-trace-cpp-ci-23768e9-${{matrix.docker-arch}}
@@ -67,7 +72,7 @@ jobs:
6772
datadog-ci junit upload --service dd-trace-cpp --tags test.source.file:test/*.cpp .build/report.xml
6873
6974
build-linux-bazel:
70-
needs: format-and-verify-configurations
75+
needs: verify
7176
strategy:
7277
fail-fast: false
7378
matrix:
@@ -90,7 +95,7 @@ jobs:
9095
run: bin/with-toolchain ${{ matrix.toolchain }} bazelisk --bazelrc=${{ matrix.bazelrc }} build dd_trace_cpp
9196

9297
build-windows-bazel:
93-
needs: format-and-verify-configurations
98+
needs: verify
9499
runs-on: windows-2022
95100
defaults:
96101
run:
@@ -111,7 +116,7 @@ jobs:
111116
run: bazelisk.exe --bazelrc=${{ matrix.bazelrc }} build dd_trace_cpp
112117

113118
build-windows-cmake:
114-
needs: format-and-verify-configurations
119+
needs: verify
115120
strategy:
116121
fail-fast: false
117122
matrix:

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ endif ()
101101

102102
if (DD_TRACE_BUILD_TOOLS)
103103
include(cmake/deps/cxxopts.cmake)
104-
add_subdirectory(tools)
104+
add_subdirectory(tools/config-inversion)
105105
endif ()
106106

107107
add_library(dd-trace-cpp-objects OBJECT)

CMakePresets.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
"cacheVariables": {
4141
"CMAKE_BUILD_TYPE": "Debug",
4242
"DD_TRACE_ENABLE_SANITIZE": "ON",
43+
"DD_TRACE_BUILD_TOOLS": "ON",
4344
"DD_TRACE_BUILD_TESTING": "ON"
4445
}
4546
}

bin/check-environment-variables

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/bin/sh
2+
# TODO
3+
set -eu
4+
5+
if grep -R -n \
6+
--include='*.c' \
7+
--include='*.cc' \
8+
--include='*.cpp' \
9+
--include='*.cxx' \
10+
--include='*.h' \
11+
--include='*.hpp' \
12+
--exclude='environment.cpp' \
13+
'std::getenv' include src; then
14+
echo "Check failed: std::getenv usage detected."
15+
exit 1
16+
else
17+
echo "Check passed: no std::getenv usage found."
18+
exit 0
19+
fi

tools/CMakeLists.txt

Lines changed: 0 additions & 17 deletions
This file was deleted.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
add_executable(config-inversion main.cpp)
2+
3+
target_include_directories(config-inversion
4+
PRIVATE
5+
${CMAKE_CURRENT_SOURCE_DIR}
6+
${CMAKE_SOURCE_DIR}/include/datadog
7+
)
8+
9+
target_link_libraries(config-inversion
10+
PRIVATE
11+
nlohmann_json::nlohmann_json
12+
cxxopts::cxxopts
13+
dd-trace-cpp::specs
14+
)

0 commit comments

Comments
 (0)