diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index 9823252c58..cc63677a24 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -24,8 +24,6 @@ jobs: path: /home/runner/.cache/bazel key: bazel_benchmark - name: setup - env: - GOOGLETEST_VERSION: 1.13.0 run: | sudo -E ./ci/setup_cmake.sh sudo -E ./ci/setup_ci_environment.sh diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ace58fe8dc..ff33aa46e3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,7 +18,6 @@ jobs: env: CC: /usr/bin/gcc-10 CXX: /usr/bin/g++-10 - GOOGLETEST_VERSION: 1.13.0 run: | sudo -E ./ci/setup_cmake.sh sudo -E ./ci/setup_ci_environment.sh @@ -77,7 +76,6 @@ jobs: env: CC: /usr/bin/gcc-12 CXX: /usr/bin/g++-12 - GOOGLETEST_VERSION: 1.13.0 PROTOBUF_VERSION: 21.12 run: | sudo -E ./ci/setup_cmake.sh @@ -110,7 +108,6 @@ jobs: env: CC: /usr/bin/gcc-12 CXX: /usr/bin/g++-12 - GOOGLETEST_VERSION: 1.13.0 PROTOBUF_VERSION: 21.12 run: | sudo -E ./ci/setup_cmake.sh @@ -143,7 +140,6 @@ jobs: env: CC: /usr/bin/clang-14 CXX: /usr/bin/clang++-14 - GOOGLETEST_VERSION: 1.13.0 PROTOBUF_VERSION: 21.12 run: | sudo -E ./ci/setup_cmake.sh @@ -176,7 +172,6 @@ jobs: env: CC: /usr/bin/clang-14 CXX: /usr/bin/clang++-14 - GOOGLETEST_VERSION: 1.13.0 PROTOBUF_VERSION: 21.12 run: | sudo -E ./ci/setup_cmake.sh @@ -223,7 +218,6 @@ jobs: env: CC: /usr/bin/gcc-10 CXX: /usr/bin/g++-10 - GOOGLETEST_VERSION: 1.13.0 run: | sudo -E ./ci/setup_cmake.sh sudo -E ./ci/setup_ci_environment.sh @@ -242,8 +236,6 @@ jobs: with: submodules: 'recursive' - name: setup - env: - GOOGLETEST_VERSION: 1.13.0 run: | sudo -E ./ci/setup_cmake.sh sudo -E ./ci/setup_ci_environment.sh @@ -260,8 +252,6 @@ jobs: with: submodules: 'recursive' - name: setup - env: - GOOGLETEST_VERSION: 1.13.0 run: | sudo -E ./ci/setup_cmake.sh sudo -E ./ci/setup_ci_environment.sh @@ -287,6 +277,7 @@ jobs: env: CC: /usr/bin/gcc-4.8 CXX: /usr/bin/g++-4.8 + GOOGLETEST_VERSION: 1.10.0 run: | sudo -E ./ci/setup_cmake.sh - name: run tests @@ -314,6 +305,7 @@ jobs: env: CC: /usr/bin/gcc-4.8 CXX: /usr/bin/g++-4.8 + GOOGLETEST_VERSION: 1.10.0 run: | sudo -E ./ci/setup_cmake.sh sudo -E ./ci/setup_grpc.sh -v 4.8 @@ -333,7 +325,6 @@ jobs: - name: setup env: CMAKE_VERSION: 3.20.6 - GOOGLETEST_VERSION: 1.13.0 run: | sudo -E ./ci/setup_ci_environment.sh sudo -E ./ci/setup_cmake.sh @@ -355,7 +346,6 @@ jobs: CXX: /usr/bin/clang++ CXXFLAGS: "-stdlib=libc++" CMAKE_VERSION: 3.20.6 - GOOGLETEST_VERSION: 1.13.0 run: | sudo -E ./ci/setup_ci_environment.sh sudo -E ./ci/setup_cmake.sh @@ -380,8 +370,6 @@ jobs: with: submodules: 'recursive' - name: setup - env: - GOOGLETEST_VERSION: 1.13.0 run: | sudo -E ./ci/setup_cmake.sh sudo -E ./ci/setup_ci_environment.sh @@ -398,8 +386,6 @@ jobs: with: submodules: 'recursive' - name: setup - env: - GOOGLETEST_VERSION: 1.13.0 run: | sudo -E ./ci/setup_cmake.sh sudo -E ./ci/setup_ci_environment.sh @@ -416,8 +402,6 @@ jobs: with: submodules: 'recursive' - name: setup - env: - GOOGLETEST_VERSION: 1.13.0 run: | sudo -E ./ci/setup_cmake.sh sudo -E ./ci/setup_ci_environment.sh @@ -437,7 +421,6 @@ jobs: env: CC: /usr/bin/gcc-10 CXX: /usr/bin/g++-10 - GOOGLETEST_VERSION: 1.13.0 run: | sudo -E ./ci/setup_cmake.sh sudo -E ./ci/setup_ci_environment.sh @@ -767,7 +750,6 @@ jobs: env: CC: /usr/bin/gcc-10 CXX: /usr/bin/g++-10 - GOOGLETEST_VERSION: 1.13.0 run: | sudo -E ./ci/setup_cmake.sh sudo -E ./ci/setup_ci_environment.sh diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index b751e6d407..8d0071ce11 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -22,7 +22,6 @@ jobs: env: CC: /usr/bin/gcc-10 CXX: /usr/bin/g++-10 - GOOGLETEST_VERSION: 1.13.0 run: | sudo -E ./ci/setup_cmake.sh sudo -E ./ci/setup_ci_environment.sh diff --git a/CMakeLists.txt b/CMakeLists.txt index db42f74a33..d788a14c6c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -512,7 +512,6 @@ list(APPEND CMAKE_PREFIX_PATH "${CMAKE_BINARY_DIR}") include(CTest) if(BUILD_TESTING) - set(CMAKE_CXX_STANDARD 20) add_definitions(-DENABLE_TEST) if(EXISTS ${CMAKE_BINARY_DIR}/lib/libgtest.a) # Prefer GTest from build tree. GTest is not always working with diff --git a/ci/do_ci.sh b/ci/do_ci.sh index 72804e0493..5b2b749a1b 100755 --- a/ci/do_ci.sh +++ b/ci/do_ci.sh @@ -79,6 +79,7 @@ if [[ "$1" == "cmake.test" ]]; then cd "${BUILD_DIR}" rm -rf * cmake -DCMAKE_BUILD_TYPE=Debug \ + -DCMAKE_CXX_STANDARD=14 \ -DWITH_PROMETHEUS=ON \ -DWITH_ZIPKIN=ON \ -DWITH_ELASTICSEARCH=ON \ @@ -93,6 +94,7 @@ elif [[ "$1" == "cmake.maintainer.sync.test" ]]; then cd "${BUILD_DIR}" rm -rf * cmake -DCMAKE_BUILD_TYPE=Debug \ + -DCMAKE_CXX_STANDARD=14 \ -DWITH_OTLP_HTTP=ON \ -DWITH_OTLP_HTTP_SSL_PREVIEW=ON \ -DWITH_OTLP_HTTP_SSL_TLS_PREVIEW=ON \ @@ -115,6 +117,7 @@ elif [[ "$1" == "cmake.maintainer.async.test" ]]; then cd "${BUILD_DIR}" rm -rf * cmake -DCMAKE_BUILD_TYPE=Debug \ + -DCMAKE_CXX_STANDARD=14 \ -DWITH_OTLP_HTTP=ON \ -DWITH_OTLP_HTTP_SSL_PREVIEW=ON \ -DWITH_OTLP_HTTP_SSL_TLS_PREVIEW=ON \ @@ -160,6 +163,7 @@ elif [[ "$1" == "cmake.with_async_export.test" ]]; then cd "${BUILD_DIR}" rm -rf * cmake -DCMAKE_BUILD_TYPE=Debug \ + -DCMAKE_CXX_STANDARD=14 \ -DWITH_PROMETHEUS=ON \ -DWITH_ZIPKIN=ON \ -DWITH_ELASTICSEARCH=ON \ @@ -175,6 +179,7 @@ elif [[ "$1" == "cmake.abseil.test" ]]; then cd "${BUILD_DIR}" rm -rf * cmake -DCMAKE_BUILD_TYPE=Debug \ + -DCMAKE_CXX_STANDARD=14 \ -DWITH_METRICS_EXEMPLAR_PREVIEW=ON \ -DWITH_LOGS_PREVIEW=ON \ -DCMAKE_CXX_FLAGS="-Werror $CXXFLAGS" \ @@ -188,6 +193,7 @@ elif [[ "$1" == "cmake.opentracing_shim.test" ]]; then cd "${BUILD_DIR}" rm -rf * cmake -DCMAKE_BUILD_TYPE=Debug \ + -DCMAKE_CXX_STANDARD=14 \ -DCMAKE_CXX_FLAGS="-Werror -Wno-error=redundant-move $CXXFLAGS" \ -DWITH_OPENTRACING=ON \ "${SRC_DIR}" @@ -198,9 +204,9 @@ elif [[ "$1" == "cmake.c++20.test" ]]; then cd "${BUILD_DIR}" rm -rf * cmake -DCMAKE_BUILD_TYPE=Debug \ + -DCMAKE_CXX_STANDARD=20 \ -DCMAKE_CXX_FLAGS="-Werror $CXXFLAGS" \ -DWITH_ASYNC_EXPORT_PREVIEW=ON \ - -DCMAKE_CXX_STANDARD=20 \ "${SRC_DIR}" make -j $(nproc) make test @@ -209,11 +215,11 @@ elif [[ "$1" == "cmake.c++20.stl.test" ]]; then cd "${BUILD_DIR}" rm -rf * cmake -DCMAKE_BUILD_TYPE=Debug \ + -DCMAKE_CXX_STANDARD=20 \ -DWITH_METRICS_EXEMPLAR_PREVIEW=ON \ -DWITH_LOGS_PREVIEW=ON \ -DCMAKE_CXX_FLAGS="-Werror $CXXFLAGS" \ -DWITH_ASYNC_EXPORT_PREVIEW=ON \ - -DCMAKE_CXX_STANDARD=20 \ -DWITH_STL=ON \ "${SRC_DIR}" make -j $(nproc) @@ -225,8 +231,8 @@ elif [[ "$1" == "cmake.legacy.test" ]]; then export BUILD_ROOT="${BUILD_DIR}" ${SRC_DIR}/tools/build-benchmark.sh cmake -DCMAKE_BUILD_TYPE=Debug \ - -DCMAKE_CXX_FLAGS="-Werror $CXXFLAGS" \ -DCMAKE_CXX_STANDARD=11 \ + -DCMAKE_CXX_FLAGS="-Werror $CXXFLAGS" \ "${SRC_DIR}" make -j $(nproc) make test @@ -252,6 +258,7 @@ elif [[ "$1" == "cmake.exporter.otprotocol.test" ]]; then cd "${BUILD_DIR}" rm -rf * cmake -DCMAKE_BUILD_TYPE=Debug \ + -DCMAKE_CXX_STANDARD=14 \ -DWITH_OTLP_GRPC=ON \ -DWITH_OTLP_HTTP=ON \ -DWITH_OTLP_GRPC_SSL_MTLS_PREVIEW=ON \ @@ -266,6 +273,7 @@ elif [[ "$1" == "cmake.exporter.otprotocol.shared_libs.with_static_grpc.test" ]] cd "${BUILD_DIR}" rm -rf * cmake -DCMAKE_BUILD_TYPE=Debug \ + -DCMAKE_CXX_STANDARD=14 \ -DWITH_OTLP_GRPC=ON \ -DWITH_OTLP_HTTP=ON \ -DBUILD_SHARED_LIBS=ON \ @@ -280,6 +288,7 @@ elif [[ "$1" == "cmake.exporter.otprotocol.with_async_export.test" ]]; then cd "${BUILD_DIR}" rm -rf * cmake -DCMAKE_BUILD_TYPE=Debug \ + -DCMAKE_CXX_STANDARD=14 \ -DWITH_OTLP_GRPC=ON \ -DWITH_OTLP_HTTP=ON \ -DWITH_ASYNC_EXPORT_PREVIEW=ON \ @@ -294,6 +303,7 @@ elif [[ "$1" == "cmake.do_not_install.test" ]]; then cd "${BUILD_DIR}" rm -rf * cmake -DCMAKE_BUILD_TYPE=Debug \ + -DCMAKE_CXX_STANDARD=14 \ -DWITH_OTLP_GRPC=ON \ -DWITH_OTLP_HTTP=ON \ -DWITH_ASYNC_EXPORT_PREVIEW=ON \ @@ -420,6 +430,7 @@ elif [[ "$1" == "code.coverage" ]]; then cd "${BUILD_DIR}" rm -rf * cmake -DCMAKE_BUILD_TYPE=Debug \ + -DCMAKE_CXX_STANDARD=14 \ -DCMAKE_CXX_FLAGS="-Werror --coverage $CXXFLAGS" \ "${SRC_DIR}" make diff --git a/ci/setup_cmake.sh b/ci/setup_cmake.sh index 02f6a20f7d..7c96d17c88 100755 --- a/ci/setup_cmake.sh +++ b/ci/setup_cmake.sh @@ -9,19 +9,22 @@ export DEBIAN_FRONTEND=noninteractive apt-get update if [ "x$CMAKE_VERSION" = "x" ]; then + # By default, CMake version set the following version. export CMAKE_VERSION=3.15.2 fi # This variable not set on CI pipeline for only legacy environment(GCC 4.8). # With 1.13.0 version, C++14 must be set which does not supported by legacy environment anymore. # Also with this version, release version path needs to be adapted. -if [ "x$GOOGLETEST_VERSION" = "x" ]; then - export GOOGLETEST_VERSION=1.10.0 - GOOGLETEST_VERSION_PATH="release-${GOOGLETEST_VERSION}" - GOOGLETEST_FOLDER_PATH="googletest-release-${GOOGLETEST_VERSION}" -else +if [ -z "${GOOGLETEST_VERSION}" ]; then + # By default, GoogleTest version set the following version. + export GOOGLETEST_VERSION=1.13.0 GOOGLETEST_VERSION_PATH="v${GOOGLETEST_VERSION}" GOOGLETEST_FOLDER_PATH="googletest-${GOOGLETEST_VERSION}" +else + GOOGLETEST_VERSION_PATH="release-${GOOGLETEST_VERSION}" + GOOGLETEST_FOLDER_PATH="googletest-release-${GOOGLETEST_VERSION}" + fi cmake_install() {