diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-21 11:54:28 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-21 11:54:28 +0000 |
commit | e6918187568dbd01842d8d1d2c808ce16a894239 (patch) | |
tree | 64f88b554b444a49f656b6c656111a145cbbaa28 /src/jaegertracing/opentelemetry-cpp/ci | |
parent | Initial commit. (diff) | |
download | ceph-e6918187568dbd01842d8d1d2c808ce16a894239.tar.xz ceph-e6918187568dbd01842d8d1d2c808ce16a894239.zip |
Adding upstream version 18.2.2.upstream/18.2.2
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/jaegertracing/opentelemetry-cpp/ci')
31 files changed, 1098 insertions, 0 deletions
diff --git a/src/jaegertracing/opentelemetry-cpp/ci/Dockerfile b/src/jaegertracing/opentelemetry-cpp/ci/Dockerfile new file mode 100644 index 000000000..a1f43af92 --- /dev/null +++ b/src/jaegertracing/opentelemetry-cpp/ci/Dockerfile @@ -0,0 +1,17 @@ +FROM ubuntu:18.04 + +WORKDIR /setup-ci + +ADD setup_ci_environment.sh /setup-ci +ADD setup_cmake.sh /setup-ci +ADD install_gcc48.sh /setup-ci +ADD install_bazelisk.sh /setup-ci +ADD install_protobuf.sh /setup-ci +ADD install_format_tools.sh /setup-ci + +RUN /setup-ci/setup_ci_environment.sh \ + && /setup-ci/setup_cmake.sh \ + && /setup-ci/install_gcc48.sh \ + && /setup-ci/install_bazelisk.sh \ + && /setup-ci/install_protobuf.sh \ + && /setup-ci/install_format_tools.sh diff --git a/src/jaegertracing/opentelemetry-cpp/ci/README.md b/src/jaegertracing/opentelemetry-cpp/ci/README.md new file mode 100644 index 000000000..14a6107eb --- /dev/null +++ b/src/jaegertracing/opentelemetry-cpp/ci/README.md @@ -0,0 +1,28 @@ +# Building and running tests as a developer + +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.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. +* `cmake.exporter.otprotocol.test`: build and test the otprotocol exporter +* `bazel.test`: build bazel targets and run tests. +* `bazel.legacy.test`: build bazel targets and run tests for the targets meant + to work with older compilers. +* `bazel.noexcept`: build bazel targets and run tests with exceptions disabled. +* `bazel.nortti`: build bazel targets and run tests with runtime type + identification disabled. +* `bazel.asan`: build bazel targets and run tests with AddressSanitizer. +* `bazel.tsan`: build bazel targets and run tests with ThreadSanitizer. +* `bazel.valgrind`: build bazel targets and run tests under the valgrind memory + checker. +* `benchmark`: run all benchmarks. +* `format`: use `tools/format.sh` to enforce text formatting. +* `third_party.tags`: store third_party release tags. +* `code.coverage`: build cmake targets with CXX option `--coverage` and run + tests. + +Additionally, `./ci/run_docker.sh` can be invoked with no arguments to get a +docker shell where tests can be run manually. diff --git a/src/jaegertracing/opentelemetry-cpp/ci/do_ci.ps1 b/src/jaegertracing/opentelemetry-cpp/ci/do_ci.ps1 new file mode 100644 index 000000000..b32c9ff54 --- /dev/null +++ b/src/jaegertracing/opentelemetry-cpp/ci/do_ci.ps1 @@ -0,0 +1,114 @@ +$ErrorActionPreference = "Stop"; +trap { $host.SetShouldExit(1) } + +$action = $args[0] + +$SRC_DIR = (Get-Item -Path ".\").FullName + +$BAZEL_OPTIONS = "--copt=-DENABLE_METRICS_PREVIEW --copt=-DENABLE_LOGS_PREVIEW" +$BAZEL_TEST_OPTIONS = "$BAZEL_OPTIONS --test_output=errors" + +if (!(test-path build)) { + mkdir build +} +$BUILD_DIR = Join-Path "$SRC_DIR" "build" + +if (!(test-path plugin)) { + mkdir plugin +} +$PLUGIN_DIR = Join-Path "$SRC_DIR" "plugin" + +$VCPKG_DIR = Join-Path "$SRC_DIR" "tools" "vcpkg" + +switch ($action) { + "bazel.build" { + bazel build --copt=-DENABLE_TEST $BAZEL_OPTIONS --action_env=VCPKG_DIR=$VCPKG_DIR -- //... + $exit = $LASTEXITCODE + if ($exit -ne 0) { + exit $exit + } + } + "cmake.test" { + cd "$BUILD_DIR" + cmake $SRC_DIR ` + -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.exporter.otprotocol.test" { + cd "$BUILD_DIR" + cmake $SRC_DIR ` + -DVCPKG_TARGET_TRIPLET=x64-windows ` + -DWITH_OTPROTCOL=ON ` + "-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.build_example_plugin" { + cd "$BUILD_DIR" + cmake $SRC_DIR ` + -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 + } + cp examples/plugin/plugin/Debug/example_plugin.dll ${PLUGIN_DIR} + } + "cmake.test_example_plugin" { + cd "$BUILD_DIR" + cmake $SRC_DIR ` + -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 + } + cp examples/plugin/plugin/Debug/example_plugin.dll ${PLUGIN_DIR} + $config = New-TemporaryFile + examples/plugin/load/Debug/load_plugin_example.exe ${PLUGIN_DIR}/example_plugin.dll $config + $exit = $LASTEXITCODE + if ($exit -ne 0) { + exit $exit + } + } + default { + echo "unknown action: $action" + exit 1 + } +} diff --git a/src/jaegertracing/opentelemetry-cpp/ci/do_ci.sh b/src/jaegertracing/opentelemetry-cpp/ci/do_ci.sh new file mode 100755 index 000000000..e11ca0d2e --- /dev/null +++ b/src/jaegertracing/opentelemetry-cpp/ci/do_ci.sh @@ -0,0 +1,289 @@ +#!/bin/bash + +# Copyright The OpenTelemetry Authors +# SPDX-License-Identifier: Apache-2.0 + +set -e + +function install_prometheus_cpp_client +{ + pushd third_party/prometheus-cpp + git submodule update --recursive --init + [[ -d _build ]] && rm -rf ./_build + mkdir _build && cd _build + cmake .. -DBUILD_SHARED_LIBS=ON -DUSE_THIRDPARTY_LIBRARIES=ON + make -j 4 + sudo make install + popd +} + +function run_benchmarks +{ + docker run -d --rm -it -p 4317:4317 -p 4318:4318 -v \ + $(pwd)/examples/otlp:/cfg otel/opentelemetry-collector:0.38.0 \ + --config=/cfg/opentelemetry-collector-config/config.dev.yaml + + [ -z "${BENCHMARK_DIR}" ] && export BENCHMARK_DIR=$HOME/benchmark + mkdir -p $BENCHMARK_DIR + bazel $BAZEL_STARTUP_OPTIONS build $BAZEL_OPTIONS -c opt -- \ + $(bazel query 'attr("tags", "benchmark_result", ...)') + echo "" + echo "Benchmark results in $BENCHMARK_DIR:" + ( + cd bazel-bin + find . -name \*_result.json -exec bash -c \ + 'echo "$@" && mkdir -p "$BENCHMARK_DIR/$(dirname "$@")" && \ + cp "$@" "$BENCHMARK_DIR/$@" && chmod +w "$BENCHMARK_DIR/$@"' _ {} \; + ) + + # collect benchmark results into one array + pushd $BENCHMARK_DIR + components=(api sdk exporters) + for component in "${components[@]}" + do + out=$component-benchmark_result.json + find ./$component -type f -name "*_result.json" -exec cat {} \; > $component_tmp_bench.json + cat $component_tmp_bench.json | docker run -i --rm itchyny/gojq:0.12.6 -s \ + '.[0].benchmarks = ([.[].benchmarks] | add) | + if .[0].benchmarks == null then null else .[0] end' > $BENCHMARK_DIR/$out + done + + mv *benchmark_result.json ${SRC_DIR} + popd + docker kill $(docker ps -q) +} + +[ -z "${SRC_DIR}" ] && export SRC_DIR="`pwd`" +[ -z "${BUILD_DIR}" ] && export BUILD_DIR=$HOME/build +mkdir -p "${BUILD_DIR}" +[ -z "${PLUGIN_DIR}" ] && export PLUGIN_DIR=$HOME/plugin +mkdir -p "${PLUGIN_DIR}" + +BAZEL_OPTIONS="--copt=-DENABLE_LOGS_PREVIEW --copt=-DENABLE_TEST" +# Previous legacy metrics use virtual drive, which can not be used without RTTI +if [[ "$1" != "bazel.nortti" ]]; then + BAZEL_OPTIONS="$BAZEL_OPTIONS --copt=-DENABLE_METRICS_PREVIEW" +fi +BAZEL_TEST_OPTIONS="$BAZEL_OPTIONS --test_output=errors" + +# https://github.com/bazelbuild/bazel/issues/4341 +BAZEL_MACOS_OPTIONS="$BAZEL_OPTIONS --features=-supports_dynamic_linker --build_tag_filters=-jaeger" +BAZEL_MACOS_TEST_OPTIONS="$BAZEL_MACOS_OPTIONS --test_output=errors" + +BAZEL_STARTUP_OPTIONS="--output_user_root=$HOME/.cache/bazel" + +export CTEST_OUTPUT_ON_FAILURE=1 + +if [[ "$1" == "cmake.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_METRICS_PREVIEW=ON \ + -DWITH_LOGS_PREVIEW=ON \ + -DCMAKE_CXX_FLAGS="-Werror" \ + "${SRC_DIR}" + make + make test + exit 0 +elif [[ "$1" == "cmake.abseil.test" ]]; then + cd "${BUILD_DIR}" + rm -rf * + cmake -DCMAKE_BUILD_TYPE=Debug \ + -DWITH_METRICS_PREVIEW=ON \ + -DWITH_LOGS_PREVIEW=ON \ + -DCMAKE_CXX_FLAGS="-Werror" \ + -DWITH_ABSEIL=ON \ + "${SRC_DIR}" + make + make test + exit 0 +elif [[ "$1" == "cmake.c++20.test" ]]; then + cd "${BUILD_DIR}" + rm -rf * + cmake -DCMAKE_BUILD_TYPE=Debug \ + -DCMAKE_CXX_FLAGS="-Werror" \ + -DCMAKE_CXX_STANDARD=20 \ + "${SRC_DIR}" + make + make test + exit 0 +elif [[ "$1" == "cmake.c++20.stl.test" ]]; then + cd "${BUILD_DIR}" + rm -rf * + cmake -DCMAKE_BUILD_TYPE=Debug \ + -DWITH_METRICS_PREVIEW=ON \ + -DWITH_LOGS_PREVIEW=ON \ + -DCMAKE_CXX_FLAGS="-Werror" \ + -DWITH_STL=ON \ + "${SRC_DIR}" + make + make test + exit 0 +elif [[ "$1" == "cmake.legacy.test" ]]; then + cd "${BUILD_DIR}" + rm -rf * + export BUILD_ROOT="${BUILD_DIR}" + ${SRC_DIR}/tools/build-gtest.sh + ${SRC_DIR}/tools/build-benchmark.sh + cmake -DCMAKE_BUILD_TYPE=Debug \ + -DCMAKE_CXX_FLAGS="-Werror" \ + -DCMAKE_CXX_STANDARD=11 \ + "${SRC_DIR}" + make + make test + exit 0 +elif [[ "$1" == "cmake.legacy.exporter.otprotocol.test" ]]; then + cd "${BUILD_DIR}" + rm -rf * + export BUILD_ROOT="${BUILD_DIR}" + ${SRC_DIR}/tools/build-gtest.sh + ${SRC_DIR}/tools/build-benchmark.sh + cmake -DCMAKE_BUILD_TYPE=Debug \ + -DCMAKE_CXX_STANDARD=11 \ + -DWITH_OTLP=ON \ + "${SRC_DIR}" + grpc_cpp_plugin=`which grpc_cpp_plugin` + proto_make_file="CMakeFiles/opentelemetry_proto.dir/build.make" + sed -i "s~gRPC_CPP_PLUGIN_EXECUTABLE-NOTFOUND~$grpc_cpp_plugin~" ${proto_make_file} #fixme + make -j $(nproc) + cd exporters/otlp && make test + exit 0 +elif [[ "$1" == "cmake.exporter.otprotocol.test" ]]; then + cd "${BUILD_DIR}" + rm -rf * + cmake -DCMAKE_BUILD_TYPE=Debug \ + -DWITH_OTLP=ON \ + "${SRC_DIR}" + grpc_cpp_plugin=`which grpc_cpp_plugin` + proto_make_file="CMakeFiles/opentelemetry_proto.dir/build.make" + sed -i "s~gRPC_CPP_PLUGIN_EXECUTABLE-NOTFOUND~$grpc_cpp_plugin~" ${proto_make_file} #fixme + make -j $(nproc) + cd exporters/otlp && make test + exit 0 +elif [[ "$1" == "bazel.with_abseil" ]]; then + bazel $BAZEL_STARTUP_OPTIONS build $BAZEL_OPTIONS --//api:with_abseil=true //... + bazel $BAZEL_STARTUP_OPTIONS test $BAZEL_TEST_OPTIONS --//api:with_abseil=true //... + exit 0 +elif [[ "$1" == "cmake.test_example_plugin" ]]; then + # Build the plugin + cd "${BUILD_DIR}" + rm -rf * + cat <<EOF > export.map +{ + global: + OpenTelemetryMakeFactoryImpl; + local: *; +}; +EOF + + LINKER_FLAGS="\ + -static-libstdc++ \ + -static-libgcc \ + -Wl,--version-script=${PWD}/export.map \ + " + cmake -DCMAKE_BUILD_TYPE=Debug \ + -DCMAKE_CXX_FLAGS="-Werror" \ + -DCMAKE_EXE_LINKER_FLAGS="$LINKER_FLAGS" \ + -DCMAKE_SHARED_LINKER_FLAGS="$LINKER_FLAGS" \ + "${SRC_DIR}" + make example_plugin + cp examples/plugin/plugin/libexample_plugin.so ${PLUGIN_DIR} + + # Verify we can load the plugin + cd "${BUILD_DIR}" + rm -rf * + cmake -DCMAKE_BUILD_TYPE=Debug \ + -DCMAKE_CXX_FLAGS="-Werror" \ + "${SRC_DIR}" + make load_plugin_example + examples/plugin/load/load_plugin_example ${PLUGIN_DIR}/libexample_plugin.so /dev/null + exit 0 +elif [[ "$1" == "bazel.test" ]]; then + bazel $BAZEL_STARTUP_OPTIONS build $BAZEL_OPTIONS //... + bazel $BAZEL_STARTUP_OPTIONS test $BAZEL_TEST_OPTIONS //... + exit 0 +elif [[ "$1" == "bazel.benchmark" ]]; then + run_benchmarks + exit 0 +elif [[ "$1" == "bazel.macos.test" ]]; then + bazel $BAZEL_STARTUP_OPTIONS build $BAZEL_MACOS_OPTIONS -- //... -//exporters/jaeger/... + bazel $BAZEL_STARTUP_OPTIONS test $BAZEL_MACOS_TEST_OPTIONS -- //... -//exporters/jaeger/... + exit 0 +elif [[ "$1" == "bazel.legacy.test" ]]; then + # we uses C++ future and async() function to test the Prometheus Exporter functionality, + # that make this test always fail. ignore Prometheus exporter here. + bazel $BAZEL_STARTUP_OPTIONS build $BAZEL_OPTIONS -- //... -//exporters/otlp/... -//exporters/prometheus/... + bazel $BAZEL_STARTUP_OPTIONS test $BAZEL_TEST_OPTIONS -- //... -//exporters/otlp/... -//exporters/prometheus/... + exit 0 +elif [[ "$1" == "bazel.noexcept" ]]; then + # there are some exceptions and error handling code from the Prometheus and Jaeger Clients + # that make this test always fail. ignore Prometheus and Jaeger exporters in the noexcept here. + bazel $BAZEL_STARTUP_OPTIONS build --copt=-fno-exceptions --build_tag_filters=-jaeger $BAZEL_OPTIONS -- //... -//exporters/prometheus/... -//exporters/jaeger/... -//examples/prometheus/... + bazel $BAZEL_STARTUP_OPTIONS test --copt=-fno-exceptions --build_tag_filters=-jaeger $BAZEL_TEST_OPTIONS -- //... -//exporters/prometheus/... -//exporters/jaeger/... -//examples/prometheus/... + exit 0 +elif [[ "$1" == "bazel.nortti" ]]; then + # there are some exceptions and error handling code from the Prometheus and Jaeger Clients + # that make this test always fail. ignore Prometheus and Jaeger exporters in the noexcept here. + bazel $BAZEL_STARTUP_OPTIONS build --cxxopt=-fno-rtti --build_tag_filters=-jaeger $BAZEL_OPTIONS -- //... -//exporters/prometheus/... -//exporters/jaeger/... + bazel $BAZEL_STARTUP_OPTIONS test --cxxopt=-fno-rtti --build_tag_filters=-jaeger $BAZEL_TEST_OPTIONS -- //... -//exporters/prometheus/... -//exporters/jaeger/... + exit 0 +elif [[ "$1" == "bazel.asan" ]]; then + bazel $BAZEL_STARTUP_OPTIONS test --config=asan $BAZEL_TEST_OPTIONS //... + exit 0 +elif [[ "$1" == "bazel.tsan" ]]; then + bazel $BAZEL_STARTUP_OPTIONS test --config=tsan $BAZEL_TEST_OPTIONS //... + exit 0 +elif [[ "$1" == "bazel.valgrind" ]]; then + bazel $BAZEL_STARTUP_OPTIONS build $BAZEL_OPTIONS //... + bazel $BAZEL_STARTUP_OPTIONS test --run_under="/usr/bin/valgrind --leak-check=full --error-exitcode=1 --suppressions=\"${SRC_DIR}/ci/valgrind-suppressions\"" $BAZEL_TEST_OPTIONS //... + exit 0 +elif [[ "$1" == "benchmark" ]]; then + [ -z "${BENCHMARK_DIR}" ] && export BENCHMARK_DIR=$HOME/benchmark + bazel $BAZEL_STARTUP_OPTIONS build $BAZEL_OPTIONS -c opt -- \ + $(bazel query 'attr("tags", "benchmark_result", ...)') + echo "" + echo "Benchmark results in $BENCHMARK_DIR:" + ( + cd bazel-bin + find . -name \*_result.json -exec bash -c \ + 'echo "$@" && mkdir -p "$BENCHMARK_DIR/$(dirname "$@")" && \ + cp "$@" "$BENCHMARK_DIR/$@" && chmod +w "$BENCHMARK_DIR/$@"' _ {} \; + ) + exit 0 +elif [[ "$1" == "format" ]]; then + tools/format.sh + CHANGED="$(git ls-files --modified)" + if [[ ! -z "$CHANGED" ]]; then + echo "The following files have changes:" + echo "$CHANGED" + git diff + exit 1 + fi + exit 0 +elif [[ "$1" == "code.coverage" ]]; then + cd "${BUILD_DIR}" + rm -rf * + cmake -DCMAKE_BUILD_TYPE=Debug \ + -DCMAKE_CXX_FLAGS="-Werror --coverage" \ + "${SRC_DIR}" + make + make test + lcov --directory $PWD --capture --output-file coverage.info + # removing test http server coverage from the total coverage. We don't use this server completely. + lcov --remove coverage.info '*/ext/http/server/*'> tmp_coverage.info 2>/dev/null + cp tmp_coverage.info coverage.info + exit 0 +elif [[ "$1" == "third_party.tags" ]]; then + echo "gRPC=v1.43.2" > third_party_release + echo "thrift=0.14.1" >> third_party_release + echo "abseil=20210324.0" >> third_party_release + git submodule foreach --quiet 'echo "$name=$(git describe --tags HEAD)"' | sed 's:.*/::' >> third_party_release + exit 0 +fi + +echo "Invalid do_ci.sh target, see ci/README.md for valid targets." +exit 1 diff --git a/src/jaegertracing/opentelemetry-cpp/ci/docfx.cmd b/src/jaegertracing/opentelemetry-cpp/ci/docfx.cmd new file mode 100644 index 000000000..46582ac98 --- /dev/null +++ b/src/jaegertracing/opentelemetry-cpp/ci/docfx.cmd @@ -0,0 +1,18 @@ +SETLOCAL ENABLEEXTENSIONS + +type ci\docfx.json > docfx.json +type ci\toc.yml > toc.yml +docfx build docfx.json > docfx.log +DEL docfx.json 2> NUL +DEL toc.yml 2> NUL +@IF NOT %ERRORLEVEL% == 0 ( + type docfx.log + ECHO Error: docfx build failed. 1>&2 + EXIT /B %ERRORLEVEL% +) +@type docfx.log +@type docfx.log | findstr /C:"Build succeeded." +@IF NOT %ERRORLEVEL% == 0 ( + ECHO Error: you have introduced build warnings. 1>&2 + EXIT /B %ERRORLEVEL% +) diff --git a/src/jaegertracing/opentelemetry-cpp/ci/docfx.json b/src/jaegertracing/opentelemetry-cpp/ci/docfx.json new file mode 100644 index 000000000..bc026d623 --- /dev/null +++ b/src/jaegertracing/opentelemetry-cpp/ci/docfx.json @@ -0,0 +1,29 @@ +{ + "build": { + "content": [ + { + "files": [ + "**.md", + "toc.yml" + ] + } + ], + "resource": [ + { + "files": [ + "api/**.h", + "api/**.cc", + "sdk/**.h", + "sdk/**.cc" + ] + } + ], + "dest": "_site", + "globalMetadataFiles": [], + "fileMetadataFiles": [], + "noLangKeyword": false, + "keepFileLink": false, + "cleanupCacheHistory": true, + "disableGitFeatures": true + } +} diff --git a/src/jaegertracing/opentelemetry-cpp/ci/install_abseil.sh b/src/jaegertracing/opentelemetry-cpp/ci/install_abseil.sh new file mode 100755 index 000000000..914a691be --- /dev/null +++ b/src/jaegertracing/opentelemetry-cpp/ci/install_abseil.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +# Copyright The OpenTelemetry Authors +# SPDX-License-Identifier: Apache-2.0 + +set -e +export DEBIAN_FRONTEND=noninteractive + +BUILD_DIR=/tmp/ +INSTALL_DIR=/usr/local/ +TAG=20210324.0 +pushd $BUILD_DIR +git clone --depth=1 -b ${TAG} https://github.com/abseil/abseil-cpp.git +cd abseil-cpp +mkdir build && pushd build +cmake -DBUILD_TESTING=OFF -DCMAKE_CXX_STANDARD=11 \ + -DCMAKE_INSTALL_PREFIX=$INSTALL_DIR \ + .. +make -j $(nproc) +make install +popd +popd +export PATH=${INSTALL_DIR}/bin:$PATH # ensure to use the installed abseil diff --git a/src/jaegertracing/opentelemetry-cpp/ci/install_bazelisk.sh b/src/jaegertracing/opentelemetry-cpp/ci/install_bazelisk.sh new file mode 100755 index 000000000..d8b678177 --- /dev/null +++ b/src/jaegertracing/opentelemetry-cpp/ci/install_bazelisk.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +# Copyright The OpenTelemetry Authors +# SPDX-License-Identifier: Apache-2.0 + +set -e + +BAZELISK_VERSION=v1.10.1 + +wget -O /usr/local/bin/bazel https://github.com/bazelbuild/bazelisk/releases/download/$BAZELISK_VERSION/bazelisk-linux-amd64 +chmod +x /usr/local/bin/bazel diff --git a/src/jaegertracing/opentelemetry-cpp/ci/install_format_tools.sh b/src/jaegertracing/opentelemetry-cpp/ci/install_format_tools.sh new file mode 100755 index 000000000..fc6960f9d --- /dev/null +++ b/src/jaegertracing/opentelemetry-cpp/ci/install_format_tools.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +# Copyright The OpenTelemetry Authors +# SPDX-License-Identifier: Apache-2.0 + +set -e + +apt-get install -y clang-format-10 python3-pip git curl +pip3 install cmake_format==0.6.13 +curl -L -o /usr/local/bin/buildifier https://github.com/bazelbuild/buildtools/releases/download/2.2.1/buildifier +chmod +x /usr/local/bin/buildifier diff --git a/src/jaegertracing/opentelemetry-cpp/ci/install_gcc48.sh b/src/jaegertracing/opentelemetry-cpp/ci/install_gcc48.sh new file mode 100755 index 000000000..497b89dbe --- /dev/null +++ b/src/jaegertracing/opentelemetry-cpp/ci/install_gcc48.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +# Copyright The OpenTelemetry Authors +# SPDX-License-Identifier: Apache-2.0 + +set -e +apt-get update +apt-get install --no-install-recommends --no-install-suggests -y \ + g++-4.8 diff --git a/src/jaegertracing/opentelemetry-cpp/ci/install_osx_bazelisk.sh b/src/jaegertracing/opentelemetry-cpp/ci/install_osx_bazelisk.sh new file mode 100755 index 000000000..dbe5a15e3 --- /dev/null +++ b/src/jaegertracing/opentelemetry-cpp/ci/install_osx_bazelisk.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +# Copyright The OpenTelemetry Authors +# SPDX-License-Identifier: Apache-2.0 + +set -e + +brew install bazelisk +sudo ln -s /usr/local/bin/bazelisk /usr/local/bin/bazel diff --git a/src/jaegertracing/opentelemetry-cpp/ci/install_protobuf.sh b/src/jaegertracing/opentelemetry-cpp/ci/install_protobuf.sh new file mode 100755 index 000000000..8fff91d06 --- /dev/null +++ b/src/jaegertracing/opentelemetry-cpp/ci/install_protobuf.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +# Copyright The OpenTelemetry Authors +# SPDX-License-Identifier: Apache-2.0 + +set -e + +[ -z "${PROTOBUF_VERSION}" ] && export PROTOBUF_VERSION="3.11.4" + +cd / +wget https://github.com/google/protobuf/releases/download/v${PROTOBUF_VERSION}/protobuf-cpp-${PROTOBUF_VERSION}.tar.gz +tar zxf protobuf-cpp-${PROTOBUF_VERSION}.tar.gz --no-same-owner +cd protobuf-${PROTOBUF_VERSION} +./configure +make && make install +ldconfig diff --git a/src/jaegertracing/opentelemetry-cpp/ci/install_windows_bazelisk.ps1 b/src/jaegertracing/opentelemetry-cpp/ci/install_windows_bazelisk.ps1 new file mode 100644 index 000000000..de70bba6f --- /dev/null +++ b/src/jaegertracing/opentelemetry-cpp/ci/install_windows_bazelisk.ps1 @@ -0,0 +1,8 @@ +$ErrorActionPreference = "Stop" +trap { $host.SetShouldExit(1) } + +$BAZELISK_VERSION="1.7.4" +$CWD=(Get-Item -Path ".\").FullName +(new-object System.Net.WebClient). ` + DownloadFile("https://github.com/bazelbuild/bazelisk/releases/download/v$BAZELISK_VERSION/bazelisk-windows-amd64.exe", + "C:\windows\system32\bazel.exe") diff --git a/src/jaegertracing/opentelemetry-cpp/ci/install_windows_protobuf.ps1 b/src/jaegertracing/opentelemetry-cpp/ci/install_windows_protobuf.ps1 new file mode 100644 index 000000000..4e1b1b8f0 --- /dev/null +++ b/src/jaegertracing/opentelemetry-cpp/ci/install_windows_protobuf.ps1 @@ -0,0 +1,6 @@ +$ErrorActionPreference = "Stop" +trap { $host.SetShouldExit(1) } + +cd tools/vcpkg +# Lock to specific version of Protobuf port file to avoid build break +./vcpkg "--vcpkg-root=$PWD" install --overlay-ports="$PSScriptRoot\ports" protobuf:x64-windows diff --git a/src/jaegertracing/opentelemetry-cpp/ci/ports/benchmark/CONTROL b/src/jaegertracing/opentelemetry-cpp/ci/ports/benchmark/CONTROL new file mode 100644 index 000000000..d82040748 --- /dev/null +++ b/src/jaegertracing/opentelemetry-cpp/ci/ports/benchmark/CONTROL @@ -0,0 +1,5 @@ +Source: benchmark +Version: 1.5 +Homepage: https://github.com/google/benchmark +Description: A library to support the benchmarking of functions, similar to unit-tests. +Supports: !uwp
\ No newline at end of file diff --git a/src/jaegertracing/opentelemetry-cpp/ci/ports/benchmark/portfile.cmake b/src/jaegertracing/opentelemetry-cpp/ci/ports/benchmark/portfile.cmake new file mode 100644 index 000000000..2b889dc9c --- /dev/null +++ b/src/jaegertracing/opentelemetry-cpp/ci/ports/benchmark/portfile.cmake @@ -0,0 +1,40 @@ +if(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore") + message(FATAL_ERROR "${PORT} does not currently support UWP") +endif() + +# Make sure vs2019 compiled binaries are compat with vs2017 +set(VCPKG_CXX_FLAGS "/Zc:__cplusplus /d2FH4-") +set(VCPKG_C_FLAGS "/Zc:__cplusplus /d2FH4-") + +include(vcpkg_common_functions) + +vcpkg_check_linkage(ONLY_STATIC_LIBRARY) + +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO google/benchmark + REF v1.5.0 + SHA512 a0df9aa3d03f676e302c76d83b436de36eea0a8517ab50a8f5a11c74ccc68a1f5128fa02474901002d8e6b5a4d290ef0272a798ff4670eab3e2d78dc86bb6cd3 + HEAD_REF master +) + +vcpkg_configure_cmake( + SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA + OPTIONS + -DBENCHMARK_ENABLE_TESTING=OFF + -DCMAKE_DEBUG_POSTFIX=d +) + +vcpkg_install_cmake() + +vcpkg_copy_pdbs() + +vcpkg_fixup_cmake_targets(CONFIG_PATH lib/cmake/benchmark) + +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share) + +# Handle copyright +file(COPY ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/benchmark) +file(RENAME ${CURRENT_PACKAGES_DIR}/share/benchmark/LICENSE ${CURRENT_PACKAGES_DIR}/share/benchmark/copyright) diff --git a/src/jaegertracing/opentelemetry-cpp/ci/ports/protobuf/CONTROL b/src/jaegertracing/opentelemetry-cpp/ci/ports/protobuf/CONTROL new file mode 100644 index 000000000..2daa1ecaa --- /dev/null +++ b/src/jaegertracing/opentelemetry-cpp/ci/ports/protobuf/CONTROL @@ -0,0 +1,8 @@ +Source: protobuf +Version: 3.12.3 +Homepage: https://github.com/google/protobuf +Description: Protocol Buffers - Google's data interchange format + +Feature: zlib +Description: ZLib based features like Gzip streams +Build-Depends: zlib diff --git a/src/jaegertracing/opentelemetry-cpp/ci/ports/protobuf/fix-android-log.patch b/src/jaegertracing/opentelemetry-cpp/ci/ports/protobuf/fix-android-log.patch new file mode 100644 index 000000000..47a935078 --- /dev/null +++ b/src/jaegertracing/opentelemetry-cpp/ci/ports/protobuf/fix-android-log.patch @@ -0,0 +1,28 @@ +diff --git a/cmake/libprotobuf-lite.cmake b/cmake/libprotobuf-lite.cmake +index 6bf86a277..424854798 100644 +--- a/cmake/libprotobuf-lite.cmake ++++ b/cmake/libprotobuf-lite.cmake +@@ -67,6 +67,9 @@ target_link_libraries(libprotobuf-lite ${CMAKE_THREAD_LIBS_INIT}) + if(protobuf_LINK_LIBATOMIC) + target_link_libraries(libprotobuf-lite atomic) + endif() ++if(${CMAKE_SYSTEM_NAME} STREQUAL "Android") ++ target_link_libraries(libprotobuf-lite log) ++endif() + target_include_directories(libprotobuf-lite PUBLIC ${protobuf_source_dir}/src) + if(MSVC AND protobuf_BUILD_SHARED_LIBS) + target_compile_definitions(libprotobuf-lite +diff --git a/cmake/libprotobuf.cmake b/cmake/libprotobuf.cmake +index 0c12596c2..a5be494fb 100644 +--- a/cmake/libprotobuf.cmake ++++ b/cmake/libprotobuf.cmake +@@ -121,6 +121,9 @@ endif() + if(protobuf_LINK_LIBATOMIC) + target_link_libraries(libprotobuf atomic) + endif() ++if(${CMAKE_SYSTEM_NAME} STREQUAL "Android") ++ target_link_libraries(libprotobuf log) ++endif() + target_include_directories(libprotobuf PUBLIC ${protobuf_source_dir}/src) + if(MSVC AND protobuf_BUILD_SHARED_LIBS) + target_compile_definitions(libprotobuf diff --git a/src/jaegertracing/opentelemetry-cpp/ci/ports/protobuf/fix-static-build.patch b/src/jaegertracing/opentelemetry-cpp/ci/ports/protobuf/fix-static-build.patch new file mode 100644 index 000000000..22d99435c --- /dev/null +++ b/src/jaegertracing/opentelemetry-cpp/ci/ports/protobuf/fix-static-build.patch @@ -0,0 +1,13 @@ +diff --git a/cmake/install.cmake b/cmake/install.cmake +index be47c54..8b1bd97 100644 +--- a/cmake/install.cmake ++++ b/cmake/install.cmake +@@ -31,7 +31,7 @@ endforeach() + if (protobuf_BUILD_PROTOC_BINARIES) + install(TARGETS protoc EXPORT protobuf-targets + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT protoc) +- if (UNIX AND NOT APPLE) ++ if (UNIX AND NOT APPLE AND NOT protobuf_MSVC_STATIC_RUNTIME) + set_property(TARGET protoc + PROPERTY INSTALL_RPATH "$ORIGIN/../${CMAKE_INSTALL_LIBDIR}") + elseif (APPLE) diff --git a/src/jaegertracing/opentelemetry-cpp/ci/ports/protobuf/fix-uwp.patch b/src/jaegertracing/opentelemetry-cpp/ci/ports/protobuf/fix-uwp.patch new file mode 100644 index 000000000..72e36cb97 --- /dev/null +++ b/src/jaegertracing/opentelemetry-cpp/ci/ports/protobuf/fix-uwp.patch @@ -0,0 +1,12 @@ +diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt +index 849679995..dba537a68 100644 +--- a/cmake/CMakeLists.txt ++++ b/cmake/CMakeLists.txt +@@ -198,6 +198,7 @@ if (MSVC) + /wd4506 # no definition for inline function 'function' + /wd4800 # 'type' : forcing value to bool 'true' or 'false' (performance warning) + /wd4996 # The compiler encountered a deprecated declaration. ++ /wd4703 # Potentially uninitialized local pointer variable 'name' used. + ) + # Allow big object + add_definitions(/bigobj) diff --git a/src/jaegertracing/opentelemetry-cpp/ci/ports/protobuf/portfile.cmake b/src/jaegertracing/opentelemetry-cpp/ci/ports/protobuf/portfile.cmake new file mode 100644 index 000000000..77b718e5f --- /dev/null +++ b/src/jaegertracing/opentelemetry-cpp/ci/ports/protobuf/portfile.cmake @@ -0,0 +1,124 @@ +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO protocolbuffers/protobuf + REF 31ebe2ac71400344a5db91ffc13c4ddfb7589f92 #v3.12.3 + SHA512 74e623547bb9448ccea29925172bf13fcbffab80eb02f58d248180000b4ae7249f0dee88bb4ef438857b0e1a96a600ab270ebf3b58568da28cbf97d8a2398297 + HEAD_REF master + PATCHES + fix-uwp.patch + fix-android-log.patch + fix-static-build.patch +) + +if(CMAKE_HOST_WIN32 AND NOT VCPKG_TARGET_ARCHITECTURE MATCHES "x64" AND NOT VCPKG_TARGET_ARCHITECTURE MATCHES "x86") + set(protobuf_BUILD_PROTOC_BINARIES OFF) +elseif(CMAKE_HOST_WIN32 AND VCPKG_CMAKE_SYSTEM_NAME) + set(protobuf_BUILD_PROTOC_BINARIES OFF) +else() + set(protobuf_BUILD_PROTOC_BINARIES ON) +endif() + +if(NOT protobuf_BUILD_PROTOC_BINARIES AND NOT EXISTS ${CURRENT_INSTALLED_DIR}/../x86-windows/tools/protobuf) + message(FATAL_ERROR "Cross-targeting protobuf requires the x86-windows protoc to be available. Please install protobuf:x86-windows first.") +endif() + +if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic") + set(VCPKG_BUILD_SHARED_LIBS ON) +else() + set(VCPKG_BUILD_SHARED_LIBS OFF) +endif() + +if(VCPKG_CRT_LINKAGE STREQUAL "dynamic") + set(VCPKG_BUILD_STATIC_CRT OFF) +else() + set(VCPKG_BUILD_STATIC_CRT ON) +endif() + +vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS + zlib protobuf_WITH_ZLIB +) + + +vcpkg_configure_cmake( + SOURCE_PATH ${SOURCE_PATH}/cmake + PREFER_NINJA + OPTIONS + -Dprotobuf_BUILD_SHARED_LIBS=${VCPKG_BUILD_SHARED_LIBS} + -Dprotobuf_MSVC_STATIC_RUNTIME=${VCPKG_BUILD_STATIC_CRT} + -Dprotobuf_BUILD_TESTS=OFF + -DCMAKE_INSTALL_CMAKEDIR:STRING=share/protobuf + -Dprotobuf_BUILD_PROTOC_BINARIES=${protobuf_BUILD_PROTOC_BINARIES} + ${FEATURE_OPTIONS} +) + +vcpkg_install_cmake() + +# It appears that at this point the build hasn't actually finished. There is probably +# a process spawned by the build, therefore we need to wait a bit. + +function(protobuf_try_remove_recurse_wait PATH_TO_REMOVE) + file(REMOVE_RECURSE ${PATH_TO_REMOVE}) + if (EXISTS "${PATH_TO_REMOVE}") + execute_process(COMMAND ${CMAKE_COMMAND} -E sleep 5) + file(REMOVE_RECURSE ${PATH_TO_REMOVE}) + endif() +endfunction() + +protobuf_try_remove_recurse_wait(${CURRENT_PACKAGES_DIR}/debug/include) + +if(CMAKE_HOST_WIN32) + set(EXECUTABLE_SUFFIX ".exe") +else() + set(EXECUTABLE_SUFFIX "") +endif() + +if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release") + vcpkg_replace_string(${CURRENT_PACKAGES_DIR}/share/protobuf/protobuf-targets-release.cmake + "\${_IMPORT_PREFIX}/bin/protoc${EXECUTABLE_SUFFIX}" + "\${_IMPORT_PREFIX}/tools/protobuf/protoc${EXECUTABLE_SUFFIX}" +) +endif() + +if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug") + file(READ ${CURRENT_PACKAGES_DIR}/debug/share/protobuf/protobuf-targets-debug.cmake DEBUG_MODULE) + string(REPLACE "\${_IMPORT_PREFIX}" "\${_IMPORT_PREFIX}/debug" DEBUG_MODULE "${DEBUG_MODULE}") + string(REPLACE "\${_IMPORT_PREFIX}/debug/bin/protoc${EXECUTABLE_SUFFIX}" "\${_IMPORT_PREFIX}/tools/protobuf/protoc${EXECUTABLE_SUFFIX}" DEBUG_MODULE "${DEBUG_MODULE}") + file(WRITE ${CURRENT_PACKAGES_DIR}/share/protobuf/protobuf-targets-debug.cmake "${DEBUG_MODULE}") +endif() + +protobuf_try_remove_recurse_wait(${CURRENT_PACKAGES_DIR}/debug/share) + +if(CMAKE_HOST_WIN32) + if(protobuf_BUILD_PROTOC_BINARIES) + file(INSTALL ${CURRENT_PACKAGES_DIR}/bin/protoc.exe DESTINATION ${CURRENT_PACKAGES_DIR}/tools/${PORT}) + vcpkg_copy_tool_dependencies(${CURRENT_PACKAGES_DIR}/tools/${PORT}) + else() + file(COPY ${CURRENT_INSTALLED_DIR}/../x86-windows/tools/${PORT} DESTINATION ${CURRENT_PACKAGES_DIR}/tools) + endif() + + if(VCPKG_LIBRARY_LINKAGE STREQUAL "static") + protobuf_try_remove_recurse_wait(${CURRENT_PACKAGES_DIR}/bin) + protobuf_try_remove_recurse_wait(${CURRENT_PACKAGES_DIR}/debug/bin) + else() + protobuf_try_remove_recurse_wait(${CURRENT_PACKAGES_DIR}/bin/protoc.exe) + protobuf_try_remove_recurse_wait(${CURRENT_PACKAGES_DIR}/debug/bin/protoc.exe) + endif() +else() + file(GLOB EXECUTABLES ${CURRENT_PACKAGES_DIR}/bin/protoc*) + foreach(E IN LISTS EXECUTABLES) + file(INSTALL ${E} DESTINATION ${CURRENT_PACKAGES_DIR}/tools/${PORT} + PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_WRITE GROUP_EXECUTE WORLD_READ) + endforeach() + protobuf_try_remove_recurse_wait(${CURRENT_PACKAGES_DIR}/debug/bin) + protobuf_try_remove_recurse_wait(${CURRENT_PACKAGES_DIR}/bin) +endif() + +if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic") + vcpkg_replace_string(${CURRENT_PACKAGES_DIR}/include/google/protobuf/stubs/platform_macros.h + "\#endif // GOOGLE_PROTOBUF_PLATFORM_MACROS_H_" + "\#ifndef PROTOBUF_USE_DLLS\n\#define PROTOBUF_USE_DLLS\n\#endif // PROTOBUF_USE_DLLS\n\n\#endif // GOOGLE_PROTOBUF_PLATFORM_MACROS_H_" +) +endif() + +file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright) +vcpkg_copy_pdbs() diff --git a/src/jaegertracing/opentelemetry-cpp/ci/run_docker.sh b/src/jaegertracing/opentelemetry-cpp/ci/run_docker.sh new file mode 100755 index 000000000..d3b78c3af --- /dev/null +++ b/src/jaegertracing/opentelemetry-cpp/ci/run_docker.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +# Copyright The OpenTelemetry Authors +# SPDX-License-Identifier: Apache-2.0 + +set -e + +BUILD_IMAGE=opentelemetry-cpp-build +docker image inspect "$BUILD_IMAGE" &> /dev/null || { + docker build -t "$BUILD_IMAGE" ci +} + +if [[ $# -ge 1 ]]; then + docker run --user "$(id -u):$(id -g)" -v "$PWD":/src -w /src -it "$BUILD_IMAGE" "$@" +else + docker run -v "$PWD":/src -w /src --privileged -it "$BUILD_IMAGE" /bin/bash -l +fi diff --git a/src/jaegertracing/opentelemetry-cpp/ci/setup_ci_environment.sh b/src/jaegertracing/opentelemetry-cpp/ci/setup_ci_environment.sh new file mode 100755 index 000000000..f995ed75b --- /dev/null +++ b/src/jaegertracing/opentelemetry-cpp/ci/setup_ci_environment.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +# Copyright The OpenTelemetry Authors +# SPDX-License-Identifier: Apache-2.0 + +set -e +apt-get update +apt-get install --no-install-recommends --no-install-suggests -y \ + build-essential \ + ca-certificates \ + wget \ + git \ + valgrind \ + lcov diff --git a/src/jaegertracing/opentelemetry-cpp/ci/setup_cmake.sh b/src/jaegertracing/opentelemetry-cpp/ci/setup_cmake.sh new file mode 100755 index 000000000..fcc0c12a2 --- /dev/null +++ b/src/jaegertracing/opentelemetry-cpp/ci/setup_cmake.sh @@ -0,0 +1,53 @@ +#!/bin/bash + +# Copyright The OpenTelemetry Authors +# SPDX-License-Identifier: Apache-2.0 + +set -e + +export DEBIAN_FRONTEND=noninteractive +apt-get update + +export CMAKE_VERSION=3.15.2 +export GOOGLETEST_VERSION=1.10.0 + +cmake_install() { + tmp_dir=$(mktemp -d) + pushd $tmp_dir + wget https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/cmake-${CMAKE_VERSION}-Linux-x86_64.sh + chmod +x cmake-${CMAKE_VERSION}-Linux-x86_64.sh + ./cmake-${CMAKE_VERSION}-Linux-x86_64.sh --prefix=/usr/local --skip-license + rm cmake-${CMAKE_VERSION}-Linux-x86_64.sh + popd +} + +googletest_install() { + # Follows these instructions + # https://gist.github.com/dlime/313f74fd23e4267c4a915086b84c7d3d + tmp_dir=$(mktemp -d) + pushd $tmp_dir + wget https://github.com/google/googletest/archive/release-${GOOGLETEST_VERSION}.tar.gz + tar -xf release-${GOOGLETEST_VERSION}.tar.gz + cd googletest-release-${GOOGLETEST_VERSION}/ + mkdir build && cd build + cmake .. -DBUILD_SHARED_LIBS=ON -DINSTALL_GTEST=ON -DCMAKE_INSTALL_PREFIX:PATH=/usr + make -j $(nproc) + make install + ldconfig + popd +} + +cmake_install + +set +e +echo \ + libbenchmark-dev \ + zlib1g-dev \ + sudo \ + libcurl4-openssl-dev \ + nlohmann-json-dev \ + nlohmann-json3 \ + nlohmann-json3-dev | xargs -n 1 apt-get install --ignore-missing --no-install-recommends --no-install-suggests -y +set -e + +googletest_install diff --git a/src/jaegertracing/opentelemetry-cpp/ci/setup_grpc.sh b/src/jaegertracing/opentelemetry-cpp/ci/setup_grpc.sh new file mode 100755 index 000000000..d42fbb7d2 --- /dev/null +++ b/src/jaegertracing/opentelemetry-cpp/ci/setup_grpc.sh @@ -0,0 +1,65 @@ +#!/bin/bash + +# Copyright The OpenTelemetry Authors +# SPDX-License-Identifier: Apache-2.0 + +set -e +export DEBIAN_FRONTEND=noninteractive +old_grpc_version='v1.33.2' +new_grpc_version='v1.43.2' +gcc_version_for_new_grpc='5.1' +install_grpc_version=${new_grpc_version} +grpc_version='v1.39.0' +install_dir='/usr/local/' +usage() { echo "Usage: $0 [-v <gcc-version>] [-i <install_dir>"] 1>&2; exit 1;} + +while getopts ":v:i:" o; do + case "${o}" in + v) + gcc_version=${OPTARG} + ;; + i) + install_dir=${OPTARG} + ;; + *) + usage + ;; + esac +done +if [ -z "${gcc_version}" ]; then + gcc_version=`gcc --version | awk '/gcc/ {print $NF}'` +fi +if [[ "${gcc_version}" < "${gcc_version_for_new_grpc}" ]]; then + echo "less" + install_grpc_version=${old_grpc_version} +fi +if ! type cmake > /dev/null; then + #cmake not installed, exiting + exit 1 +fi +export BUILD_DIR=/tmp/ +export INSTALL_DIR=${install_dir} +pushd $BUILD_DIR +echo "installing grpc version: ${install_grpc_version}" +git clone --depth=1 -b ${install_grpc_version} https://github.com/grpc/grpc +pushd grpc +git submodule init +git submodule update --depth 1 +mkdir -p "third_party/abseil-cpp/build" && pushd "third_party/abseil-cpp/build" +cmake -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_POSITION_INDEPENDENT_CODE=TRUE \ + -DCMAKE_INSTALL_PREFIX=$INSTALL_DIR .. +make -j${nproc} install && popd +mkdir -p build && pushd build +cmake -DgRPC_INSTALL=ON \ + -DCMAKE_CXX_STANDARD=11 \ + -DgRPC_BUILD_TESTS=OFF \ + -DCMAKE_INSTALL_PREFIX=$INSTALL_DIR \ + -DCMAKE_PREFIX_PATH=$INSTALL_DIR \ + .. +make -j $(nproc) +make install +popd +popd + +export PATH=${INSTALL_DIR}/bin:$PATH # ensure to use the installed grpc diff --git a/src/jaegertracing/opentelemetry-cpp/ci/setup_thrift.ps1 b/src/jaegertracing/opentelemetry-cpp/ci/setup_thrift.ps1 new file mode 100644 index 000000000..a9be25262 --- /dev/null +++ b/src/jaegertracing/opentelemetry-cpp/ci/setup_thrift.ps1 @@ -0,0 +1,13 @@ +$ErrorActionPreference = "Stop" +trap { $host.SetShouldExit(1) } + +git submodule update -f "tools/vcpkg" +Push-Location -Path "tools/vcpkg" +$VCPKG_DIR = (Get-Item -Path ".\").FullName +setx VCPKG_DIR "$VCPKG_DIR" +./bootstrap-vcpkg.bat + +# boost needed for thrift +./vcpkg "--vcpkg-root=$VCPKG_DIR" install boost-predef[core]:x64-windows boost-locale[core]:x64-windows boost-numeric-conversion[core]:x64-windows boost-scope-exit[core]:x64-windows openssl:x64-windows + +Pop-Location
\ No newline at end of file diff --git a/src/jaegertracing/opentelemetry-cpp/ci/setup_thrift.sh b/src/jaegertracing/opentelemetry-cpp/ci/setup_thrift.sh new file mode 100755 index 000000000..98e14d5e7 --- /dev/null +++ b/src/jaegertracing/opentelemetry-cpp/ci/setup_thrift.sh @@ -0,0 +1,65 @@ +#!/bin/bash + +set -e +export DEBIAN_FRONTEND=noninteractive +export THRIFT_VERSION=0.14.1 + +install_dir='/usr/local/' +while getopts ":i:" o; do + case "${o}" in + i) + install_dir=${OPTARG} + ;; + *) + ;; + esac +done + +apt update + +if ! type cmake > /dev/null; then + #cmake not installed, exiting + exit 1 +fi +export BUILD_DIR=/tmp/ +export INSTALL_DIR=${install_dir} + +apt install -y --no-install-recommends \ + libboost-locale-dev \ + libevent-dev \ + libssl-dev \ + ninja-build + +if [[ "$1" == "dependencies_only" ]]; then + exit 0; +fi + +pushd $BUILD_DIR +wget https://github.com/apache/thrift/archive/refs/tags/v${THRIFT_VERSION}.tar.gz +tar -zxvf v${THRIFT_VERSION}.tar.gz +cd thrift-${THRIFT_VERSION} +mkdir -p out +pushd out +cmake -G Ninja .. \ + -DBUILD_COMPILER=OFF \ + -DBUILD_CPP=ON \ + -DBUILD_LIBRARIES=ON \ + -DBUILD_NODEJS=OFF \ + -DBUILD_PYTHON=OFF \ + -DBUILD_JAVASCRIPT=OFF \ + -DBUILD_C_GLIB=OFF \ + -DBUILD_JAVA=OFF \ + -DBUILD_TESTING=OFF \ + -DBUILD_TUTORIALS=OFF \ + -DWITH_STDTHREADS=ON \ + -DWITH_BOOSTTHREADS=OFF \ + -DWITH_BOOST_FUNCTIONAL=OFF \ + -DWITH_BOOST_SMART_PTR=OFF \ + -DCMAKE_INSTALL_PREFIX=$INSTALL_DIR \ + -DCMAKE_PREFIX_PATH=$INSTALL_DIR \ + .. + +ninja -j $(nproc) +ninja install +popd +popd diff --git a/src/jaegertracing/opentelemetry-cpp/ci/setup_windows_ci_environment.ps1 b/src/jaegertracing/opentelemetry-cpp/ci/setup_windows_ci_environment.ps1 new file mode 100755 index 000000000..4a0e04459 --- /dev/null +++ b/src/jaegertracing/opentelemetry-cpp/ci/setup_windows_ci_environment.ps1 @@ -0,0 +1,19 @@ +$ErrorActionPreference = "Stop" +trap { $host.SetShouldExit(1) } + +git submodule update -f "tools/vcpkg" +Push-Location -Path "tools/vcpkg" +$VCPKG_DIR = (Get-Item -Path ".\").FullName +./bootstrap-vcpkg.bat +./vcpkg integrate install + +# Patched Google Benchmark can be shared between vs2017 and vs2019 compilers +./vcpkg "--vcpkg-root=$VCPKG_DIR" install --overlay-ports="$PSScriptRoot\ports" benchmark:x64-windows + +# Google Test +./vcpkg "--vcpkg-root=$VCPKG_DIR" install gtest:x64-windows + +# nlohmann-json +./vcpkg "--vcpkg-root=$VCPKG_DIR" install nlohmann-json:x64-windows + +Pop-Location diff --git a/src/jaegertracing/opentelemetry-cpp/ci/setup_windows_cmake.ps1 b/src/jaegertracing/opentelemetry-cpp/ci/setup_windows_cmake.ps1 new file mode 100755 index 000000000..3248b4c72 --- /dev/null +++ b/src/jaegertracing/opentelemetry-cpp/ci/setup_windows_cmake.ps1 @@ -0,0 +1,17 @@ +$ErrorActionPreference = "Stop" +trap { $host.SetShouldExit(1) } + +$CMAKE_VERSION="3.15.2" +$CWD=(Get-Item -Path ".\").FullName +(new-object System.Net.WebClient). ` + DownloadFile("https://github.com/Kitware/CMake/releases/download/v$CMAKE_VERSION/cmake-$CMAKE_VERSION-win64-x64.zip", ` + "$CWD\cmake-$CMAKE_VERSION-win64-x64.zip") + +unzip cmake-$CMAKE_VERSION-win64-x64.zip + +$ENV:PATH="$ENV:PATH;$CWD\cmake-$CMAKE_VERSION-win64-x64\bin" +cmake --help +[Environment]::SetEnvironmentVariable( + "Path", + [Environment]::GetEnvironmentVariable("Path", [EnvironmentVariableTarget]::Machine) + ";$CWD\cmake-$CMAKE_VERSION-win64-x64\bin", + [EnvironmentVariableTarget]::Machine) diff --git a/src/jaegertracing/opentelemetry-cpp/ci/toc.yml b/src/jaegertracing/opentelemetry-cpp/ci/toc.yml new file mode 100644 index 000000000..64357acfc --- /dev/null +++ b/src/jaegertracing/opentelemetry-cpp/ci/toc.yml @@ -0,0 +1,2 @@ +- name: OpenTelemetry CPP + href: ./README.md diff --git a/src/jaegertracing/opentelemetry-cpp/ci/valgrind-suppressions b/src/jaegertracing/opentelemetry-cpp/ci/valgrind-suppressions new file mode 100644 index 000000000..28741e7a1 --- /dev/null +++ b/src/jaegertracing/opentelemetry-cpp/ci/valgrind-suppressions @@ -0,0 +1,15 @@ +{ + <flakiness on gRPC initialization> + Memcheck:Leak + ... + fun:grpc_shutdown + ... +} + +{ + <flakiness on gRPC initialization> + Memcheck:Leak + ... + fun:grpc_init + ... +} |