Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add CMake OTELCPP_MAINTAINER_MODE #1650

Merged
merged 33 commits into from
Oct 15, 2022
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
5871e92
Fixes #1648
marcalff Oct 3, 2022
7ec5536
Format, versions used in github.
marcalff Oct 3, 2022
37f0d2c
Fixed format.
marcalff Oct 3, 2022
9ad340c
Added MSVC MAINTAINER_MODE
marcalff Oct 3, 2022
52e47df
Add a MSVC build in maintainer mode, in CI.
marcalff Oct 3, 2022
d900a42
Fix review comments.
marcalff Oct 3, 2022
3c562b9
Fix review comments.
marcalff Oct 4, 2022
4c412a4
Renamed to OTELCPP_MAINTAINER_MODE, to avoid collisions with other code.
marcalff Oct 5, 2022
62aef50
Merge branch 'open-telemetry:main' into fix_wall_werr_1648
marcalff Oct 5, 2022
ea6e74f
Upgrade CI to gcc 11, clang 14.
marcalff Oct 5, 2022
57e8919
Revert:
marcalff Oct 5, 2022
ee7f15e
Upgrade CI to gcc 10, clang 12.
marcalff Oct 5, 2022
d1a158a
clang fixup
marcalff Oct 5, 2022
c5b9595
Enforce OTELCPP_MAINTAINER_MODE
marcalff Oct 5, 2022
50793c2
Move warning cleanup (work in progress)
marcalff Oct 5, 2022
4e81f46
More warning cleanup (thrift, logs)
marcalff Oct 5, 2022
33754e8
Merge branch 'open-telemetry:main' into fix_wall_werr_1648
marcalff Oct 6, 2022
f4c80ed
Merge branch 'main' into fix_wall_werr_1648
esigo Oct 6, 2022
67cb8c0
Merge branch 'open-telemetry:main' into fix_wall_werr_1648
marcalff Oct 10, 2022
01834ac
Warning cleanup for Thrift-gen
marcalff Oct 10, 2022
8f5c762
Move maintainer mode later in CMakeList.txt,
marcalff Oct 10, 2022
a79f13d
More warning cleanup
marcalff Oct 11, 2022
6b1c23a
Merge branch 'open-telemetry:main' into fix_wall_werr_1648
marcalff Oct 11, 2022
e422bd1
More cleanup
marcalff Oct 11, 2022
525b5de
Merge branch 'main' into fix_wall_werr_1648
marcalff Oct 13, 2022
18ed349
Fix last 4 warnings known.
marcalff Oct 13, 2022
e7310b2
Cleanup
marcalff Oct 13, 2022
cd3b8f8
Relax MSVC warning
marcalff Oct 13, 2022
895b871
Cleanup, variable hides parameter.
marcalff Oct 13, 2022
7555a07
Cleanup, data parameter hides function param.
marcalff Oct 13, 2022
3c4f273
Merge branch 'open-telemetry:main' into fix_wall_werr_1648
marcalff Oct 14, 2022
531104b
Merge branch 'open-telemetry:main' into fix_wall_werr_1648
marcalff Oct 14, 2022
97ad7ae
Fixed code review comments.
marcalff Oct 15, 2022
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
46 changes: 46 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,52 @@ jobs:
sudo ./ci/setup_thrift.sh
./ci/do_ci.sh cmake.test

cmake_gcc_maintainer_test:
name: CMake gcc (maintainer mode)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: 'recursive'
- name: setup
run: |
sudo CC=/usr/bin/gcc CXX=/usr/bin/g++ ./ci/setup_cmake.sh
sudo CC=/usr/bin/gcc CXX=/usr/bin/g++ ./ci/setup_ci_environment.sh
- name: run cmake gcc (maintainer mode)
run: |
sudo CC=/usr/bin/gcc CXX=/usr/bin/g++ ./ci/setup_thrift.sh
CC=/usr/bin/gcc CXX=/usr/bin/g++ ./ci/do_ci.sh cmake.maintainer.test

cmake_clang_maintainer_test:
name: CMake clang (maintainer mode)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: 'recursive'
- name: setup
run: |
sudo CC=/usr/bin/clang CXX=/usr/bin/clang++ ./ci/setup_cmake.sh
sudo CC=/usr/bin/clang CXX=/usr/bin/clang++ ./ci/setup_ci_environment.sh
- name: run cmake clang (maintainer mode)
run: |
sudo CC=/usr/bin/clang CXX=/usr/bin/clang++ ./ci/setup_thrift.sh
CC=/usr/bin/clang CXX=/usr/bin/clang++ ./ci/do_ci.sh cmake.maintainer.test

