From 84d19f30c70449059024e737e4192d465ddb86ec Mon Sep 17 00:00:00 2001 From: Daniel Bang Date: Fri, 24 Jul 2020 13:43:43 -0500 Subject: [PATCH 1/7] Supporting C++20 --- ci/Dockerfile | 12 ++++++++++-- ci/do_ci.sh | 1 + ci/run_docker.sh | 13 +++++++++---- ci/setup_ci_environment.sh | 3 ++- 4 files changed, 22 insertions(+), 7 deletions(-) diff --git a/ci/Dockerfile b/ci/Dockerfile index a1f43af928..a758209a54 100644 --- a/ci/Dockerfile +++ b/ci/Dockerfile @@ -1,4 +1,4 @@ -FROM ubuntu:18.04 +FROM ubuntu:20.04 WORKDIR /setup-ci @@ -9,9 +9,17 @@ ADD install_bazelisk.sh /setup-ci ADD install_protobuf.sh /setup-ci ADD install_format_tools.sh /setup-ci +ENV DEBIAN_FRONTEND noninteractive +ENV DEBCONF_NONINTERACTIVE_SEEN true + +RUN echo "tzdata tzdata/Areas select US" > /tmp/preseed.txt; \ + echo "tzdata tzdata/Zones/Europe select Chicago" >> /tmp/preseed.txt; \ + debconf-set-selections /tmp/preseed.txt && \ + apt-get update && \ + apt-get install -y tzdata + 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/ci/do_ci.sh b/ci/do_ci.sh index b6d23f763f..46cd5dab70 100755 --- a/ci/do_ci.sh +++ b/ci/do_ci.sh @@ -21,6 +21,7 @@ if [[ "$1" == "cmake.test" ]]; then make test exit 0 elif [[ "$1" == "cmake.c++20.test" ]]; then + echo "${BUILD_DIR}" cd "${BUILD_DIR}" rm -rf * cmake -DCMAKE_BUILD_TYPE=Debug \ diff --git a/ci/run_docker.sh b/ci/run_docker.sh index c09ca51ce4..7b3b650e34 100755 --- a/ci/run_docker.sh +++ b/ci/run_docker.sh @@ -3,12 +3,17 @@ set -e BUILD_IMAGE=opentelemetry-cpp-build +BUILD_IMAGE2=opentelemetry-cpp-build2 docker image inspect "$BUILD_IMAGE" &> /dev/null || { docker build -t "$BUILD_IMAGE" ci } -if [[ $# -ge 1 ]]; then - docker run -v "$PWD":/src -w /src -it "$BUILD_IMAGE" "$@" +if [ $2 == cmake.c++20.test ]; then + docker run -v "$PWD":/src -w /src -it "$BUILD_IMAGE2" "$@" else - docker run -v "$PWD":/src -w /src --privileged -it "$BUILD_IMAGE" /bin/bash -l -fi + if [[ $# -ge 1 ]]; then + docker run -v "$PWD":/src -w /src -it "$BUILD_IMAGE" "$@" + else + docker run -v "$PWD":/src -w /src --privileged -it "$BUILD_IMAGE" /bin/bash -l + fi +fi \ No newline at end of file diff --git a/ci/setup_ci_environment.sh b/ci/setup_ci_environment.sh index 9d7df6a1d5..b5ef8da358 100755 --- a/ci/setup_ci_environment.sh +++ b/ci/setup_ci_environment.sh @@ -6,5 +6,6 @@ apt-get install --no-install-recommends --no-install-suggests -y \ build-essential \ ca-certificates \ wget \ - git + git \ + g++-10 apt-get install -y lcov From 4a9955dab8f87417e026ac2892c33eb9cdf58f59 Mon Sep 17 00:00:00 2001 From: Daniel Bang Date: Fri, 24 Jul 2020 14:24:53 -0500 Subject: [PATCH 2/7] fixed the issue for cmake.c++20.test --- ci/Dockerfile | 11 ++--------- ci/run_docker.sh | 3 +++ 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/ci/Dockerfile b/ci/Dockerfile index a758209a54..e07cdcc925 100644 --- a/ci/Dockerfile +++ b/ci/Dockerfile @@ -1,4 +1,4 @@ -FROM ubuntu:20.04 +FROM ubuntu:18.04 WORKDIR /setup-ci @@ -9,17 +9,10 @@ ADD install_bazelisk.sh /setup-ci ADD install_protobuf.sh /setup-ci ADD install_format_tools.sh /setup-ci -ENV DEBIAN_FRONTEND noninteractive -ENV DEBCONF_NONINTERACTIVE_SEEN true - -RUN echo "tzdata tzdata/Areas select US" > /tmp/preseed.txt; \ - echo "tzdata tzdata/Zones/Europe select Chicago" >> /tmp/preseed.txt; \ - debconf-set-selections /tmp/preseed.txt && \ - apt-get update && \ - apt-get install -y tzdata 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/ci/run_docker.sh b/ci/run_docker.sh index 7b3b650e34..d28a8c5199 100755 --- a/ci/run_docker.sh +++ b/ci/run_docker.sh @@ -7,6 +7,9 @@ BUILD_IMAGE2=opentelemetry-cpp-build2 docker image inspect "$BUILD_IMAGE" &> /dev/null || { docker build -t "$BUILD_IMAGE" ci } +docker image inspect "$BUILD_IMAGE2" &> /dev/null || { + docker build -t "$BUILD_IMAGE2" ci/cpp20 +} if [ $2 == cmake.c++20.test ]; then docker run -v "$PWD":/src -w /src -it "$BUILD_IMAGE2" "$@" From 963f226d3d5945ea1d259937a4b3b572a612ead9 Mon Sep 17 00:00:00 2001 From: Daniel Bang Date: Fri, 24 Jul 2020 15:13:14 -0500 Subject: [PATCH 3/7] fixed issue for cmake20 --- ci/README.md | 5 ++++- ci/cpp20/Dockerfile | 20 ++++++++++++++++++++ ci/cpp20/install_format_tools.sh | 8 ++++++++ ci/cpp20/setup_ci_environment.sh | 11 +++++++++++ ci/cpp20/setup_cmake.sh | 16 ++++++++++++++++ ci/run_docker.sh | 20 ++++++++++---------- ci/setup_ci_environment.sh | 3 +-- 7 files changed, 70 insertions(+), 13 deletions(-) create mode 100644 ci/cpp20/Dockerfile create mode 100755 ci/cpp20/install_format_tools.sh create mode 100755 ci/cpp20/setup_ci_environment.sh create mode 100755 ci/cpp20/setup_cmake.sh diff --git a/ci/README.md b/ci/README.md index 6695c8b134..d95ebbe69f 100644 --- a/ci/README.md +++ b/ci/README.md @@ -16,4 +16,7 @@ CI tests can be run on docker by invoking the script `./ci/run_docker.sh ./ci/do * `code.coverage`: build cmake targets and run tests. Then upload coverage report to [codecov.io](https://codecov.io/). Additionally, `./ci/run_docker.sh` can be invoked with no arguments to get a docker shell where tests -can be run manually. +can be run manually, except for `cmake.c++20.test`. + +Note that `cmake.c++20.test` can only run in a Ubuntu version 20+ container, as earlier versions of Ubuntu do not support C++20 or g++-10. +To run said test, you must run it in the specified Ubuntu 20.04 container by invoking `./ci/run_docker.sh ./ci/do_ci.sh cmake.c++20.test`. diff --git a/ci/cpp20/Dockerfile b/ci/cpp20/Dockerfile new file mode 100644 index 0000000000..93d27c196e --- /dev/null +++ b/ci/cpp20/Dockerfile @@ -0,0 +1,20 @@ +FROM ubuntu:20.04 + +WORKDIR /setup-ci + +ADD setup_ci_environment.sh /setup-ci +ADD setup_cmake.sh /setup-ci +ADD install_format_tools.sh /setup-ci + +ENV DEBIAN_FRONTEND noninteractive +ENV DEBCONF_NONINTERACTIVE_SEEN true + +RUN echo "tzdata tzdata/Areas select US" > /tmp/preseed.txt; \ + echo "tzdata tzdata/Zones/Europe select Chicago" >> /tmp/preseed.txt; \ + debconf-set-selections /tmp/preseed.txt && \ + apt-get update && \ + apt-get install -y tzdata + +RUN /setup-ci/setup_ci_environment.sh \ + && /setup-ci/setup_cmake.sh \ + && /setup-ci/install_format_tools.sh diff --git a/ci/cpp20/install_format_tools.sh b/ci/cpp20/install_format_tools.sh new file mode 100755 index 0000000000..c589250168 --- /dev/null +++ b/ci/cpp20/install_format_tools.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +set -e + +apt install -y clang-format-8 python3-pip git curl +pip3 install cmake_format==0.6.5 +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/ci/cpp20/setup_ci_environment.sh b/ci/cpp20/setup_ci_environment.sh new file mode 100755 index 0000000000..b5ef8da358 --- /dev/null +++ b/ci/cpp20/setup_ci_environment.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +set -e +apt-get update +apt-get install --no-install-recommends --no-install-suggests -y \ + build-essential \ + ca-certificates \ + wget \ + git \ + g++-10 +apt-get install -y lcov diff --git a/ci/cpp20/setup_cmake.sh b/ci/cpp20/setup_cmake.sh new file mode 100755 index 0000000000..0ab9be37fd --- /dev/null +++ b/ci/cpp20/setup_cmake.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +set -e + +apt-get install --no-install-recommends --no-install-suggests -y \ + cmake \ + libbenchmark-dev \ + libgtest-dev + +# Follows these instructions for setting up gtest +# https://www.eriksmistad.no/getting-started-with-google-test-on-ubuntu/ +pushd /usr/src/gtest +cmake CMakeLists.txt +make +cp *.a /usr/lib || cp lib/*.a /usr/lib +popd diff --git a/ci/run_docker.sh b/ci/run_docker.sh index d28a8c5199..e4a9831fe1 100755 --- a/ci/run_docker.sh +++ b/ci/run_docker.sh @@ -2,18 +2,18 @@ set -e -BUILD_IMAGE=opentelemetry-cpp-build -BUILD_IMAGE2=opentelemetry-cpp-build2 -docker image inspect "$BUILD_IMAGE" &> /dev/null || { - docker build -t "$BUILD_IMAGE" ci -} -docker image inspect "$BUILD_IMAGE2" &> /dev/null || { - docker build -t "$BUILD_IMAGE2" ci/cpp20 -} +BUILD_IMAGE=opentelemetry-cpp-build6 +BUILD_IMAGEcpp20=opentelemetry-cpp20-build6 -if [ $2 == cmake.c++20.test ]; then - docker run -v "$PWD":/src -w /src -it "$BUILD_IMAGE2" "$@" +if [[ $2 == cmake.c++20.test ]]; then + docker image inspect "$BUILD_IMAGEcpp20" &> /dev/null || { + docker build -t "$BUILD_IMAGEcpp20" ci/cpp20 + } + docker run -v "$PWD":/src -w /src -it "$BUILD_IMAGEcpp20" "$@" else + docker image inspect "$BUILD_IMAGE" &> /dev/null || { + docker build -t "$BUILD_IMAGE" ci + } if [[ $# -ge 1 ]]; then docker run -v "$PWD":/src -w /src -it "$BUILD_IMAGE" "$@" else diff --git a/ci/setup_ci_environment.sh b/ci/setup_ci_environment.sh index b5ef8da358..9d7df6a1d5 100755 --- a/ci/setup_ci_environment.sh +++ b/ci/setup_ci_environment.sh @@ -6,6 +6,5 @@ apt-get install --no-install-recommends --no-install-suggests -y \ build-essential \ ca-certificates \ wget \ - git \ - g++-10 + git apt-get install -y lcov From 0c51c92fc9c20008955b49a8a4ae276ae20ecd0f Mon Sep 17 00:00:00 2001 From: Daniel Bang Date: Fri, 24 Jul 2020 15:13:42 -0500 Subject: [PATCH 4/7] fixed issue for cmake20 --- ci/run_docker.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ci/run_docker.sh b/ci/run_docker.sh index e4a9831fe1..3da8fde1c6 100755 --- a/ci/run_docker.sh +++ b/ci/run_docker.sh @@ -2,8 +2,8 @@ set -e -BUILD_IMAGE=opentelemetry-cpp-build6 -BUILD_IMAGEcpp20=opentelemetry-cpp20-build6 +BUILD_IMAGE=opentelemetry-cpp-build +BUILD_IMAGEcpp20=opentelemetry-cpp20-build if [[ $2 == cmake.c++20.test ]]; then docker image inspect "$BUILD_IMAGEcpp20" &> /dev/null || { From 14b694538d357a07e31e03b16dd463df3cc3140f Mon Sep 17 00:00:00 2001 From: Daniel Bang Date: Fri, 24 Jul 2020 15:16:34 -0500 Subject: [PATCH 5/7] fixed issue for cmake20 --- ci/cpp20/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/cpp20/Dockerfile b/ci/cpp20/Dockerfile index 93d27c196e..692e4e4e4e 100644 --- a/ci/cpp20/Dockerfile +++ b/ci/cpp20/Dockerfile @@ -10,7 +10,7 @@ ENV DEBIAN_FRONTEND noninteractive ENV DEBCONF_NONINTERACTIVE_SEEN true RUN echo "tzdata tzdata/Areas select US" > /tmp/preseed.txt; \ - echo "tzdata tzdata/Zones/Europe select Chicago" >> /tmp/preseed.txt; \ + echo "tzdata tzdata/Zones/US select Chicago" >> /tmp/preseed.txt; \ debconf-set-selections /tmp/preseed.txt && \ apt-get update && \ apt-get install -y tzdata From c285401bba125a060cca526d0189daaad614138f Mon Sep 17 00:00:00 2001 From: Daniel Bang Date: Thu, 30 Jul 2020 14:14:44 -0500 Subject: [PATCH 6/7] Lalit's suggestions, single Dockerfile --- .DS_Store | Bin 0 -> 6148 bytes ci/Dockerfile | 4 +++- ci/cpp20/Dockerfile | 20 -------------------- ci/cpp20/install_format_tools.sh | 8 -------- ci/cpp20/setup_ci_environment.sh | 11 ----------- ci/cpp20/setup_cmake.sh | 16 ---------------- ci/install_gcc10.sh | 8 ++++++++ ci/run_docker.sh | 20 ++++++-------------- ci/setup_ci_environment.sh | 3 ++- 9 files changed, 19 insertions(+), 71 deletions(-) create mode 100644 .DS_Store delete mode 100644 ci/cpp20/Dockerfile delete mode 100755 ci/cpp20/install_format_tools.sh delete mode 100755 ci/cpp20/setup_ci_environment.sh delete mode 100755 ci/cpp20/setup_cmake.sh create mode 100644 ci/install_gcc10.sh diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..03accdddc934036e2f01ab1db6167358902314e9 GIT binary patch literal 6148 zcmeHK%Wl&^6upxNb*P{bLMrUML1Iy%go+jkA%!#%ig;CZp$kB%U0aP+$Btr$qzysY z@DB*SfM4MU_z*q-&OAW26Qr&Xg1OPmxifR_*!PU>$q*51j@&v?m52-!j-`vJmKY!B zWx)!n=L(SVIie#ch#a)|blS86T7kb^0sih5$)*AMognl6-owbv@4`e9WpcnfBaea{ z^K*__prib3Y<(HW8OH;7!~|38LzEgG`12u8O2R|_>#AF z?WE@@e?N+XU%u_U@V#-jdUYoX6Wb5Hp$PU}50qC2e&|NyW;6=jSj=O|0e+oIw|ad# zt#55^ZJ2lKcV-*rbbGr7|Muo=Rx#FZ)bDo=`=@8qx3hO2g&M^0#S^xs@F#qNBNTXJ z4Z|P`kJ0AbGF0h9!4vYb`my&IO)GtwcIb&@(qr-|rUc~{>Io&e*l)SmHN-xnr?gLd z)S)Ilhu1;-A>#YwW}}I(@rTqJm&m0E_ZjDSe1+3I15d#Oci6{s6Tr{$#cHSd6~P~1 z?jf@9Q0F7K2I+{Rh**|wnzaIbI>@+<3@vKs?i$%KBb8kRnzZQwwV-Z$sUFBP6H$cj zE}dlO<=JIetH`N`bsB=(g(9}d@-!EP3^P$>L`C=o3tC`JGt3GdU`_Yv5pvwc{UhJ( z+WlP zu%U1+5j`*_LxD1ssUrqcX9p(3G2T%8xkMRGOk5fBs4FvdLSgFY!AwCX){v-ct$ /tmp/preseed.txt; \ - echo "tzdata tzdata/Zones/US select Chicago" >> /tmp/preseed.txt; \ - debconf-set-selections /tmp/preseed.txt && \ - apt-get update && \ - apt-get install -y tzdata - -RUN /setup-ci/setup_ci_environment.sh \ - && /setup-ci/setup_cmake.sh \ - && /setup-ci/install_format_tools.sh diff --git a/ci/cpp20/install_format_tools.sh b/ci/cpp20/install_format_tools.sh deleted file mode 100755 index c589250168..0000000000 --- a/ci/cpp20/install_format_tools.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash - -set -e - -apt install -y clang-format-8 python3-pip git curl -pip3 install cmake_format==0.6.5 -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/ci/cpp20/setup_ci_environment.sh b/ci/cpp20/setup_ci_environment.sh deleted file mode 100755 index b5ef8da358..0000000000 --- a/ci/cpp20/setup_ci_environment.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash - -set -e -apt-get update -apt-get install --no-install-recommends --no-install-suggests -y \ - build-essential \ - ca-certificates \ - wget \ - git \ - g++-10 -apt-get install -y lcov diff --git a/ci/cpp20/setup_cmake.sh b/ci/cpp20/setup_cmake.sh deleted file mode 100755 index 0ab9be37fd..0000000000 --- a/ci/cpp20/setup_cmake.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash - -set -e - -apt-get install --no-install-recommends --no-install-suggests -y \ - cmake \ - libbenchmark-dev \ - libgtest-dev - -# Follows these instructions for setting up gtest -# https://www.eriksmistad.no/getting-started-with-google-test-on-ubuntu/ -pushd /usr/src/gtest -cmake CMakeLists.txt -make -cp *.a /usr/lib || cp lib/*.a /usr/lib -popd diff --git a/ci/install_gcc10.sh b/ci/install_gcc10.sh new file mode 100644 index 0000000000..65ce5ebfc9 --- /dev/null +++ b/ci/install_gcc10.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +set -e +apt-get -y install software-properties-common +add-apt-repository -y ppa:ubuntu-toolchain-r/test +apt-get -y update +apt install -y gcc-10 +apt install -y g++-10 \ No newline at end of file diff --git a/ci/run_docker.sh b/ci/run_docker.sh index 3da8fde1c6..8233aa13db 100755 --- a/ci/run_docker.sh +++ b/ci/run_docker.sh @@ -2,21 +2,13 @@ set -e -BUILD_IMAGE=opentelemetry-cpp-build -BUILD_IMAGEcpp20=opentelemetry-cpp20-build +BUILD_IMAGE=opentelemetry-cpp-build-test -if [[ $2 == cmake.c++20.test ]]; then - docker image inspect "$BUILD_IMAGEcpp20" &> /dev/null || { - docker build -t "$BUILD_IMAGEcpp20" ci/cpp20 +docker image inspect "$BUILD_IMAGE" &> /dev/null || { + docker build -t "$BUILD_IMAGE" ci } - docker run -v "$PWD":/src -w /src -it "$BUILD_IMAGEcpp20" "$@" +if [[ $# -ge 1 ]]; then + docker run -v "$PWD":/src -w /src -it "$BUILD_IMAGE" "$@" else - docker image inspect "$BUILD_IMAGE" &> /dev/null || { - docker build -t "$BUILD_IMAGE" ci - } - if [[ $# -ge 1 ]]; then - docker run -v "$PWD":/src -w /src -it "$BUILD_IMAGE" "$@" - else - docker run -v "$PWD":/src -w /src --privileged -it "$BUILD_IMAGE" /bin/bash -l - fi + docker run -v "$PWD":/src -w /src --privileged -it "$BUILD_IMAGE" /bin/bash -l fi \ No newline at end of file diff --git a/ci/setup_ci_environment.sh b/ci/setup_ci_environment.sh index 9d7df6a1d5..98bdac9ee0 100755 --- a/ci/setup_ci_environment.sh +++ b/ci/setup_ci_environment.sh @@ -6,5 +6,6 @@ apt-get install --no-install-recommends --no-install-suggests -y \ build-essential \ ca-certificates \ wget \ - git + git \ + g++-10 apt-get install -y lcov From e44a3a267c38288b76b2e10ceccb225abbbaf7b1 Mon Sep 17 00:00:00 2001 From: Daniel Bang Date: Thu, 30 Jul 2020 14:49:44 -0500 Subject: [PATCH 7/7] Lalit's suggestions, single Dockerfile --- ci/Dockerfile | 5 +++-- ci/install_gcc10.sh | 0 ci/setup_ci_environment.sh | 3 +-- 3 files changed, 4 insertions(+), 4 deletions(-) mode change 100644 => 100755 ci/install_gcc10.sh diff --git a/ci/Dockerfile b/ci/Dockerfile index d0dae6a71b..1563dde858 100644 --- a/ci/Dockerfile +++ b/ci/Dockerfile @@ -14,7 +14,8 @@ 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_gcc10.sh \ && /setup-ci/install_bazelisk.sh \ && /setup-ci/install_protobuf.sh \ - && /setup-ci/install_format_tools.sh \ - && /setup-ci/install_gcc10.sh \ No newline at end of file + && /setup-ci/install_format_tools.sh + \ No newline at end of file diff --git a/ci/install_gcc10.sh b/ci/install_gcc10.sh old mode 100644 new mode 100755 diff --git a/ci/setup_ci_environment.sh b/ci/setup_ci_environment.sh index 98bdac9ee0..9d7df6a1d5 100755 --- a/ci/setup_ci_environment.sh +++ b/ci/setup_ci_environment.sh @@ -6,6 +6,5 @@ apt-get install --no-install-recommends --no-install-suggests -y \ build-essential \ ca-certificates \ wget \ - git \ - g++-10 + git apt-get install -y lcov