Skip to content

Commit

Permalink
Merge branch 'main' into fix-random-memory-leak
Browse files Browse the repository at this point in the history
  • Loading branch information
marcalff authored Jul 19, 2024
2 parents 6b44492 + 4520aa5 commit 1f404a3
Show file tree
Hide file tree
Showing 370 changed files with 8,075 additions and 4,274 deletions.
3 changes: 3 additions & 0 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ common --enable_platform_specific_config
# Needed by gRPC to build on some platforms.
build --copt -DGRPC_BAZEL_BUILD

# Workaround abseil libraries missing symbols
build:windows --dynamic_mode=off

# Set minimum supported C++ version
build:macos --host_cxxopt=-std=c++14 --cxxopt=-std=c++14
build:linux --host_cxxopt=-std=c++14 --cxxopt=-std=c++14
Expand Down
2 changes: 1 addition & 1 deletion .bazelversion
Original file line number Diff line number Diff line change
@@ -1 +1 @@
5.4.1
7.1.1
39 changes: 39 additions & 0 deletions .clang-tidy
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Copyright The OpenTelemetry Authors
# SPDX-License-Identifier: Apache-2.0

Checks: >
-*,
performance-*,
portability-*,
abseil-*,
-abseil-string-find-str-contains,
bugprone-*,
-bugprone-easily-swappable-parameters,
-bugprone-implicit-widening-of-multiplication-result,
-bugprone-inc-dec-in-conditions,
-bugprone-narrowing-conversions,
-bugprone-unchecked-optional-access,
-bugprone-unhandled-exception-at-new,
-bugprone-unused-local-non-trivial-variable,
google-*,
-google-build-using-namespace,
-google-default-arguments,
-google-explicit-constructor,
-google-readability-avoid-underscore-in-googletest-name,
-google-readability-braces-around-statements,
-google-readability-namespace-comments,
-google-readability-todo,
-google-runtime-references,
misc-*,
-misc-const-correctness,
-misc-include-cleaner,
-misc-non-private-member-variables-in-classes,
-misc-unused-alias-decls,
-misc-use-anonymous-namespace,
cppcoreguidelines-*,
-cppcoreguidelines-avoid-c-arrays,
-cppcoreguidelines-avoid-magic-numbers,
-cppcoreguidelines-init-variables,
-cppcoreguidelines-macro-usage,
-cppcoreguidelines-non-private-member-variables-in-classes,
-cppcoreguidelines-pro-*
52 changes: 44 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,37 @@ on:
branches: [ main ]

jobs:
arm64_test:
name: CMake test arm64 (with modern protobuf,grpc and abseil)
runs-on: actuated-arm64-4cpu-16gb
steps:
- uses: actions/checkout@v4
with:
submodules: 'recursive'
- name: setup
env:
PROTOBUF_VERSION: '23.3'
ABSEIL_CPP_VERSION: '20230125.3'
CXX_STANDARD: '14'
CC: /usr/bin/gcc-10
CXX: /usr/bin/g++-10
run: |
sudo -E ./ci/setup_gcc10.sh
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
- name: run otlp exporter tests
env:
CC: /usr/bin/gcc-10
CXX: /usr/bin/g++-10
WITH_ABSEIL: 'ON'
CXX_STANDARD: '14'
run: |
sudo -E ./ci/setup_grpc.sh -m -p protobuf -p abseil-cpp
./ci/do_ci.sh cmake.exporter.otprotocol.test
cmake_test:
name: CMake test (without otlp-exporter)
runs-on: ubuntu-latest
Expand Down Expand Up @@ -41,6 +72,7 @@ jobs:
CXX: /usr/bin/g++-14
PROTOBUF_VERSION: 21.12
run: |
sudo apt remove needrestart #refer: https://github.com/actions/runner-images/issues/9937
sudo -E ./ci/setup_googletest.sh
sudo -E ./ci/setup_ci_environment.sh
sudo -E ./ci/install_protobuf.sh
Expand Down Expand Up @@ -73,6 +105,7 @@ jobs:
CXX: /usr/bin/g++-14
PROTOBUF_VERSION: 21.12
run: |
sudo apt remove needrestart #refer: https://github.com/actions/runner-images/issues/9937
sudo -E ./ci/setup_googletest.sh
sudo -E ./ci/setup_ci_environment.sh
sudo -E ./ci/install_protobuf.sh
Expand Down Expand Up @@ -105,6 +138,7 @@ jobs:
CXX: /usr/bin/clang++-18
PROTOBUF_VERSION: 21.12
run: |
sudo apt remove needrestart #refer: https://github.com/actions/runner-images/issues/9937
sudo -E ./ci/setup_googletest.sh
sudo -E ./ci/setup_ci_environment.sh
sudo -E ./ci/install_protobuf.sh
Expand Down Expand Up @@ -137,6 +171,7 @@ jobs:
CXX: /usr/bin/clang++-18
PROTOBUF_VERSION: 21.12
run: |
sudo apt remove needrestart #refer: https://github.com/actions/runner-images/issues/9937
sudo -E ./ci/setup_googletest.sh
sudo -E ./ci/setup_ci_environment.sh
sudo -E ./ci/install_protobuf.sh
Expand Down Expand Up @@ -169,6 +204,7 @@ jobs:
CXX: /usr/bin/clang++-18
PROTOBUF_VERSION: 21.12
run: |
sudo apt remove needrestart #refer: https://github.com/actions/runner-images/issues/9937
sudo -E ./ci/setup_googletest.sh
sudo -E ./ci/setup_ci_environment.sh
sudo -E ./ci/install_protobuf.sh
Expand Down Expand Up @@ -532,8 +568,8 @@ jobs:
- name: run tests
run: ./ci/do_ci.sh bazel.test

