pull build scripts from google-cloud-ruby (#206)
This commit is contained in:
parent
bf822910fa
commit
43ebe19be9
|
@ -1,41 +1,4 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# This file runs tests for merges, PRs, and nightlies.
|
script_url="https://raw.githubusercontent.com/googleapis/google-cloud-ruby/master/.kokoro/build.sh"
|
||||||
# There are a few rules for what tests are run:
|
curl -o master-build.sh $script_url && source master-build.sh
|
||||||
# * 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-auth-library-ruby/
|
|
||||||
|
|
||||||
versions=($RUBY_VERSIONS)
|
|
||||||
|
|
||||||
# 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
|
|
||||||
}
|
|
||||||
|
|
||||||
if [ "$JOB_TYPE" = "release" ]; then
|
|
||||||
git fetch --depth=10000
|
|
||||||
python3 -m pip install gcp-releasetool
|
|
||||||
python3 -m releasetool publish-reporter-script > /tmp/publisher-script; source /tmp/publisher-script
|
|
||||||
(bundle update && bundle exec rake kokoro:release) || set_failed_status
|
|
||||||
else
|
|
||||||
for version in "${versions[@]}"; do
|
|
||||||
rbenv global "$version"
|
|
||||||
echo "Using Ruby $version"
|
|
||||||
(bundle update && bundle exec rake) || set_failed_status
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
|
|
||||||
exit $EXIT_STATUS
|
|
||||||
|
|
|
@ -1,22 +0,0 @@
|
||||||
# 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-auth-library-ruby/.kokoro/trampoline.sh"
|
|
||||||
|
|
||||||
# Download secrets from Cloud Storage.
|
|
||||||
gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/google-auth-library-ruby"
|
|
||||||
|
|
||||||
# Tell the trampoline which build file to use.
|
|
||||||
env_vars: {
|
|
||||||
key: "TRAMPOLINE_BUILD_FILE"
|
|
||||||
value: "github/google-auth-library-ruby/.kokoro/build.sh"
|
|
||||||
}
|
|
||||||
|
|
||||||
action {
|
|
||||||
define_artifacts {
|
|
||||||
regex: "**/*sponge_log.xml"
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -17,3 +17,8 @@ env_vars: {
|
||||||
key: "JOB_TYPE"
|
key: "JOB_TYPE"
|
||||||
value: "continuous"
|
value: "continuous"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
env_vars: {
|
||||||
|
key: "REPO_DIR"
|
||||||
|
value: "github/google-auth-library-ruby"
|
||||||
|
}
|
||||||
|
|
|
@ -1,35 +1,4 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# This file runs tests for merges, PRs, and nightlies.
|
script_url="https://raw.githubusercontent.com/googleapis/google-cloud-ruby/master/.kokoro/osx.sh"
|
||||||
# There are a few rules for what tests are run:
|
curl -o master-osx.sh $script_url && source master-osx.sh
|
||||||
# * 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-auth-library-ruby/
|
|
||||||
|
|
||||||
# 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 bundler --version 1.17.3
|
|
||||||
|
|
||||||
|
|
||||||
(bundle update && bundle exec rake) || set_failed_status
|
|
||||||
|
|
||||||
exit $EXIT_STATUS
|
|
||||||
|
|
|
@ -17,3 +17,8 @@ env_vars: {
|
||||||
key: "JOB_TYPE"
|
key: "JOB_TYPE"
|
||||||
value: "presubmit"
|
value: "presubmit"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
env_vars: {
|
||||||
|
key: "REPO_DIR"
|
||||||
|
value: "github/google-auth-library-ruby"
|
||||||
|
}
|
||||||
|
|
|
@ -46,3 +46,8 @@ env_vars: {
|
||||||
key: "OS"
|
key: "OS"
|
||||||
value: "linux"
|
value: "linux"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
env_vars: {
|
||||||
|
key: "REPO_DIR"
|
||||||
|
value: "github/google-auth-library-ruby"
|
||||||
|
}
|
||||||
|
|
|
@ -1,24 +1,4 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# Copyright 2017 Google Inc.
|
|
||||||
#
|
script_url="https://raw.githubusercontent.com/googleapis/google-cloud-ruby/master/.kokoro/trampoline.sh"
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
curl -o master-trampoline.sh $script_url && source master-trampoline.sh
|
||||||
# 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"
|
|
||||||
|
|
|
@ -1,32 +1,4 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# This file runs tests for merges, PRs, and nightlies.
|
script_url="https://raw.githubusercontent.com/googleapis/google-cloud-ruby/master/.kokoro/windows.sh"
|
||||||
# There are a few rules for what tests are run:
|
curl -o master-windows.sh $script_url && source master-windows.sh
|
||||||
# * 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-auth-library-ruby/
|
|
||||||
|
|
||||||
# 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
|
|
||||||
|
|
31
Rakefile
31
Rakefile
|
@ -1,24 +1,17 @@
|
||||||
# -*- ruby -*-
|
# -*- ruby -*-
|
||||||
require "rspec/core/rake_task"
|
|
||||||
require "rubocop/rake_task"
|
|
||||||
require "bundler/gem_tasks"
|
require "bundler/gem_tasks"
|
||||||
|
|
||||||
desc "Run Rubocop to check for style violations"
|
task :ci do
|
||||||
RuboCop::RakeTask.new
|
header "Using Ruby - #{RUBY_VERSION}"
|
||||||
|
sh "bundle exec rubocop"
|
||||||
desc "Run rake task"
|
sh "bundle exec rspec"
|
||||||
RSpec::Core::RakeTask.new :spec
|
end
|
||||||
|
|
||||||
desc "Does rubocop lint and runs the specs"
|
|
||||||
task all: %i[rubocop spec]
|
|
||||||
|
|
||||||
task default: :all
|
|
||||||
|
|
||||||
task :release, :tag do |_t, args|
|
task :release, :tag do |_t, args|
|
||||||
tag = args[:tag]
|
tag = args[:tag]
|
||||||
raise "You must provide a tag to release." if tag.nil?
|
raise "You must provide a tag to release." if tag.nil?
|
||||||
|
|
||||||
# Verify the tag format "PACKAGE/vVERSION"
|
# Verify the tag format "vVERSION"
|
||||||
m = tag.match(/v(?<version>\S*)/)
|
m = tag.match(/v(?<version>\S*)/)
|
||||||
raise "Tag #{tag} does not match the expected format." if m.nil?
|
raise "Tag #{tag} does not match the expected format." if m.nil?
|
||||||
|
|
||||||
|
@ -62,6 +55,18 @@ namespace :kokoro do
|
||||||
env_vars.each { |k, v| ENV[k] = v }
|
env_vars.each { |k, v| ENV[k] = v }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
task :presubmit do
|
||||||
|
Rake::Task["ci"].invoke
|
||||||
|
end
|
||||||
|
|
||||||
|
task :continuous do
|
||||||
|
Rake::Task["ci"].invoke
|
||||||
|
end
|
||||||
|
|
||||||
|
task :nightly do
|
||||||
|
Rake::Task["ci"].invoke
|
||||||
|
end
|
||||||
|
|
||||||
task :release do
|
task :release do
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
Bundler.with_clean_env do
|
Bundler.with_clean_env do
|
||||||
|
|
Loading…
Reference in New Issue