Skip to content
Closed
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 18 additions & 5 deletions .github/workflows/dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: "Development"
on: [pull_request, workflow_dispatch, workflow_call]

jobs:
format:
format-and-verify-configurations:
runs-on: ubuntu-22.04-arm
container:
image: datadog/docker-library:dd-trace-cpp-ci-23768e9-arm64
Expand All @@ -12,6 +12,19 @@ jobs:
run: bin/check-format
- name: Shellcheck
run: find bin/ -executable -type f -print0 | xargs -0 shellcheck
- name: Verify environment variable allowlist
Comment thread
BridgeAR marked this conversation as resolved.
run: bin/check-environment-variables
- name: Verify supported configurations metadata
run: |
tmp_dir="$(mktemp -d)"
trap 'rm -rf "$tmp_dir"' EXIT
cp metadata/supported-configurations.json "$tmp_dir/supported-configurations.json"
bin/generate-supported-configurations
if ! diff -q "$tmp_dir/supported-configurations.json" metadata/supported-configurations.json >/dev/null 2>&1; then
echo "ERROR: metadata/supported-configurations.json got out of sync with implemented configurations. Please run bin/generate-supported-configurations locally."
diff -u "$tmp_dir/supported-configurations.json" metadata/supported-configurations.json || true
exit 1
fi