bazel_test_async:
name: Bazel with async export
bazel_no_bzlmod_test:
name: Bazel without bzlmod
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -551,10 +587,10 @@ jobs:
sudo ./ci/setup_ci_environment.sh
sudo ./ci/install_bazelisk.sh
- name: run tests
run: ./ci/do_ci.sh bazel.with_async_export.test
run: ./ci/do_ci.sh bazel.no_bzlmod.test

bazel_with_abseil:
name: Bazel with external abseil
bazel_test_async:
name: Bazel with async export
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -572,7 +608,7 @@ jobs:
sudo ./ci/setup_ci_environment.sh
sudo ./ci/install_bazelisk.sh
- name: run tests
run: ./ci/do_ci.sh bazel.with_abseil
run: ./ci/do_ci.sh bazel.with_async_export.test

bazel_valgrind:
name: Bazel valgrind
Expand Down Expand Up @@ -726,11 +762,11 @@ jobs:

format:
name: Format
runs-on: ubuntu-20.04
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- name: setup
run: sudo ./ci/install_format_tools.sh
run: sudo apt remove needrestart && sudo ./ci/install_format_tools.sh #refer: https://github.com/actions/runner-images/issues/9937
- name: run tests
run: ./ci/do_ci.sh format

Expand Down
84 changes: 84 additions & 0 deletions .github/workflows/clang-tidy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
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 \
iwyu \
cmake \
libssl-dev \
libcurl4-openssl-dev \
libprotobuf-dev \
protobuf-compiler \
libgmock-dev \
libgtest-dev \
libbenchmark-dev
if ! command -v clang-tidy &> /dev/null; then
echo "clang-tidy could not be found"
exit 1
fi
echo "Using clang-tidy version: $(clang-tidy --version)"
echo "clang-tidy installed at: $(which clang-tidy)"
- name: Prepare CMake
env:
CC: clang
CXX: clang++
run: |
mkdir -p build && cd build
echo "Running cmake..."
cmake .. \
-DCMAKE_CXX_STANDARD=14 \
-DWITH_STL=CXX14 \
-DWITH_OTLP_HTTP=ON \
-DWITH_OTLP_FILE=ON \
-DWITH_PROMETHEUS=ON \
-DWITH_ZIPKIN=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 \
-DCMAKE_CXX_CLANG_TIDY="clang-tidy"
- name: Run clang-tidy
run: |
cd build
make -j$(nproc) 2>&1 | tee -a clang-tidy.log || exit 1
- uses: actions/upload-artifact@v4
with:
name: Logs (clang-tidy)
path: ./build/clang-tidy.log

- name: Count warnings
run: |
cd build
COUNT=$(grep -c "warning:" clang-tidy.log)
echo "clang-tidy reported ${COUNT} warning(s)"
# TODO: include WITH_OTLP_GRPC and WITH_ABSEIL flags.
2 changes: 1 addition & 1 deletion .github/workflows/dependencies_image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
uses: docker/setup-buildx-action@v3
-
name: Build Image
uses: docker/build-push-action@v5
uses: docker/build-push-action@v6
with:
builder: ${{ steps.buildx.outputs.name }}
context: ci/
Expand Down
68 changes: 68 additions & 0 deletions .github/workflows/iwyu.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@

name: include-what-you-use

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
iwyu:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: 'recursive'

- name: setup dependencies
run: |
sudo apt update -y
sudo apt install -y --no-install-recommends --no-install-suggests \
build-essential \
iwyu \
cmake \
ninja-build \
libssl-dev \
libcurl4-openssl-dev \
libprotobuf-dev \
protobuf-compiler \
libgmock-dev \
libgtest-dev \
libbenchmark-dev
- name: Prepare CMake
run: |
TOPDIR=`pwd`
mkdir build && cd build
CC="clang" CXX="clang++" cmake \
-DCMAKE_CXX_STANDARD=14 \
-DWITH_STL=CXX14 \
-DCMAKE_CXX_INCLUDE_WHAT_YOU_USE="include-what-you-use;-w;-Xiwyu;--mapping_file=${TOPDIR}/.iwyu.imp;" \
-DBUILD_TESTING=OFF \
-DBUILD_W3CTRACECONTEXT_TEST=OFF \
-DWITH_OTLP_GRPC=OFF \
-DWITH_OTLP_HTTP=ON \
-DWITH_OTLP_FILE=ON \
-DWITH_OTLP_HTTP_COMPRESSION=ON \
-DWITH_ZIPKIN=ON \
-DWITH_PROMETHEUS=OFF \
..
- name: iwyu_tool
run: |
cd build
make -k 2>&1 | tee -a iwyu.log
- uses: actions/upload-artifact@v4
if: success() || failure()
with:
name: Logs (include-what-you-use)
path: ./build/*.log

- name: count warnings
run: |
cd build
COUNT=`grep -c "Warning:" iwyu.log`
echo "include-what-you-use reported ${COUNT} warning(s)"
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
*.app

# Bazel files
MODULE.bazel.lock
/bazel-*

# Mac
Expand Down
13 changes: 13 additions & 0 deletions .iwyu.imp
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Copyright The OpenTelemetry Authors
# SPDX-License-Identifier: Apache-2.0

# include-what-you-use mapping file

[
# Work around for C++ STL
{ "include": ["<bits/chrono.h>", "private", "<chrono>", "public"] },

# Local opentelemetry-cpp

]

Loading

0 comments on commit 1f404a3

Please sign in to comment.