diff options
author | Vincent Ambo <tazjin@google.com> | 2020-02-26T14·22+0000 |
---|---|---|
committer | Vincent Ambo <tazjin@google.com> | 2020-02-26T14·22+0000 |
commit | 4bdb118d6e9fe02effa9199f48796dcec04a24b0 (patch) | |
tree | 5dd95a2bd05169f61c35de02584f302426537548 /third_party/cpp/googleapis/ci/kokoro | |
parent | 438050b3d9c0e1dcfe7e26d9446e19fff97ccf88 (diff) | |
parent | c873fd3aa14fb0d8696588117b5f79693381ba3c (diff) |
Add 'third_party/cpp/googleapis/' from commit 'c873fd3aa14fb0d8696588117b5f79693381ba3c' r/581
git-subtree-dir: third_party/cpp/googleapis git-subtree-mainline: 438050b3d9c0e1dcfe7e26d9446e19fff97ccf88 git-subtree-split: c873fd3aa14fb0d8696588117b5f79693381ba3c
Diffstat (limited to 'third_party/cpp/googleapis/ci/kokoro')
42 files changed, 1288 insertions, 0 deletions
diff --git a/third_party/cpp/googleapis/ci/kokoro/Dockerfile.centos b/third_party/cpp/googleapis/ci/kokoro/Dockerfile.centos new file mode 100644 index 000000000000..2982dae0e165 --- /dev/null +++ b/third_party/cpp/googleapis/ci/kokoro/Dockerfile.centos @@ -0,0 +1,51 @@ +# Copyright 2019 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +ARG DISTRO_VERSION=7 +FROM centos:${DISTRO_VERSION} + +# Add /usr/local/lib + +# Search paths tweak for the build +ENV PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/local/lib64/pkgconfig +ENV LD_LIBRARY_PATH=/usr/local/lib:/usr/local/lib64 +ENV PATH=/usr/local/bin:${PATH} + +# First install the development tools and OpenSSL. The development tools +# distributed with CentOS (notably CMake) are too old to build +# `google-cloud-cpp`. In these instructions, we use `cmake3` obtained from +# [Software Collections](https://www.softwarecollections.org/). + +RUN rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm +RUN yum install -y centos-release-scl +RUN yum-config-manager --enable rhel-server-rhscl-7-rpms +RUN yum makecache && \ + yum install -y automake cmake3 curl-devel gcc gcc-c++ git libtool \ + make openssl-devel pkgconfig tar wget which zlib-devel +RUN ln -sf /usr/bin/cmake3 /usr/bin/cmake && ln -sf /usr/bin/ctest3 /usr/bin/ctest + +# Install c-ares +RUN mkdir -p /var/tmp/Downloads; \ + cd /var/tmp/Downloads; \ + wget -q https://github.com/c-ares/c-ares/archive/cares-1_15_0.tar.gz; \ + tar -xf cares-1_15_0.tar.gz; \ + cd /var/tmp/Downloads/c-ares-cares-1_15_0; \ + ./buildconf && ./configure && make -j $(nproc); \ + make install; \ + ldconfig + +# Install grpc from source +WORKDIR /var/tmp/ci +COPY install-grpc.sh /var/tmp/ci +RUN /var/tmp/ci/install-grpc.sh diff --git a/third_party/cpp/googleapis/ci/kokoro/Dockerfile.fedora b/third_party/cpp/googleapis/ci/kokoro/Dockerfile.fedora new file mode 100644 index 000000000000..c56ace3b1aaf --- /dev/null +++ b/third_party/cpp/googleapis/ci/kokoro/Dockerfile.fedora @@ -0,0 +1,38 @@ +# Copyright 2019 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +ARG DISTRO_VERSION=30 +FROM fedora:${DISTRO_VERSION} + +# Fedora includes packages for gRPC, libcurl, and OpenSSL that are recent enough +# for `google-cloud-cpp`. Install these packages and additional development +# tools to compile the dependencies: +RUN dnf makecache && \ + dnf install -y clang clang-tools-extra cmake doxygen findutils gcc-c++ git \ + grpc-devel grpc-plugins libcxx-devel libcxxabi-devel libcurl-devel \ + make openssl-devel pkgconfig protobuf-compiler python-pip ShellCheck \ + tar wget zlib-devel + +# Install the the buildifier tool, which does not compile with the default +# golang compiler for Ubuntu 16.04 and Ubuntu 18.04. +RUN wget -q -O /usr/bin/buildifier https://github.com/bazelbuild/buildtools/releases/download/0.17.2/buildifier +RUN chmod 755 /usr/bin/buildifier + +# Install cmake_format to automatically format the CMake list files. +# https://github.com/cheshirekow/cmake_format +# Pin this to an specific version because the formatting changes when the +# "latest" version is updated, and we do not want the builds to break just +# because some third party changed something. +RUN pip install --upgrade pip +RUN pip install numpy cmake_format==0.6.9 diff --git a/third_party/cpp/googleapis/ci/kokoro/Dockerfile.ubuntu-16.04 b/third_party/cpp/googleapis/ci/kokoro/Dockerfile.ubuntu-16.04 new file mode 100644 index 000000000000..8ef65dd9b2e6 --- /dev/null +++ b/third_party/cpp/googleapis/ci/kokoro/Dockerfile.ubuntu-16.04 @@ -0,0 +1,53 @@ +# Copyright 2019 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +FROM ubuntu:16.04 + +RUN apt update && \ + apt install -y \ + automake \ + build-essential \ + clang \ + cmake \ + curl \ + doxygen \ + gawk \ + git \ + gcc \ + golang \ + g++ \ + libssl-dev \ + libtool \ + make \ + ninja-build \ + pkg-config \ + python-pip \ + shellcheck \ + tar \ + unzip \ + wget \ + zlib1g-dev + +WORKDIR /var/tmp/Downloads +RUN wget -q https://github.com/c-ares/c-ares/archive/cares-1_15_0.tar.gz && \ + tar -xf cares-1_15_0.tar.gz && \ + cd /var/tmp/Downloads/c-ares-cares-1_15_0 && \ + ./buildconf && ./configure && make -j $(nproc) && \ + make install && \ + ldconfig + +# Install grpc from source +WORKDIR /var/tmp/ci +COPY install-grpc.sh /var/tmp/ci +RUN /var/tmp/ci/install-grpc.sh diff --git a/third_party/cpp/googleapis/ci/kokoro/Dockerfile.ubuntu-18.04 b/third_party/cpp/googleapis/ci/kokoro/Dockerfile.ubuntu-18.04 new file mode 100644 index 000000000000..d3660dafa25a --- /dev/null +++ b/third_party/cpp/googleapis/ci/kokoro/Dockerfile.ubuntu-18.04 @@ -0,0 +1,45 @@ +# Copyright 2019 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +FROM ubuntu:18.04 + +RUN apt update && \ + apt install -y \ + build-essential \ + clang \ + cmake \ + curl \ + doxygen \ + gawk \ + git \ + gcc \ + golang \ + g++ \ + libc-ares-dev \ + libc-ares2 \ + libssl-dev \ + make \ + ninja-build \ + pkg-config \ + python-pip \ + shellcheck \ + tar \ + unzip \ + wget \ + zlib1g-dev + +# Install grpc from source +WORKDIR /var/tmp/ci +COPY install-grpc.sh /var/tmp/ci +RUN /var/tmp/ci/install-grpc.sh diff --git a/third_party/cpp/googleapis/ci/kokoro/docker/build-in-docker-cmake.sh b/third_party/cpp/googleapis/ci/kokoro/docker/build-in-docker-cmake.sh new file mode 100755 index 000000000000..4dd9e7eb3dff --- /dev/null +++ b/third_party/cpp/googleapis/ci/kokoro/docker/build-in-docker-cmake.sh @@ -0,0 +1,112 @@ +#!/usr/bin/env bash +# Copyright 2019 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +set -eu + +if [[ $# != 2 ]]; then + echo "Usage: $(basename "$0") <source-directory> <binary-directory>" + exit 1 +fi + +readonly SOURCE_DIR="$1" +readonly BINARY_DIR="$2" + +# This script is supposed to run inside a Docker container, see +# ci/kokoro/cmake/installed-dependencies/build.sh for the expected setup. The +# /v directory is a volume pointing to a (clean-ish) checkout of the project: +if [[ -z "${PROJECT_ROOT+x}" ]]; then + readonly PROJECT_ROOT="/v" +fi +source "${PROJECT_ROOT}/ci/colors.sh" + +echo +echo "${COLOR_YELLOW}Starting docker build $(date) with $(nproc) cores${COLOR_RESET}" +echo + +echo "================================================================" +echo "Verify formatting $(date)" +(cd "${PROJECT_ROOT}" ; ./ci/check-style.sh) +echo "================================================================" + +echo "================================================================" +echo "Compiling on $(date)" +echo "================================================================" +cd "${PROJECT_ROOT}" +cmake_flags=() +if [[ "${CLANG_TIDY:-}" = "yes" ]]; then + cmake_flags+=("-DGOOGLE_CLOUD_CPP_CLANG_TIDY=yes") +fi +if [[ "${GOOGLE_CLOUD_CPP_CXX_STANDARD:-}" != "" ]]; then + cmake_flags+=( + "-DGOOGLE_CLOUD_CPP_CXX_STANDARD=${GOOGLE_CLOUD_CPP_CXX_STANDARD}") +fi + +if [[ "${CODE_COVERAGE:-}" == "yes" ]]; then + cmake_flags+=( + "-DCMAKE_BUILD_TYPE=Coverage") +fi + +if [[ "${USE_NINJA:-}" == "yes" ]]; then + cmake_flags+=( "-GNinja" ) +fi + +# Avoid unbound variable error with older bash +if [[ "${#cmake_flags[@]}" == 0 ]]; then + cmake "-H${SOURCE_DIR}" "-B${BINARY_DIR}" +else + cmake "-H${SOURCE_DIR}" "-B${BINARY_DIR}" "${cmake_flags[@]}" +fi +cmake --build "${BINARY_DIR}" -- -j "$(nproc)" + +# When user a super-build the tests are hidden in a subdirectory. We can tell +# that ${BINARY_DIR} does not have the tests by checking for this file: +if [[ -r "${BINARY_DIR}/CTestTestfile.cmake" ]]; then + echo "================================================================" + # It is Okay to skip the tests in this case because the super build + # automatically runs them. + echo "Running the unit tests $(date)" + env -C "${BINARY_DIR}" ctest \ + -LE integration-tests \ + --output-on-failure -j "$(nproc)" + echo "================================================================" +fi + +if [[ "${GENERATE_DOCS:-}" = "yes" ]]; then + echo "================================================================" + echo "Validate Doxygen documentation $(date)" + cmake --build "${BINARY_DIR}" --target doxygen-docs + echo "================================================================" +fi + +if [[ ${RUN_INTEGRATION_TESTS} == "yes" ]]; then + echo "================================================================" + echo "Running the integration tests $(date)" + echo "================================================================" + # shellcheck disable=SC1091 + source /c/spanner-integration-tests-config.sh + export GOOGLE_APPLICATION_CREDENTIALS=/c/spanner-credentials.json + + # Run the integration tests too. + env -C "${BINARY_DIR}" ctest \ + -L integration-tests \ + --output-on-failure + echo "================================================================" +fi + +echo "================================================================" +echo "Build finished at $(date)" +echo "================================================================" + +exit 0 diff --git a/third_party/cpp/googleapis/ci/kokoro/docker/build.sh b/third_party/cpp/googleapis/ci/kokoro/docker/build.sh new file mode 100755 index 000000000000..fbd886f02852 --- /dev/null +++ b/third_party/cpp/googleapis/ci/kokoro/docker/build.sh @@ -0,0 +1,272 @@ +#!/usr/bin/env bash +# Copyright 2019 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +set -eu + +export CC=gcc +export CXX=g++ +export DISTRO=ubuntu +export DISTRO_VERSION=18.04 +export CMAKE_SOURCE_DIR="." + +in_docker_script="ci/kokoro/docker/build-in-docker-cmake.sh" + +if [[ $# -eq 1 ]]; then + export BUILD_NAME="${1}" +elif [[ -n "${KOKORO_JOB_NAME:-}" ]]; then + # Kokoro injects the KOKORO_JOB_NAME environment variable, the value of this + # variable is cloud-cpp/spanner/<config-file-name-without-cfg> (or more + # generally <path/to/config-file-without-cfg>). By convention we name these + # files `$foo.cfg` for continuous builds and `$foo-presubmit.cfg` for + # presubmit builds. Here we extract the value of "foo" and use it as the build + # name. + BUILD_NAME="$(basename "${KOKORO_JOB_NAME}" "-presubmit")" + export BUILD_NAME +else + echo "Aborting build as the build name is not defined." + echo "If you are invoking this script via the command line use:" + echo " $0 <build-name>" + echo + echo "If this script is invoked by Kokoro, the CI system is expected to set" + echo "the KOKORO_JOB_NAME environment variable." + exit 1 +fi + +if [[ "${BUILD_NAME}" = "clang-tidy" ]]; then + # Compile with clang-tidy(1) turned on. The build treats clang-tidy warnings + # as errors. + export DISTRO=fedora + export DISTRO_VERSION=30 + export CC=clang + export CXX=clang++ + export CHECK_STYLE=yes + export CLANG_TIDY=yes +elif [[ "${BUILD_NAME}" = "ubuntu-18.04" ]]; then + export CC=gcc + export CXX=g++ +elif [[ "${BUILD_NAME}" = "ubuntu-16.04" ]]; then + export DISTRO_VERSION=16.04 + export CC=gcc + export CXX=g++ +elif [[ "${BUILD_NAME}" = "gcc-4.8" ]]; then + # The oldest version of GCC we support is 4.8, this build checks the code + # against that version. The use of CentOS 7 for that build is not a + # coincidence: the reason we support GCC 4.8 is to support this distribution + # (and its commercial cousin: RHEL 7). + export CC=gcc + export CXX=g++ + export DISTRO=centos + export DISTRO_VERSION=7 +elif [[ "${BUILD_NAME}" = "clang-3.8" ]]; then + # The oldest version of Clang we actively test is 3.8. There is nothing + # particularly interesting about that version. It is simply the version + # included with Ubuntu:16.04, and the oldest version tested by + # google-cloud-cpp. + export DISTRO=ubuntu + export DISTRO_VERSION=16.04 + export CC=clang + export CXX=clang++ +elif [[ "${BUILD_NAME}" = "ninja" ]]; then + # Compiling with Ninja can catch bugs that may not be caught using Make. + export USE_NINJA=yes +else + echo "Unknown BUILD_NAME (${BUILD_NAME}). Fix the Kokoro .cfg file." + exit 1 +fi + +if [[ -z "${PROJECT_ROOT+x}" ]]; then + readonly PROJECT_ROOT="$(cd "$(dirname "$0")/../../.."; pwd)" +fi + +if [[ -z "${PROJECT_ID+x}" ]]; then + readonly PROJECT_ID="cloud-devrel-kokoro-resources" +fi + +# Determine the image name. +readonly IMAGE="gcr.io/${PROJECT_ID}/cpp-cmakefiles/${DISTRO}-${DISTRO_VERSION}" +readonly BUILD_OUTPUT="cmake-out/${BUILD_NAME}" +readonly BUILD_HOME="cmake-out/home/${BUILD_NAME}" + +echo "================================================================" +cd "${PROJECT_ROOT}" +echo "Building with $(nproc) cores $(date) on ${PWD}." + +echo "================================================================" +echo "Capture Docker version to troubleshoot $(date)." +docker version +echo "================================================================" + +has_cache="false" + +if [[ -n "${KOKORO_JOB_NAME:-}" ]]; then + # Download the docker image from the previous build on kokoro for speed. + echo "================================================================" + echo "Downloading Docker image $(date)." + gcloud auth configure-docker + if docker pull "${IMAGE}:latest"; then + echo "Existing image successfully downloaded." + has_cache="true" + fi + echo "================================================================" +fi + +docker_build_flags=( + "-t" "${IMAGE}:latest" +) + +if [[ -f "ci/kokoro/Dockerfile.${DISTRO}-${DISTRO_VERSION}" ]]; then + docker_build_flags+=("-f" "ci/kokoro/Dockerfile.${DISTRO}-${DISTRO_VERSION}") +else + docker_build_flags+=( + "-f" "ci/kokoro/Dockerfile.${DISTRO}" + "--build-arg" "DISTRO_VERSION=${DISTRO_VERSION}" + ) +fi + +if "${has_cache}"; then + docker_build_flags+=("--cache-from=${IMAGE}:latest") +fi + +update_cache="false" +echo "================================================================" +echo "Creating Docker image with all the development tools $(date)." +if ci/retry-command.sh docker build "${docker_build_flags[@]}" ci; then + update_cache="true" + echo "Docker image created $(date)." + docker image ls | grep "${IMAGE}" +else + echo "Failed creating Docker image $(date)." + if "${has_cache}"; then + echo "Continue the build with the cache." + else + exit 1 + fi +fi +echo "================================================================" + +if [[ -n "${KOKORO_JOB_NAME:-}" ]]; then + # Upload the docker image for speeding up the future builds. + echo "================================================================" + echo "Uploading Docker image $(date)." + docker push "${IMAGE}:latest" || true + echo "================================================================" +fi + + +echo "================================================================" +echo "Running the full build $(date)." +# The default user for a Docker container has uid 0 (root). To avoid creating +# root-owned files in the build directory we tell docker to use the current +# user ID, if known. +docker_uid="${UID:-0}" +docker_user="${USER:-root}" +docker_home_prefix="${PWD}/cmake-out/home" +if [[ "${docker_uid}" == "0" ]]; then + docker_home_prefix="${PWD}/cmake-out/root" +fi + +# Make sure the user has a $HOME directory inside the Docker container. +mkdir -p "${BUILD_HOME}" +mkdir -p "${BUILD_OUTPUT}" + +# We use an array for the flags so they are easier to document. +docker_flags=( + # Grant the PTRACE capability to the Docker container running the build, + # this is needed by tools like AddressSanitizer. + "--cap-add" "SYS_PTRACE" + + # The name and version of the distribution, this is used to call + # define-docker-variables.sh and determine the Docker image built, and the + # output directory for any artifacts. + "--env" "DISTRO=${DISTRO}" + "--env" "DISTRO_VERSION=${DISTRO_VERSION}" + + # The C++ and C compiler, both Bazel and CMake use this environment variable + # to select the compiler binary. + "--env" "CXX=${CXX}" + "--env" "CC=${CC}" + + # If set to 'yes', the build script will run the style checks, including + # clang-format, cmake-format, and buildifier. + "--env" "CHECK_STYLE=${CHECK_STYLE:-}" + + # If set to 'yes', the build script will configure clang-tidy. Currently + # only the CMake builds use this flag. + "--env" "CLANG_TIDY=${CLANG_TIDY:-}" + + # If set to 'yes', run the integration tests. Currently only the Bazel + # builds use this flag. + "--env" "RUN_INTEGRATION_TESTS=${RUN_INTEGRATION_TESTS:-}" + + # If set to 'yes', run compile with code coverage flags. Currently only the + # CMake builds use this flag. + "--env" "CODE_COVERAGE=${CODE_COVERAGE:-}" + + # If set to 'yes', use Ninja as the CMake generator. Ninja is more strict + # that Make and can detect errors in your CMake files, it is also faster. + "--env" "USE_NINJA=${USE_NINJA:-}" + + # If set, pass -DGOOGLE_CLOUD_CPP_CXX_STANDARD=<value> to CMake. + "--env" "GOOGLE_CLOUD_CPP_CXX_STANDARD=${GOOGLE_CLOUD_CPP_CXX_STANDARD:-}" + + # When running the integration tests this directory contains the + # configuration files needed to run said tests. Make it available inside + # the Docker container. + "--volume" "${KOKORO_GFILE_DIR:-/dev/shm}:/c" + + # Let the Docker image script know what kind of terminal we are using, that + # produces properly colorized error messages. + "--env" "TERM=${TERM:-dumb}" + + # Run the docker script and this user id. Because the docker image gets to + # write in ${PWD} you typically want this to be your user id. + "--user" "${docker_uid}" + + # Bazel needs this environment variable to work correctly. + "--env" "USER=${docker_user}" + + # We give Bazel and CMake a fake $HOME inside the docker image. Bazel caches + # build byproducts in this directory. CMake (when ccache is enabled) uses + # it to store $HOME/.ccache + "--env" "HOME=/h" + "--volume" "${PWD}/${BUILD_HOME}:/h" + + # Mount the current directory (which is the top-level directory for the + # project) as `/v` inside the docker image, and move to that directory. + "--volume" "${PWD}:/v" + "--workdir" "/v" + + # Mask any other builds that may exist at the same time. That is, these + # directories appear as empty inside the Docker container, this prevents the + # container from writing into other builds, or to get confused by the output + # of other builds. In the CI system this does not matter, as each build runs + # on a completely separate VM. This is useful when running multiple builds + # in your workstation. + "--volume" "/v/cmake-out/home" + "--volume" "/v/cmake-out" + "--volume" "${PWD}/${BUILD_OUTPUT}:/v/${BUILD_OUTPUT}" +) + +# When running the builds from the command-line they get a tty, and the scripts +# running inside the Docker container can produce nicer output. On Kokoro the +# script does not get a tty, and Docker terminates the program if we pass the +# `-it` flag. +if [[ -t 0 ]]; then + docker_flags+=("-it") +fi + +docker run "${docker_flags[@]}" "${IMAGE}:latest" \ + "/v/${in_docker_script}" "${CMAKE_SOURCE_DIR}" \ + "${BUILD_OUTPUT}" diff --git a/third_party/cpp/googleapis/ci/kokoro/docker/clang-3.8-presubmit.cfg b/third_party/cpp/googleapis/ci/kokoro/docker/clang-3.8-presubmit.cfg new file mode 100644 index 000000000000..e69de29bb2d1 --- /dev/null +++ b/third_party/cpp/googleapis/ci/kokoro/docker/clang-3.8-presubmit.cfg diff --git a/third_party/cpp/googleapis/ci/kokoro/docker/clang-3.8.cfg b/third_party/cpp/googleapis/ci/kokoro/docker/clang-3.8.cfg new file mode 100644 index 000000000000..e69de29bb2d1 --- /dev/null +++ b/third_party/cpp/googleapis/ci/kokoro/docker/clang-3.8.cfg diff --git a/third_party/cpp/googleapis/ci/kokoro/docker/clang-tidy-presubmit.cfg b/third_party/cpp/googleapis/ci/kokoro/docker/clang-tidy-presubmit.cfg new file mode 100644 index 000000000000..e69de29bb2d1 --- /dev/null +++ b/third_party/cpp/googleapis/ci/kokoro/docker/clang-tidy-presubmit.cfg diff --git a/third_party/cpp/googleapis/ci/kokoro/docker/clang-tidy.cfg b/third_party/cpp/googleapis/ci/kokoro/docker/clang-tidy.cfg new file mode 100644 index 000000000000..e69de29bb2d1 --- /dev/null +++ b/third_party/cpp/googleapis/ci/kokoro/docker/clang-tidy.cfg diff --git a/third_party/cpp/googleapis/ci/kokoro/docker/common.cfg b/third_party/cpp/googleapis/ci/kokoro/docker/common.cfg new file mode 100644 index 000000000000..213d93419a12 --- /dev/null +++ b/third_party/cpp/googleapis/ci/kokoro/docker/common.cfg @@ -0,0 +1,17 @@ +# Format: //devtools/kokoro/config/proto/build.proto +# Copyright 2019 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +build_file: "cpp-cmakefiles/ci/kokoro/docker/build.sh" +timeout_mins: 120 diff --git a/third_party/cpp/googleapis/ci/kokoro/docker/gcc-4.8-presubmit.cfg b/third_party/cpp/googleapis/ci/kokoro/docker/gcc-4.8-presubmit.cfg new file mode 100644 index 000000000000..e69de29bb2d1 --- /dev/null +++ b/third_party/cpp/googleapis/ci/kokoro/docker/gcc-4.8-presubmit.cfg diff --git a/third_party/cpp/googleapis/ci/kokoro/docker/gcc-4.8.cfg b/third_party/cpp/googleapis/ci/kokoro/docker/gcc-4.8.cfg new file mode 100644 index 000000000000..e69de29bb2d1 --- /dev/null +++ b/third_party/cpp/googleapis/ci/kokoro/docker/gcc-4.8.cfg diff --git a/third_party/cpp/googleapis/ci/kokoro/docker/ninja-presubmit.cfg b/third_party/cpp/googleapis/ci/kokoro/docker/ninja-presubmit.cfg new file mode 100644 index 000000000000..e69de29bb2d1 --- /dev/null +++ b/third_party/cpp/googleapis/ci/kokoro/docker/ninja-presubmit.cfg diff --git a/third_party/cpp/googleapis/ci/kokoro/docker/ninja.cfg b/third_party/cpp/googleapis/ci/kokoro/docker/ninja.cfg new file mode 100644 index 000000000000..e69de29bb2d1 --- /dev/null +++ b/third_party/cpp/googleapis/ci/kokoro/docker/ninja.cfg diff --git a/third_party/cpp/googleapis/ci/kokoro/docker/ubuntu-16.04-presubmit.cfg b/third_party/cpp/googleapis/ci/kokoro/docker/ubuntu-16.04-presubmit.cfg new file mode 100644 index 000000000000..e69de29bb2d1 --- /dev/null +++ b/third_party/cpp/googleapis/ci/kokoro/docker/ubuntu-16.04-presubmit.cfg diff --git a/third_party/cpp/googleapis/ci/kokoro/docker/ubuntu-16.04.cfg b/third_party/cpp/googleapis/ci/kokoro/docker/ubuntu-16.04.cfg new file mode 100644 index 000000000000..e69de29bb2d1 --- /dev/null +++ b/third_party/cpp/googleapis/ci/kokoro/docker/ubuntu-16.04.cfg diff --git a/third_party/cpp/googleapis/ci/kokoro/docker/ubuntu-18.04-presubmit.cfg b/third_party/cpp/googleapis/ci/kokoro/docker/ubuntu-18.04-presubmit.cfg new file mode 100644 index 000000000000..e69de29bb2d1 --- /dev/null +++ b/third_party/cpp/googleapis/ci/kokoro/docker/ubuntu-18.04-presubmit.cfg diff --git a/third_party/cpp/googleapis/ci/kokoro/docker/ubuntu-18.04.cfg b/third_party/cpp/googleapis/ci/kokoro/docker/ubuntu-18.04.cfg new file mode 100644 index 000000000000..e69de29bb2d1 --- /dev/null +++ b/third_party/cpp/googleapis/ci/kokoro/docker/ubuntu-18.04.cfg diff --git a/third_party/cpp/googleapis/ci/kokoro/install/Dockerfile.centos-7 b/third_party/cpp/googleapis/ci/kokoro/install/Dockerfile.centos-7 new file mode 100644 index 000000000000..21b8908134d4 --- /dev/null +++ b/third_party/cpp/googleapis/ci/kokoro/install/Dockerfile.centos-7 @@ -0,0 +1,105 @@ +# Copyright 2019 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +FROM centos:7 AS devtools + +# Please keep the formatting in these commands, it is optimized to cut & paste +# into the INSTALL.md file. + +## [START INSTALL.md] + +# First install the development tools and OpenSSL. The development tools +# distributed with CentOS (notably CMake) are too old to build +# `cpp-cmakefiles`. In these instructions, we use `cmake3` obtained from +# [Software Collections](https://www.softwarecollections.org/). + +# ```bash +RUN rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm +RUN yum install -y centos-release-scl +RUN yum-config-manager --enable rhel-server-rhscl-7-rpms +RUN yum makecache && \ + yum install -y automake cmake3 curl-devel gcc gcc-c++ git libtool \ + make openssl-devel pkgconfig tar wget which zlib-devel +RUN ln -sf /usr/bin/cmake3 /usr/bin/cmake && ln -sf /usr/bin/ctest3 /usr/bin/ctest +# ``` + +# #### Protobuf + +# Likewise, manually install protobuf: + +# ```bash +WORKDIR /var/tmp/build +RUN wget -q https://github.com/google/protobuf/archive/v3.9.0.tar.gz +RUN tar -xf v3.9.0.tar.gz +WORKDIR /var/tmp/build/protobuf-3.9.0/cmake +RUN cmake \ + -DCMAKE_BUILD_TYPE=Release \ + -DBUILD_SHARED_LIBS=yes \ + -Dprotobuf_BUILD_TESTS=OFF \ + -H. -Bcmake-out +RUN cmake --build cmake-out --target install -- -j $(nproc) +RUN ldconfig +# ``` + +# #### c-ares + +# Recent versions of gRPC require c-ares >= 1.11, while CentOS-7 +# distributes c-ares-1.10. Manually install a newer version: + +# ```bash +WORKDIR /var/tmp/build +RUN wget -q https://github.com/c-ares/c-ares/archive/cares-1_15_0.tar.gz +RUN tar -xf cares-1_15_0.tar.gz +WORKDIR /var/tmp/build/c-ares-cares-1_15_0 +RUN ./buildconf && ./configure && make -j $(nproc) +RUN make install +RUN ldconfig +# ``` + +# #### gRPC + +# Can be manually installed using: + +# ```bash +WORKDIR /var/tmp/build +RUN wget -q https://github.com/grpc/grpc/archive/v1.22.0.tar.gz +RUN tar -xf v1.22.0.tar.gz +WORKDIR /var/tmp/build/grpc-1.22.0 +ENV PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/local/lib64/pkgconfig +ENV LD_LIBRARY_PATH=/usr/local/lib:/usr/local/lib64 +ENV PATH=/usr/local/bin:${PATH} +RUN make -j $(nproc) +RUN make install +RUN ldconfig +# ``` + +FROM devtools AS install + +# #### googleapis + +# Finally we can install `googleapis`. + +# ```bash +WORKDIR /home/build/cpp-cmakefiles +COPY . /home/build/cpp-cmakefiles +RUN cmake -H. -Bcmake-out +RUN cmake --build cmake-out -- -j $(nproc) +WORKDIR /home/build/cpp-cmakefiles/cmake-out +RUN cmake --build . --target install +# ``` + +## [END INSTALL.md] + +# Verify that the installed files are actually usable +RUN /home/build/cpp-cmakefiles/ci/test-install/compile-test-projects.sh diff --git a/third_party/cpp/googleapis/ci/kokoro/install/Dockerfile.fedora-30 b/third_party/cpp/googleapis/ci/kokoro/install/Dockerfile.fedora-30 new file mode 100644 index 000000000000..d6e57b91e232 --- /dev/null +++ b/third_party/cpp/googleapis/ci/kokoro/install/Dockerfile.fedora-30 @@ -0,0 +1,58 @@ +# Copyright 2019 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +FROM fedora:30 AS devtools + +# Please keep the formatting below, it is used by `extract-install.md` +# to generate the contents of the top-level INSTALL.md. + +## [START INSTALL.md] + +# Install the minimal development tools: + +# ```bash +RUN dnf makecache && \ + dnf install -y cmake gcc-c++ git make openssl-devel pkgconfig \ + zlib-devel +# ``` + +# Fedora includes packages for gRPC, libcurl, and OpenSSL that are recent enough +# for `cpp-cmakefiles`. Install these packages and additional development +# tools to compile the dependencies: + +# ```bash +RUN dnf makecache && \ + dnf install -y grpc-devel grpc-plugins \ + libcurl-devel protobuf-compiler tar wget zlib-devel +# ``` + +FROM devtools AS install + +# #### googleapis + +# We can now compile and install `googleapis`. + +# ```bash +WORKDIR /home/build/cpp-cmakefiles +COPY . /home/build/cpp-cmakefiles +RUN cmake -H. -Bcmake-out +RUN cmake --build cmake-out -- -j $(nproc) +WORKDIR /home/build/cpp-cmakefiles/cmake-out +RUN cmake --build . --target install +# ``` + +## [END INSTALL.md] + +# Verify that the installed files are actually usable +RUN /home/build/cpp-cmakefiles/ci/test-install/compile-test-projects.sh diff --git a/third_party/cpp/googleapis/ci/kokoro/install/Dockerfile.fedora-30-shared b/third_party/cpp/googleapis/ci/kokoro/install/Dockerfile.fedora-30-shared new file mode 100644 index 000000000000..572018f994dc --- /dev/null +++ b/third_party/cpp/googleapis/ci/kokoro/install/Dockerfile.fedora-30-shared @@ -0,0 +1,62 @@ +# Copyright 2019 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +FROM fedora:30 AS devtools + +# Please keep the formatting below, it is used by `extract-install.md` +# to generate the contents of the top-level INSTALL.md. + +## [START INSTALL.md] + +# Install the minimal development tools: + +# ```bash +RUN dnf makecache && \ + dnf install -y cmake gcc-c++ git make openssl-devel pkgconfig \ + zlib-devel +# ``` + +# Fedora includes packages for gRPC, libcurl, and OpenSSL that are recent enough +# for `cpp-cmakefiles`. Install these packages and additional development +# tools to compile the dependencies: + +# ```bash +RUN dnf makecache && \ + dnf install -y grpc-devel grpc-plugins \ + libcurl-devel protobuf-compiler tar wget zlib-devel +# ``` + +FROM devtools AS install + +# #### googleapis + +# We can now compile and install `googleapis` as shared library. + +# ```bash +WORKDIR /home/build/cpp-cmakefiles +COPY . /home/build/cpp-cmakefiles +RUN cmake -H. -Bcmake-out -DBUILD_SHARED_LIBS=yes +RUN cmake --build cmake-out -- -j $(nproc) +WORKDIR /home/build/cpp-cmakefiles/cmake-out +RUN cmake --build . --target install +# The share libraries will install in `/usr/local/lib64` we need that directory +# in the ld.so cache: +RUN echo "/usr/local/lib64" | tee /etc/ld.so.conf.d/local.conf +RUN ldconfig +# ``` + +## [END INSTALL.md] + +# Verify that the installed files are actually usable +RUN /home/build/cpp-cmakefiles/ci/test-install/compile-test-projects.sh diff --git a/third_party/cpp/googleapis/ci/kokoro/install/Dockerfile.opensuse-leap b/third_party/cpp/googleapis/ci/kokoro/install/Dockerfile.opensuse-leap new file mode 100644 index 000000000000..ea2dda5ec4e6 --- /dev/null +++ b/third_party/cpp/googleapis/ci/kokoro/install/Dockerfile.opensuse-leap @@ -0,0 +1,114 @@ +# Copyright 2019 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +FROM opensuse/leap:latest AS devtools + +## [START INSTALL.md] + +# Install the minimal development tools: + +# ```bash +RUN zypper refresh && \ + zypper install --allow-downgrade -y cmake gcc gcc-c++ git gzip \ + libcurl-devel libopenssl-devel make tar wget +# ``` + +# #### Protobuf + +# OpenSUSE Leap includes a package for protobuf-2.6, but this is too old to +# support the Google Cloud Platform proto files, or to support gRPC for that +# matter. Manually install protobuf: + +# ```bash +WORKDIR /var/tmp/build +RUN wget -q https://github.com/google/protobuf/archive/v3.9.0.tar.gz +RUN tar -xf v3.9.0.tar.gz +WORKDIR /var/tmp/build/protobuf-3.9.0/cmake +RUN cmake \ + -DCMAKE_BUILD_TYPE=Release \ + -DBUILD_SHARED_LIBS=yes \ + -Dprotobuf_BUILD_TESTS=OFF \ + -H. -Bcmake-out +RUN cmake --build cmake-out --target install -- -j $(nproc) +RUN ldconfig +# ``` + +# #### c-ares + +# Recent versions of gRPC require c-ares >= 1.11, while OpenSUSE Leap +# distributes c-ares-1.9. We need some additional development tools to compile +# this library: + +# ```bash +RUN zypper refresh && \ + zypper install -y automake libtool +# ``` + +# Manually install a newer version: + +# ```bash +WORKDIR /var/tmp/build +RUN wget -q https://github.com/c-ares/c-ares/archive/cares-1_15_0.tar.gz +RUN tar -xf cares-1_15_0.tar.gz +WORKDIR /var/tmp/build/c-ares-cares-1_15_0 +RUN ./buildconf && ./configure && make -j $(nproc) +RUN make install +RUN ldconfig +# ``` + +# #### gRPC + +# The gRPC Makefile uses `which` to determine whether the compiler is available. +# Install this command for the extremely rare case where it may be missing from +# your workstation or build server: + +# ```bash +RUN zypper refresh && \ + zypper install -y which +# ``` + +# Then gRPC can be manually installed using: + +# ```bash +WORKDIR /var/tmp/build +RUN wget -q https://github.com/grpc/grpc/archive/v1.22.0.tar.gz +RUN tar -xf v1.22.0.tar.gz +WORKDIR /var/tmp/build/grpc-1.22.0 +ENV PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/local/lib64/pkgconfig +ENV LD_LIBRARY_PATH=/usr/local/lib:/usr/local/lib64 +ENV PATH=/usr/local/bin:${PATH} +RUN make -j $(nproc) +RUN make install +RUN ldconfig +# ``` + +FROM devtools AS install + +# #### googleapis + +# We can now compile and install `googleapis`. + +# ```bash +WORKDIR /home/build/cpp-cmakefiles +COPY . /home/build/cpp-cmakefiles +RUN cmake -H. -Bcmake-out +RUN cmake --build cmake-out -- -j $(nproc) +WORKDIR /home/build/cpp-cmakefiles/cmake-out +RUN cmake --build . --target install +# ``` + +## [END INSTALL.md] + +# Verify that the installed files are actually usable +RUN /home/build/cpp-cmakefiles/ci/test-install/compile-test-projects.sh diff --git a/third_party/cpp/googleapis/ci/kokoro/install/Dockerfile.opensuse-tumbleweed b/third_party/cpp/googleapis/ci/kokoro/install/Dockerfile.opensuse-tumbleweed new file mode 100644 index 000000000000..9a87337870e3 --- /dev/null +++ b/third_party/cpp/googleapis/ci/kokoro/install/Dockerfile.opensuse-tumbleweed @@ -0,0 +1,54 @@ +# Copyright 2018 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +FROM opensuse/tumbleweed:latest AS devtools + +## [START INSTALL.md] + +# Install the minimal development tools: + +# ```bash +RUN zypper refresh && \ + zypper install --allow-downgrade -y cmake gcc gcc-c++ git gzip \ + libcurl-devel libopenssl-devel make tar wget zlib-devel +# ``` + +# OpenSUSE:tumbleweed provides packages for gRPC, libcurl, and protobuf, and the +# versions of these packages are recent enough to support the Google Cloud +# Platform proto files. + +# ```bash +RUN zypper refresh && \ + zypper install -y grpc-devel gzip libcurl-devel tar wget +# ``` + +FROM devtools AS install + +# #### googleapis + +# We can now compile and install `googleapis`. + +# ```bash +WORKDIR /home/build/cpp-cmakefiles +COPY . /home/build/cpp-cmakefiles +RUN cmake -H. -Bcmake-out +RUN cmake --build cmake-out -- -j $(nproc) +WORKDIR /home/build/cpp-cmakefiles/cmake-out +RUN cmake --build . --target install +# ``` + +## [END INSTALL.md] + +# Verify that the installed files are actually usable +RUN /home/build/cpp-cmakefiles/ci/test-install/compile-test-projects.sh diff --git a/third_party/cpp/googleapis/ci/kokoro/install/Dockerfile.ubuntu-16.04 b/third_party/cpp/googleapis/ci/kokoro/install/Dockerfile.ubuntu-16.04 new file mode 100644 index 000000000000..030ed4a2aa85 --- /dev/null +++ b/third_party/cpp/googleapis/ci/kokoro/install/Dockerfile.ubuntu-16.04 @@ -0,0 +1,100 @@ +# Copyright 2018 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +FROM ubuntu:16.04 AS devtools + +# Please keep the formatting in these commands, it is optimized to cut & paste +# into the README.md file. + +## [START INSTALL.md] + +# Install the minimal development tools: + +# ```bash +RUN apt update && \ + apt install -y automake build-essential cmake git gcc g++ cmake \ + libcurl4-openssl-dev libssl-dev libtool make pkg-config tar wget \ + zlib1g-dev +# ``` + +# #### c-ares + +# Recent versions of gRPC require c-ares >= 1.11, while Ubuntu-16.04 +# distributes c-ares-1.10. We can manually install a newer version +# of c-ares: + +# ```bash +WORKDIR /var/tmp/build +RUN wget -q https://github.com/c-ares/c-ares/archive/cares-1_15_0.tar.gz +RUN tar -xf cares-1_15_0.tar.gz +WORKDIR /var/tmp/build/c-ares-cares-1_15_0 +RUN ./buildconf && ./configure && make -j $(nproc) +RUN make install +RUN ldconfig +# ``` + +# #### Protobuf + +# While protobuf-3.0 is distributed with Ubuntu, the Google Cloud Plaform proto +# files require more recent versions (circa 3.4.x). To manually install a more +# recent version use: + +# ```bash +WORKDIR /var/tmp/build +RUN wget -q https://github.com/google/protobuf/archive/v3.9.0.tar.gz +RUN tar -xf v3.9.0.tar.gz +WORKDIR /var/tmp/build/protobuf-3.9.0/cmake +RUN cmake \ + -DCMAKE_BUILD_TYPE=Release \ + -DBUILD_SHARED_LIBS=yes \ + -Dprotobuf_BUILD_TESTS=OFF \ + -H. -Bcmake-out +RUN cmake --build cmake-out --target install -- -j $(nproc) +RUN ldconfig +# ``` + +# #### gRPC + +# Likewise, Ubuntu has packages for grpc-1.3.x, but this version is too old for +# the Google Cloud Platform APIs: + +# ```bash +WORKDIR /var/tmp/build +RUN wget -q https://github.com/grpc/grpc/archive/v1.22.0.tar.gz +RUN tar -xf v1.22.0.tar.gz +WORKDIR /var/tmp/build/grpc-1.22.0 +RUN make -j $(nproc) +RUN make install +RUN ldconfig +# ``` + +FROM devtools AS install + +# #### googleapis + +# Finally we can install `googleapis`. + +# ```bash +WORKDIR /home/build/cpp-cmakefiles +COPY . /home/build/cpp-cmakefiles +RUN cmake -H. -Bcmake-out +RUN cmake --build cmake-out -- -j $(nproc) +WORKDIR /home/build/cpp-cmakefiles/cmake-out +RUN cmake --build . --target install +# ``` + +## [END INSTALL.md] + +# Verify that the installed files are actually usable +RUN /home/build/cpp-cmakefiles/ci/test-install/compile-test-projects.sh diff --git a/third_party/cpp/googleapis/ci/kokoro/install/Dockerfile.ubuntu-18.04 b/third_party/cpp/googleapis/ci/kokoro/install/Dockerfile.ubuntu-18.04 new file mode 100644 index 000000000000..486d24aa47db --- /dev/null +++ b/third_party/cpp/googleapis/ci/kokoro/install/Dockerfile.ubuntu-18.04 @@ -0,0 +1,84 @@ +# Copyright 2018 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +FROM ubuntu:18.04 AS devtools + +# Please keep the formatting in these commands, it is optimized to cut & paste +# into the README.md file. + +## [START INSTALL.md] + +# Install the minimal development tools: + +# ```bash +RUN apt update && \ + apt install -y build-essential cmake git gcc g++ cmake \ + libc-ares-dev libc-ares2 libcurl4-openssl-dev libssl-dev make \ + pkg-config tar wget zlib1g-dev +# ``` + +# #### Protobuf + +# While protobuf-3.0 is distributed with Ubuntu, the Google Cloud Plaform proto +# files require more recent versions (circa 3.4.x). To manually install a more +# recent version use: + +# ```bash +WORKDIR /var/tmp/build +RUN wget -q https://github.com/google/protobuf/archive/v3.9.0.tar.gz +RUN tar -xf v3.9.0.tar.gz +WORKDIR /var/tmp/build/protobuf-3.9.0/cmake +RUN cmake \ + -DCMAKE_BUILD_TYPE=Release \ + -DBUILD_SHARED_LIBS=yes \ + -Dprotobuf_BUILD_TESTS=OFF \ + -H. -Bcmake-out +RUN cmake --build cmake-out --target install -- -j $(nproc) +RUN ldconfig +# ``` + +# #### gRPC + +# Likewise, Ubuntu has packages for grpc-1.3.x, but this version is too old for +# the Google Cloud Platform APIs: + +# ```bash +WORKDIR /var/tmp/build +RUN wget -q https://github.com/grpc/grpc/archive/v1.22.0.tar.gz +RUN tar -xf v1.22.0.tar.gz +WORKDIR /var/tmp/build/grpc-1.22.0 +RUN make -j $(nproc) +RUN make install +RUN ldconfig +# ``` + +FROM devtools AS install + +# #### googleapis + +# Finally we can install `googleapis`. + +# ```bash +WORKDIR /home/build/cpp-cmakefiles +COPY . /home/build/cpp-cmakefiles +RUN cmake -H. -Bcmake-out +RUN cmake --build cmake-out -- -j $(nproc) +WORKDIR /home/build/cpp-cmakefiles/cmake-out +RUN cmake --build . --target install +# ``` + +## [END INSTALL.md] + +# Verify that the installed files are actually usable +RUN /home/build/cpp-cmakefiles/ci/test-install/compile-test-projects.sh diff --git a/third_party/cpp/googleapis/ci/kokoro/install/build.sh b/third_party/cpp/googleapis/ci/kokoro/install/build.sh new file mode 100755 index 000000000000..42e85f39b6fc --- /dev/null +++ b/third_party/cpp/googleapis/ci/kokoro/install/build.sh @@ -0,0 +1,106 @@ +#!/usr/bin/env bash +# +# Copyright 2019 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +set -eu + +if [[ $# -eq 1 ]]; then + export TEST_TARGET="${1}" +elif [[ -n "${KOKORO_JOB_NAME:-}" ]]; then + # Kokoro injects the KOKORO_JOB_NAME environment variable, the value of this + # variable is cloud-cpp/spanner/<config-file-name-without-cfg> (or more + # generally <path/to/config-file-without-cfg>). By convention we name these + # files `$foo.cfg` for continuous builds and `$foo-presubmit.cfg` for + # presubmit builds. Here we extract the value of "foo" and use it as the build + # name. + TEST_TARGET="$(basename "${KOKORO_JOB_NAME}" "-presubmit")" + export TEST_TARGET +else + echo "Aborting build as the distribution name is not defined." + echo "If you are invoking this script via the command line use:" + echo " $0 <distro-name>" + echo + echo "If this script is invoked by Kokoro, the CI system is expected to set" + echo "the KOKORO_JOB_NAME environment variable." + exit 1 +fi + +echo "================================================================" +echo "Change working directory to project root $(date)." +cd "$(dirname "$0")/../../.." + +if [[ -z "${PROJECT_ID+x}" ]]; then + readonly PROJECT_ID="cloud-devrel-kokoro-resources" +fi + +readonly DEV_IMAGE="gcr.io/${PROJECT_ID}/cpp-cmakefiles/test-install-dev-${TEST_TARGET}" +readonly IMAGE="gcr.io/${PROJECT_ID}/cpp-cmakefiles/test-install-${TEST_TARGET}" + +has_cache="false" + +# We download the cached dev image for pull requests on kokoro. For continuous +# jobs, we don't download the cached image. This means we build from scratch and +# upload the image for future builds for pull requests. +if [[ -n "${KOKORO_JOB_NAME:-}" ]] \ + && [[ -n "${KOKORO_GITHUB_PULL_REQUEST_NUMBER:-}" ]]; then + echo "================================================================" + echo "Download existing image (if available) for ${TEST_TARGET} $(date)." + if docker pull "${DEV_IMAGE}:latest"; then + echo "Existing image successfully downloaded." + has_cache="true" + fi + echo "================================================================" +fi + +echo "================================================================" +echo "Build base image with minimal development tools for ${TEST_TARGET} $(date)." +update_cache="false" + +devtools_flags=( + # Only build up to the stage that installs the minimal development tools, but + # does not compile any of our code. + "--target" "devtools" + # Create the image with the same tag as the cache we are using, so we can + # upload it. + "-t" "${DEV_IMAGE}:latest" + "-f" "ci/kokoro/install/Dockerfile.${TEST_TARGET}" +) + +if "${has_cache}"; then + devtools_flags+=("--cache-from=${DEV_IMAGE}:latest") +fi + +echo "Running docker build with " "${devtools_flags[@]}" +if docker build "${devtools_flags[@]}" ci; then + update_cache="true" +fi + +# We upload the cached image for continuous builds. +if "${update_cache}" && [[ -z "${KOKORO_GITHUB_PULL_REQUEST_NUMBER:-}" ]] \ + && [[ -n "${KOKORO_JOB_NAME:-}" ]]; then + echo "================================================================" + echo "Uploading updated base image for ${TEST_TARGET} $(date)." + # Do not stop the build on a failure to update the cache. + docker push "${DEV_IMAGE}:latest" || true +fi + +echo "================================================================" +echo "Run validation script for INSTALL instructions on ${TEST_TARGET}." +docker build \ + "--cache-from=${DEV_IMAGE}:latest" \ + "--target=install" \ + -t "${IMAGE}" \ + -f "ci/kokoro/install/Dockerfile.${TEST_TARGET}" . +echo "================================================================" diff --git a/third_party/cpp/googleapis/ci/kokoro/install/centos-7-presubmit.cfg b/third_party/cpp/googleapis/ci/kokoro/install/centos-7-presubmit.cfg new file mode 100644 index 000000000000..e69de29bb2d1 --- /dev/null +++ b/third_party/cpp/googleapis/ci/kokoro/install/centos-7-presubmit.cfg diff --git a/third_party/cpp/googleapis/ci/kokoro/install/centos-7.cfg b/third_party/cpp/googleapis/ci/kokoro/install/centos-7.cfg new file mode 100644 index 000000000000..e69de29bb2d1 --- /dev/null +++ b/third_party/cpp/googleapis/ci/kokoro/install/centos-7.cfg diff --git a/third_party/cpp/googleapis/ci/kokoro/install/common.cfg b/third_party/cpp/googleapis/ci/kokoro/install/common.cfg new file mode 100644 index 000000000000..77a3a1f9fefe --- /dev/null +++ b/third_party/cpp/googleapis/ci/kokoro/install/common.cfg @@ -0,0 +1,17 @@ +# Format: //devtools/kokoro/config/proto/build.proto +# Copyright 2019 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +build_file: "cpp-cmakefiles/ci/kokoro/install/build.sh" +timeout_mins: 120 diff --git a/third_party/cpp/googleapis/ci/kokoro/install/fedora-30-presubmit.cfg b/third_party/cpp/googleapis/ci/kokoro/install/fedora-30-presubmit.cfg new file mode 100644 index 000000000000..e69de29bb2d1 --- /dev/null +++ b/third_party/cpp/googleapis/ci/kokoro/install/fedora-30-presubmit.cfg diff --git a/third_party/cpp/googleapis/ci/kokoro/install/fedora-30-shared-presubmit.cfg b/third_party/cpp/googleapis/ci/kokoro/install/fedora-30-shared-presubmit.cfg new file mode 100644 index 000000000000..e69de29bb2d1 --- /dev/null +++ b/third_party/cpp/googleapis/ci/kokoro/install/fedora-30-shared-presubmit.cfg diff --git a/third_party/cpp/googleapis/ci/kokoro/install/fedora-30-shared.cfg b/third_party/cpp/googleapis/ci/kokoro/install/fedora-30-shared.cfg new file mode 100644 index 000000000000..e69de29bb2d1 --- /dev/null +++ b/third_party/cpp/googleapis/ci/kokoro/install/fedora-30-shared.cfg diff --git a/third_party/cpp/googleapis/ci/kokoro/install/fedora-30.cfg b/third_party/cpp/googleapis/ci/kokoro/install/fedora-30.cfg new file mode 100644 index 000000000000..e69de29bb2d1 --- /dev/null +++ b/third_party/cpp/googleapis/ci/kokoro/install/fedora-30.cfg diff --git a/third_party/cpp/googleapis/ci/kokoro/install/opensuse-leap-presubmit.cfg b/third_party/cpp/googleapis/ci/kokoro/install/opensuse-leap-presubmit.cfg new file mode 100644 index 000000000000..e69de29bb2d1 --- /dev/null +++ b/third_party/cpp/googleapis/ci/kokoro/install/opensuse-leap-presubmit.cfg diff --git a/third_party/cpp/googleapis/ci/kokoro/install/opensuse-leap.cfg b/third_party/cpp/googleapis/ci/kokoro/install/opensuse-leap.cfg new file mode 100644 index 000000000000..e69de29bb2d1 --- /dev/null +++ b/third_party/cpp/googleapis/ci/kokoro/install/opensuse-leap.cfg diff --git a/third_party/cpp/googleapis/ci/kokoro/install/opensuse-tumbleweed-presubmit.cfg b/third_party/cpp/googleapis/ci/kokoro/install/opensuse-tumbleweed-presubmit.cfg new file mode 100644 index 000000000000..e69de29bb2d1 --- /dev/null +++ b/third_party/cpp/googleapis/ci/kokoro/install/opensuse-tumbleweed-presubmit.cfg diff --git a/third_party/cpp/googleapis/ci/kokoro/install/opensuse-tumbleweed.cfg b/third_party/cpp/googleapis/ci/kokoro/install/opensuse-tumbleweed.cfg new file mode 100644 index 000000000000..e69de29bb2d1 --- /dev/null +++ b/third_party/cpp/googleapis/ci/kokoro/install/opensuse-tumbleweed.cfg diff --git a/third_party/cpp/googleapis/ci/kokoro/install/ubuntu-16.04-presubmit.cfg b/third_party/cpp/googleapis/ci/kokoro/install/ubuntu-16.04-presubmit.cfg new file mode 100644 index 000000000000..e69de29bb2d1 --- /dev/null +++ b/third_party/cpp/googleapis/ci/kokoro/install/ubuntu-16.04-presubmit.cfg diff --git a/third_party/cpp/googleapis/ci/kokoro/install/ubuntu-16.04.cfg b/third_party/cpp/googleapis/ci/kokoro/install/ubuntu-16.04.cfg new file mode 100644 index 000000000000..e69de29bb2d1 --- /dev/null +++ b/third_party/cpp/googleapis/ci/kokoro/install/ubuntu-16.04.cfg diff --git a/third_party/cpp/googleapis/ci/kokoro/install/ubuntu-18.04-presubmit.cfg b/third_party/cpp/googleapis/ci/kokoro/install/ubuntu-18.04-presubmit.cfg new file mode 100644 index 000000000000..e69de29bb2d1 --- /dev/null +++ b/third_party/cpp/googleapis/ci/kokoro/install/ubuntu-18.04-presubmit.cfg diff --git a/third_party/cpp/googleapis/ci/kokoro/install/ubuntu-18.04.cfg b/third_party/cpp/googleapis/ci/kokoro/install/ubuntu-18.04.cfg new file mode 100644 index 000000000000..e69de29bb2d1 --- /dev/null +++ b/third_party/cpp/googleapis/ci/kokoro/install/ubuntu-18.04.cfg |