build-linux-cmake:
strategy:
Expand All @@ -26,7 +39,7 @@ jobs:
- runner: ubuntu-22.04
arch: x64
docker-arch: amd64
needs: format
needs: format-and-verify-configurations
runs-on: ${{ matrix.runner }}
container:
image: datadog/docker-library:dd-trace-cpp-ci-23768e9-${{matrix.docker-arch}}
Expand Down Expand Up @@ -54,7 +67,7 @@ jobs:
datadog-ci junit upload --service dd-trace-cpp --tags test.source.file:test/*.cpp .build/report.xml

build-linux-bazel:
needs: format
needs: format-and-verify-configurations
strategy:
fail-fast: false
matrix:
Expand All @@ -77,7 +90,7 @@ jobs:
run: bin/with-toolchain ${{ matrix.toolchain }} bazelisk --bazelrc=${{ matrix.bazelrc }} build dd_trace_cpp

build-windows-bazel:
needs: format
needs: format-and-verify-configurations
runs-on: windows-2022
defaults:
run:
Expand All @@ -98,7 +111,7 @@ jobs:
run: bazelisk.exe --bazelrc=${{ matrix.bazelrc }} build dd_trace_cpp

build-windows-cmake:
needs: format
needs: format-and-verify-configurations
strategy:
fail-fast: false
matrix:
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ MODULE.bazel.lock
.vscode
.cache/
.cursor/
.DS_Store
.DS_Store
bin/.supported-configurations
31 changes: 30 additions & 1 deletion .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,34 @@
stages:
- shared-pipeline
- benchmarks
- benchmarks-report

include: ".gitlab/benchmarks.yml"
variables:
SKIP_SHARED_PIPELINE: "true"

workflow:
auto_cancel:
on_new_commit: interruptible
rules:
- if: $CI_COMMIT_TAG =~ /^v?[0-9]+\.[0-9]+\.[0-9]+$/
variables:
DANGEROUSLY_SKIP_SHARED_PIPELINE_TESTS: "true"
- when: always

validate_supported_configurations_v2_local_file:
extends: .validate_supported_configurations_v2_local_file
variables:
LOCAL_JSON_PATH: "metadata/supported-configurations.json"
BACKFILLED: "false"

update_central_configurations_version_range_v2:
extends: .update_central_configurations_version_range_v2
variables:
LOCAL_REPO_NAME: "dd-trace-cpp"
LOCAL_JSON_PATH: "metadata/supported-configurations.json"
LANGUAGE_NAME: "cpp"
MULTIPLE_RELEASE_LINES: "false"

include:
- local: ".gitlab/one-pipeline.locked.yml"
- local: ".gitlab/benchmarks.yml"
3 changes: 3 additions & 0 deletions .gitlab/one-pipeline.locked.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# This file should be auto-generated soon.
include:
- remote: https://gitlab-templates.ddbuild.io/libdatadog/one-pipeline/ca/fbfa24e9dd887ed24ce65e71f2e41562c809f40cfc26489705b32406de7e096f/one-pipeline.yml
1 change: 1 addition & 0 deletions BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ cc_library(
"include/datadog/dict_reader.h",
"include/datadog/dict_writer.h",
"include/datadog/environment.h",
"include/datadog/environment_registry.h",
"include/datadog/error.h",
"include/datadog/event_scheduler.h",
"include/datadog/expected.h",
Expand Down
22 changes: 22 additions & 0 deletions bin/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
Scripts
=======

This directory contains scripts that are useful during development.

- [bazel-build](bazel-build) builds the library using [Bazel][1] via [bazelisk][2].
Expand All @@ -8,6 +9,12 @@ This directory contains scripts that are useful during development.
- [check](check) performs some of the checks that [continuous
integration](../.circleci) performs. It's convenient to run this script before
pushing changes.
- [check-environment-variables](check-environment-variables) validates that
all `DD_`/`OTEL_` environment variables used by the codebase are allowlisted
in
[include/datadog/environment_registry.h](../include/datadog/environment_registry.h)
(the source of truth used by
[include/datadog/environment.h](../include/datadog/environment.h)).
- [check-format](check-format) verifies that the source code is formatted as
[format](format) prefers.
- [check-version](check-version) accepts a version string as a command line
Expand All @@ -16,6 +23,21 @@ This directory contains scripts that are useful during development.
- [cmake-build](cmake-build) builds the library using [CMake][3].
- [format](format) formats all of the C++ source code using
[clang-format-14][4].
- [generate-supported-configurations](generate-supported-configurations)
regenerates
[metadata/supported-configurations.json](../metadata/supported-configurations.json)
using
[include/datadog/environment_registry.h](../include/datadog/environment_registry.h)
as the source of truth.
To add a new supported environment variable:
1. update
[include/datadog/environment_registry.h](../include/datadog/environment_registry.h),
2. run [generate-supported-configurations](generate-supported-configurations),
3. run [check-environment-variables](check-environment-variables).
This script (and [check-environment-variables](check-environment-variables))
compiles and executes
[supported-configurations.cpp](supported-configurations.cpp) via
[supported-configurations](supported-configurations).
- [hasher-example](hasher-example) builds the library, including the [command
line example](../examples/hasher) program, and then runs the example.
- [http-server-example](http-server-example) runs the docker compose based [HTTP
Expand Down
6 changes: 6 additions & 0 deletions bin/check-environment-variables
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/sh

set -eu

SCRIPT_DIR=$(cd "$(dirname "$0")" && pwd)
exec "$SCRIPT_DIR/supported-configurations" check
6 changes: 6 additions & 0 deletions bin/generate-supported-configurations
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/sh

set -eu

SCRIPT_DIR=$(cd "$(dirname "$0")" && pwd)
exec "$SCRIPT_DIR/supported-configurations" generate
19 changes: 19 additions & 0 deletions bin/supported-configurations
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/sh

set -eu

SCRIPT_DIR=$(cd "$(dirname "$0")" && pwd)
REPO_ROOT=$(cd "$SCRIPT_DIR/.." && pwd)
SOURCE="$SCRIPT_DIR/supported-configurations.cpp"
BINARY="$SCRIPT_DIR/.supported-configurations"

compiler=${CXX:-c++}

(
# `CXX` may contain wrappers/flags (e.g. "ccache c++").
# shellcheck disable=SC2086
set -- $compiler
"$@" -std=c++17 -O2 -I"$REPO_ROOT/src/datadog" "$SOURCE" -o "$BINARY"
)

exec "$BINARY" "$@"
Loading