cmake_msvc_maintainer_test:
name: CMake msvc (maintainer mode)
runs-on: windows-2019
steps:
- uses: actions/checkout@v3
with:
submodules: 'recursive'
- name: setup
run: |
./ci/setup_windows_cmake.ps1
./ci/setup_windows_ci_environment.ps1
- name: run tests
run: ./ci/do_ci.ps1 cmake.maintainer.test

cmake_deprecated_metrics_test:
name: CMake test (without otlp-exporter and with deprecated metrics)
runs-on: ubuntu-latest
Expand Down
49 changes: 49 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,55 @@ option(BUILD_TESTING "Whether to enable tests" ON)

option(BUILD_W3CTRACECONTEXT_TEST "Whether to build w3c trace context" OFF)

option(MAINTAINER_MODE "Build in maintainer mode (-Wall -Werror)" OFF)
marcalff marked this conversation as resolved.
Show resolved Hide resolved

if(MAINTAINER_MODE)
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
add_compile_options(-Wall)
add_compile_options(-Werror)
add_compile_options(-Wextra)

# Tested with GCC 9.4 on github.
if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 9.4)
# Relaxed warnings
marcalff marked this conversation as resolved.
Show resolved Hide resolved

# Enforced warnings
endif()

endif()

if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
marcalff marked this conversation as resolved.
Show resolved Hide resolved
add_compile_options(-Wall)
add_compile_options(-Werror)
add_compile_options(-Wextra)

# Tested with Clang 11.0 on github.
if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 11.0)
# Relaxed warnings
add_compile_options(-Wno-error=unused-private-field)

# Relaxed warning, for GRPC generated code.
add_compile_options(-Wno-error=shadow-field)
marcalff marked this conversation as resolved.
Show resolved Hide resolved

# Enforced warnings
add_compile_options(-Wconditional-uninitialized)
add_compile_options(-Wextra-semi)
add_compile_options(-Wheader-hygiene)
add_compile_options(-Wnon-virtual-dtor)
add_compile_options(-Wundefined-reinterpret-cast)
add_compile_options(-Wrange-loop-analysis)
add_compile_options(-Winconsistent-missing-destructor-override)
add_compile_options(-Winconsistent-missing-override)
add_compile_options(-Wnewline-eof)
marcalff marked this conversation as resolved.
Show resolved Hide resolved
endif()
endif()

if(CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
add_compile_options(/WX)
add_compile_options(/W4)
endif()
endif(MAINTAINER_MODE)

if(WIN32)
if(BUILD_TESTING)
if(MSVC)
Expand Down
1 change: 1 addition & 0 deletions ci/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ CI tests can be run on docker by invoking the script `./ci/run_docker.sh
./ci/do_ci.sh {TARGET}` where the targets are:

* `cmake.test`: build cmake targets and run tests.
* `cmake.maintainer.test`: build with cmake and test, in maintainer mode.
* `cmake.legacy.test`: build cmake targets with gcc 4.8 and run tests.
* `cmake.c++20.test`: build cmake targets with the C++20 standard and run tests.
* `cmake.test_example_plugin`: build and test an example OpenTelemetry plugin.
Expand Down
21 changes: 21 additions & 0 deletions ci/do_ci.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,27 @@ switch ($action) {
exit $exit
}
}
"cmake.maintainer.test" {
cd "$BUILD_DIR"
cmake $SRC_DIR `
-DMAINTAINER_MODE=ON `
-DVCPKG_TARGET_TRIPLET=x64-windows `
"-DCMAKE_TOOLCHAIN_FILE=$VCPKG_DIR/scripts/buildsystems/vcpkg.cmake"
$exit = $LASTEXITCODE
if ($exit -ne 0) {
exit $exit
}
cmake --build .
$exit = $LASTEXITCODE
if ($exit -ne 0) {
exit $exit
}
ctest -C Debug
$exit = $LASTEXITCODE
if ($exit -ne 0) {
exit $exit
}
}
"cmake.with_async_export.test" {
cd "$BUILD_DIR"
cmake $SRC_DIR `
Expand Down
16 changes: 16 additions & 0 deletions ci/do_ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,22 @@ if [[ "$1" == "cmake.test" ]]; then
make
make test
exit 0
elif [[ "$1" == "cmake.maintainer.test" ]]; then
cd "${BUILD_DIR}"
rm -rf *
cmake -DCMAKE_BUILD_TYPE=Debug \
-DWITH_PROMETHEUS=ON \
-DWITH_ZIPKIN=ON \
-DWITH_JAEGER=ON \
-DWITH_ELASTICSEARCH=ON \
-DWITH_LOGS_PREVIEW=ON \
-DWITH_METRICS_PREVIEW=OFF \
-DWITH_ASYNC_EXPORT_PREVIEW=ON \
-DMAINTAINER_MODE=ON \
"${SRC_DIR}"
make
make test
exit 0
elif [[ "$1" == "cmake.with_async_export.test" ]]; then
cd "${BUILD_DIR}"
rm -rf *
Expand Down