Skip to content

Commit

Permalink
fixed issue for cmake20
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Bang committed Jul 24, 2020
1 parent 4a9955d commit 963f226
Show file tree
Hide file tree
Showing 7 changed files with 70 additions and 13 deletions.
5 changes: 4 additions & 1 deletion ci/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
20 changes: 20 additions & 0 deletions ci/cpp20/Dockerfile
Original file line number Diff line number Diff line change
@@ -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
8 changes: 8 additions & 0 deletions ci/cpp20/install_format_tools.sh
Original file line number Diff line number Diff line change
@@ -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
11 changes: 11 additions & 0 deletions ci/cpp20/setup_ci_environment.sh
Original file line number Diff line number Diff line change
@@ -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
16 changes: 16 additions & 0 deletions ci/cpp20/setup_cmake.sh
Original file line number Diff line number Diff line change
@@ -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
20 changes: 10 additions & 10 deletions ci/run_docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions ci/setup_ci_environment.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 963f226

Please sign in to comment.