From 4c90d65403fba78181d8670704308ef26011d3bc Mon Sep 17 00:00:00 2001 From: Graham Paye Date: Thu, 8 Nov 2018 11:00:19 -0800 Subject: [PATCH] add kokoro configs (#735) --- .kokoro/build.bat | 8 ++++++++ .kokoro/build.sh | 36 ++++++++++++++++++++++++++++++++++ .kokoro/common.cfg | 22 +++++++++++++++++++++ .kokoro/continuous/common.cfg | 20 +++++++++++++++++++ .kokoro/continuous/linux.cfg | 15 ++++++++++++++ .kokoro/continuous/osx.cfg | 3 +++ .kokoro/continuous/windows.cfg | 3 +++ .kokoro/osx.sh | 35 +++++++++++++++++++++++++++++++++ .kokoro/presubmit/common.cfg | 19 ++++++++++++++++++ .kokoro/presubmit/linux.cfg | 14 +++++++++++++ .kokoro/presubmit/osx.cfg | 3 +++ .kokoro/presubmit/windows.cfg | 3 +++ .kokoro/trampoline.sh | 24 +++++++++++++++++++++++ .kokoro/windows.sh | 32 ++++++++++++++++++++++++++++++ 14 files changed, 237 insertions(+) create mode 100644 .kokoro/build.bat create mode 100755 .kokoro/build.sh create mode 100644 .kokoro/common.cfg create mode 100644 .kokoro/continuous/common.cfg create mode 100644 .kokoro/continuous/linux.cfg create mode 100644 .kokoro/continuous/osx.cfg create mode 100644 .kokoro/continuous/windows.cfg create mode 100644 .kokoro/osx.sh create mode 100644 .kokoro/presubmit/common.cfg create mode 100644 .kokoro/presubmit/linux.cfg create mode 100644 .kokoro/presubmit/osx.cfg create mode 100644 .kokoro/presubmit/windows.cfg create mode 100644 .kokoro/trampoline.sh create mode 100644 .kokoro/windows.sh diff --git a/.kokoro/build.bat b/.kokoro/build.bat new file mode 100644 index 000000000..d51c702cb --- /dev/null +++ b/.kokoro/build.bat @@ -0,0 +1,8 @@ +REM This file runs tests for merges, PRs, and nightlies. +REM There are a few rules for what tests are run: +REM * PRs run all non-acceptance tests for every library. +REM * Merges run all non-acceptance tests for every library, and acceptance tests for all altered libraries. +REM * Nightlies run all acceptance tests for every library. +REM Currently only runs tests on 2.5.1 + +"C:\Program Files\Git\bin\bash.exe" github/google-api-ruby-client/.kokoro/windows.sh diff --git a/.kokoro/build.sh b/.kokoro/build.sh new file mode 100755 index 000000000..640b167be --- /dev/null +++ b/.kokoro/build.sh @@ -0,0 +1,36 @@ +#!/bin/bash + +# This file runs tests for merges, PRs, and nightlies. +# There are a few rules for what tests are run: +# * PRs run all non-acceptance tests for every library. +# * Merges run all non-acceptance tests for every library, and acceptance tests for all altered libraries. +# * Nightlies run all acceptance tests for every library. + +set -eo pipefail + +# Debug: show build environment +env | grep KOKORO + +cd github/google-api-ruby-client/ + +# Print out Ruby version +ruby --version + +# Temporary workaround for a known bundler+docker issue: +# https://github.com/bundler/bundler/issues/6154 +export BUNDLE_GEMFILE= + +RUBY_VERSIONS=("2.3.8" "2.4.5" "2.5.3") + +# Capture failures +EXIT_STATUS=0 # everything passed +function set_failed_status { + EXIT_STATUS=1 +} + +for version in "${RUBY_VERSIONS[@]}"; do + rbenv global "$version" + (bundle update && bundle exec rake) || set_failed_status +done + +exit $EXIT_STATUS \ No newline at end of file diff --git a/.kokoro/common.cfg b/.kokoro/common.cfg new file mode 100644 index 000000000..b6ca6d114 --- /dev/null +++ b/.kokoro/common.cfg @@ -0,0 +1,22 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Download trampoline resources. These will be in ${KOKORO_GFILE_DIR} +gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" + +# All builds use the trampoline script to run in docker. +build_file: "google-api-ruby-client/.kokoro/trampoline.sh" + +# Download secrets from Cloud Storage. +gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/google-api-ruby-client" + +# Tell the trampoline which build file to use. +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/google-api-ruby-client/.kokoro/build.sh" +} + +action { + define_artifacts { + regex: "**/*sponge_log.xml" + } +} \ No newline at end of file diff --git a/.kokoro/continuous/common.cfg b/.kokoro/continuous/common.cfg new file mode 100644 index 000000000..865ec6db6 --- /dev/null +++ b/.kokoro/continuous/common.cfg @@ -0,0 +1,20 @@ + +# Format: //devtools/kokoro/config/proto/build.proto + +# Build logs will be here +action { + define_artifacts { + regex: "**/*sponge_log.xml" + } +} + +# Download trampoline resources. +gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" + +# Download resources for system tests (service account key, etc.) +gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/google-cloud-ruby" + +env_vars: { + key: "JOB_TYPE" + value: "continuous" +} \ No newline at end of file diff --git a/.kokoro/continuous/linux.cfg b/.kokoro/continuous/linux.cfg new file mode 100644 index 000000000..28b9802a3 --- /dev/null +++ b/.kokoro/continuous/linux.cfg @@ -0,0 +1,15 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +build_file: "google-api-ruby-client/.kokoro/trampoline.sh" + +# Configure the docker image for kokoro-trampoline. +# Dockerfile is maintained at https://github.com/googleapis/google-cloud-ruby/tree/master/.kokoro/docker/ruby-multi +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/google-cloud-ruby/ruby-multi-ubuntu" +} + +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/google-api-ruby-client/.kokoro/build.sh" +} \ No newline at end of file diff --git a/.kokoro/continuous/osx.cfg b/.kokoro/continuous/osx.cfg new file mode 100644 index 000000000..4288dccff --- /dev/null +++ b/.kokoro/continuous/osx.cfg @@ -0,0 +1,3 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +build_file: "google-api-ruby-client/.kokoro/osx.sh" \ No newline at end of file diff --git a/.kokoro/continuous/windows.cfg b/.kokoro/continuous/windows.cfg new file mode 100644 index 000000000..53d85495b --- /dev/null +++ b/.kokoro/continuous/windows.cfg @@ -0,0 +1,3 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +build_file: "google-api-ruby-client/.kokoro/build.bat" \ No newline at end of file diff --git a/.kokoro/osx.sh b/.kokoro/osx.sh new file mode 100644 index 000000000..1c2f8d246 --- /dev/null +++ b/.kokoro/osx.sh @@ -0,0 +1,35 @@ +#!/bin/bash + +# This file runs tests for merges, PRs, and nightlies. +# There are a few rules for what tests are run: +# * PRs run all non-acceptance tests for every library. +# * Merges run all non-acceptance tests for every library, and acceptance tests for all altered libraries. +# * Nightlies run all acceptance tests for every library. +# * Currently only runs tests on 2.5.0 + +set -eo pipefail + +# Debug: show build environment +env | grep KOKORO + +cd github/google-api-ruby-client/ + +# Print out Ruby version +ruby --version + +# Temporary workaround for a known bundler+docker issue: +# https://github.com/bundler/bundler/issues/6154 +export BUNDLE_GEMFILE= + +# Capture failures +EXIT_STATUS=0 # everything passed +function set_failed_status { + EXIT_STATUS=1 +} + +gem install bundle + + +(bundle update && bundle exec rake) || set_failed_status + +exit $EXIT_STATUS \ No newline at end of file diff --git a/.kokoro/presubmit/common.cfg b/.kokoro/presubmit/common.cfg new file mode 100644 index 000000000..d38b1e72b --- /dev/null +++ b/.kokoro/presubmit/common.cfg @@ -0,0 +1,19 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Build logs will be here +action { + define_artifacts { + regex: "**/*sponge_log.xml" + } +} + +# Download trampoline resources. +gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" + +# Download resources for system tests (service account key, etc.) +gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/google-cloud-ruby" + +env_vars: { + key: "JOB_TYPE" + value: "presubmit" +} \ No newline at end of file diff --git a/.kokoro/presubmit/linux.cfg b/.kokoro/presubmit/linux.cfg new file mode 100644 index 000000000..c6e8fbd91 --- /dev/null +++ b/.kokoro/presubmit/linux.cfg @@ -0,0 +1,14 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +build_file: "google-api-ruby-client/.kokoro/trampoline.sh" + +# Configure the docker image for kokoro-trampoline. +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/google-cloud-ruby/ruby-multi-ubuntu" +} + +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/google-api-ruby-client/.kokoro/build.sh" +} \ No newline at end of file diff --git a/.kokoro/presubmit/osx.cfg b/.kokoro/presubmit/osx.cfg new file mode 100644 index 000000000..4288dccff --- /dev/null +++ b/.kokoro/presubmit/osx.cfg @@ -0,0 +1,3 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +build_file: "google-api-ruby-client/.kokoro/osx.sh" \ No newline at end of file diff --git a/.kokoro/presubmit/windows.cfg b/.kokoro/presubmit/windows.cfg new file mode 100644 index 000000000..53d85495b --- /dev/null +++ b/.kokoro/presubmit/windows.cfg @@ -0,0 +1,3 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +build_file: "google-api-ruby-client/.kokoro/build.bat" \ No newline at end of file diff --git a/.kokoro/trampoline.sh b/.kokoro/trampoline.sh new file mode 100644 index 000000000..75fdbf984 --- /dev/null +++ b/.kokoro/trampoline.sh @@ -0,0 +1,24 @@ +#!/bin/bash +# Copyright 2017 Google Inc. +# +# 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 -eo pipefail +# Always run the cleanup script, regardless of the success of bouncing into +# the container. +function cleanup() { + chmod +x ${KOKORO_GFILE_DIR}/trampoline_cleanup.sh + ${KOKORO_GFILE_DIR}/trampoline_cleanup.sh + echo "cleanup"; +} +trap cleanup EXIT +python3 "${KOKORO_GFILE_DIR}/trampoline_v1.py" \ No newline at end of file diff --git a/.kokoro/windows.sh b/.kokoro/windows.sh new file mode 100644 index 000000000..9dec41f5c --- /dev/null +++ b/.kokoro/windows.sh @@ -0,0 +1,32 @@ +#!/bin/bash + +# This file runs tests for merges, PRs, and nightlies. +# There are a few rules for what tests are run: +# * PRs run all non-acceptance tests for every library. +# * Merges run all non-acceptance tests for every library, and acceptance tests for all altered libraries. +# * Nightlies run all acceptance tests for every library. +# * Currently only runs tests on 2.5.1 + +set -eo pipefail + +# Debug: show build environment +env | grep KOKORO + +cd github/google-api-ruby-client/ + +# Print out Ruby version +ruby --version + +# Temporary workaround for a known bundler+docker issue: +# https://github.com/bundler/bundler/issues/6154 +export BUNDLE_GEMFILE= + +# Capture failures +EXIT_STATUS=0 # everything passed +function set_failed_status { + EXIT_STATUS=1 +} + +(bundle update && bundle exec rake) || set_failed_status + +exit $EXIT_STATUS \ No newline at end of file