Skip to content

Commit

Permalink
Use latest grpc version (v1.39.0) for cmake build of otlp exporter. (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
lalitb authored Aug 2, 2021
1 parent 5067e49 commit 03f9604
Show file tree
Hide file tree
Showing 3 changed files with 76 additions and 6 deletions.
25 changes: 24 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
./ci/do_ci.sh cmake.abseil.test
cmake_gcc_48_test:
name: CMake gcc 4.8
name: CMake gcc 4.8 (without otlp exporter)
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
Expand All @@ -59,6 +59,29 @@ jobs:
CC: /usr/bin/gcc-4.8
CXX: /usr/bin/g++-4.8

cmake_gcc_48_otlp_exporter_test:
name: CMake gcc 4.8 (with otlp exporter)
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
with:
submodules: 'recursive'
- name: setup
run: |
sudo ./ci/setup_ci_environment.sh
sudo ./ci/install_gcc48.sh
- name: setup cmake
run: |
sudo CC=/usr/bin/gcc-4.8 CXX=/usr/bin/g++-4.8 ./ci/setup_cmake.sh
- name: setup grpc
run: |
sudo CC=/usr/bin/gcc-4.8 CXX=/usr/bin/g++-4.8 ./ci/setup_grpc.sh -v 4.8
- name: run tests
run: ./ci/do_ci.sh cmake.legacy.exporter.otprotocol.test
env:
CC: /usr/bin/gcc-4.8
CXX: /usr/bin/g++-4.8

cmake_test_cxx20:
name: CMake C++20 test
runs-on: ubuntu-20.04
Expand Down
16 changes: 16 additions & 0 deletions ci/do_ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,22 @@ elif [[ "$1" == "cmake.legacy.test" ]]; then
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 *
Expand Down
41 changes: 36 additions & 5 deletions ci/setup_grpc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,57 @@

set -e
export DEBIAN_FRONTEND=noninteractive
old_grpc_version='v1.33.2'
new_grpc_version='v1.39.0'
gcc_version_for_new_grpc='5.1'
install_grpc_version=${new_grpc_version}
grpc_version='v1.39.0'
usage() { echo "Usage: $0 -v <gcc-version>" 1>&2; exit 1; }

while getopts ":v:" o; do
case "${o}" in
v)
gcc_version=${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=/usr/local/
pushd $BUILD_DIR
git clone --depth=1 -b v1.34.0 https://github.com/grpc/grpc
cd grpc
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 cmake/build
pushd cmake/build
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

0 comments on commit 03f9604

Please sign in to comment.