From b991726225985daf72b787c039dacbf924865ff8 Mon Sep 17 00:00:00 2001 From: Tianzi Cai Date: Fri, 10 Apr 2020 09:54:32 -0700 Subject: [PATCH 1/2] docs: update libraries-bom --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ca3d245d7..77d0d1786 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ If you are using Maven with a BOM, add this to your pom.xml file: com.google.cloud libraries-bom - 2.9.0 + 4.4.1 pom import From 8fc80800ef9f59d3007178987aa5baedc43d1567 Mon Sep 17 00:00:00 2001 From: Tianzi Cai Date: Tue, 19 May 2020 13:03:44 -0700 Subject: [PATCH 2/2] set up samples testing --- .kokoro/continuous/java11-samples.cfg | 30 ++++++++++++++++ .kokoro/continuous/jave8-samples.cfg | 31 ++++++++++++++++ .kokoro/nightly/java11-samples.cfg | 30 ++++++++++++++++ .kokoro/nightly/jave8-samples.cfg | 31 ++++++++++++++++ .kokoro/presubmit/java11-samples.cfg | 30 ++++++++++++++++ .kokoro/presubmit/jave8-samples.cfg | 31 ++++++++++++++++ .kokoro/run_samples_tests.sh | 51 +++++++++++++++++++++++++++ pom.xml | 10 ++++++ 8 files changed, 244 insertions(+) create mode 100644 .kokoro/continuous/java11-samples.cfg create mode 100644 .kokoro/continuous/jave8-samples.cfg create mode 100644 .kokoro/nightly/java11-samples.cfg create mode 100644 .kokoro/nightly/jave8-samples.cfg create mode 100644 .kokoro/presubmit/java11-samples.cfg create mode 100644 .kokoro/presubmit/jave8-samples.cfg create mode 100644 .kokoro/run_samples_tests.sh diff --git a/.kokoro/continuous/java11-samples.cfg b/.kokoro/continuous/java11-samples.cfg new file mode 100644 index 000000000..b43371933 --- /dev/null +++ b/.kokoro/continuous/java11-samples.cfg @@ -0,0 +1,30 @@ +# Copyright 2020 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. + +# Format: //devtools/kokoro/config/proto/build.proto + +# Download secrets from Cloud Storage. +gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/java-docs-samples" + +# Configure the docker image for kokoro-trampoline. +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/java11" +} + +# Tell trampoline which tests to run. +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/java-pubsub/.kokoro/run_samples_tests.sh" +} \ No newline at end of file diff --git a/.kokoro/continuous/jave8-samples.cfg b/.kokoro/continuous/jave8-samples.cfg new file mode 100644 index 000000000..d4f3e8869 --- /dev/null +++ b/.kokoro/continuous/jave8-samples.cfg @@ -0,0 +1,31 @@ +# Copyright 2020 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. + +# Format: //devtools/kokoro/config/proto/build.proto + +# Download secrets from Cloud Storage. +gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/java-docs-samples" + +# Configure the docker image for kokoro-trampoline. +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/java8" +} + +# Tell trampoline which tests to run. +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/java-pubsub/.kokoro/run_samples_tests.sh" +} +© 2020 GitHub, Inc. \ No newline at end of file diff --git a/.kokoro/nightly/java11-samples.cfg b/.kokoro/nightly/java11-samples.cfg new file mode 100644 index 000000000..b43371933 --- /dev/null +++ b/.kokoro/nightly/java11-samples.cfg @@ -0,0 +1,30 @@ +# Copyright 2020 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. + +# Format: //devtools/kokoro/config/proto/build.proto + +# Download secrets from Cloud Storage. +gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/java-docs-samples" + +# Configure the docker image for kokoro-trampoline. +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/java11" +} + +# Tell trampoline which tests to run. +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/java-pubsub/.kokoro/run_samples_tests.sh" +} \ No newline at end of file diff --git a/.kokoro/nightly/jave8-samples.cfg b/.kokoro/nightly/jave8-samples.cfg new file mode 100644 index 000000000..d4f3e8869 --- /dev/null +++ b/.kokoro/nightly/jave8-samples.cfg @@ -0,0 +1,31 @@ +# Copyright 2020 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. + +# Format: //devtools/kokoro/config/proto/build.proto + +# Download secrets from Cloud Storage. +gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/java-docs-samples" + +# Configure the docker image for kokoro-trampoline. +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/java8" +} + +# Tell trampoline which tests to run. +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/java-pubsub/.kokoro/run_samples_tests.sh" +} +© 2020 GitHub, Inc. \ No newline at end of file diff --git a/.kokoro/presubmit/java11-samples.cfg b/.kokoro/presubmit/java11-samples.cfg new file mode 100644 index 000000000..b43371933 --- /dev/null +++ b/.kokoro/presubmit/java11-samples.cfg @@ -0,0 +1,30 @@ +# Copyright 2020 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. + +# Format: //devtools/kokoro/config/proto/build.proto + +# Download secrets from Cloud Storage. +gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/java-docs-samples" + +# Configure the docker image for kokoro-trampoline. +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/java11" +} + +# Tell trampoline which tests to run. +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/java-pubsub/.kokoro/run_samples_tests.sh" +} \ No newline at end of file diff --git a/.kokoro/presubmit/jave8-samples.cfg b/.kokoro/presubmit/jave8-samples.cfg new file mode 100644 index 000000000..d4f3e8869 --- /dev/null +++ b/.kokoro/presubmit/jave8-samples.cfg @@ -0,0 +1,31 @@ +# Copyright 2020 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. + +# Format: //devtools/kokoro/config/proto/build.proto + +# Download secrets from Cloud Storage. +gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/java-docs-samples" + +# Configure the docker image for kokoro-trampoline. +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/java8" +} + +# Tell trampoline which tests to run. +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/java-pubsub/.kokoro/run_samples_tests.sh" +} +© 2020 GitHub, Inc. \ No newline at end of file diff --git a/.kokoro/run_samples_tests.sh b/.kokoro/run_samples_tests.sh new file mode 100644 index 000000000..23f89f072 --- /dev/null +++ b/.kokoro/run_samples_tests.sh @@ -0,0 +1,51 @@ +#!/bin/bash +# Copyright 2020 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. + +# `-e` enables the script to automatically fail when a command fails +# `-o pipefail` sets the exit code to the rightmost comment to exit with a non-zero +set -eo pipefail + +echo "********** MAVEN INFO ***********" +mvn -v + +# Get the directory of the build script +scriptDir=$(realpath $(dirname "${BASH_SOURCE[0]}")) +## cd to the parent directory, i.e. the root of the git repo +cd ${scriptDir}/.. + +# include common functions +source ${scriptDir}/common.sh + +# Attempt to install 3 times with exponential backoff (starting with 10 seconds) +retry_with_backoff 3 10 \ + mvn install -B -V \ + -DskipTests=true \ + -Dclirr.skip=true \ + -Denforcer.skip=true \ + -Dmaven.javadoc.skip=true \ + -Dgcloud.download.skip=true \ + -T 1C + +# Activate service account +gcloud auth activate-service-account \ + --key-file="$GOOGLE_APPLICATION_CREDENTIALS" \ + --project="$GOOGLE_CLOUD_PROJECT" + +# Move into the samples directory +cd samples/ + +echo -e "\n******************** RUNNING SAMPLE TESTS ********************" + +mvn --fail-at-end clean verify \ No newline at end of file diff --git a/pom.xml b/pom.xml index f7e8dcb8f..6e6217001 100644 --- a/pom.xml +++ b/pom.xml @@ -234,6 +234,16 @@ google-cloud-pubsub-bom + + + + enable-samples + + samples + + + +