Skip to content

Commit 586f920

Browse files
feat: add support for streaming automl action recognition in v1p3beta1; make 'features' a positional param for annotate_video in betas (googleapis#31)
* Integrate Python GAPIC Microgenerator in googleapis. This PR uses using documentai as an example. Depends on googleapis/gapic-generator-python#402 PiperOrigin-RevId: 309824146 Source-Author: Google APIs <[email protected]> Source-Date: Mon May 4 15:06:44 2020 -0700 Source-Repo: googleapis/googleapis Source-Sha: e0f9d9e1f9de890db765be46f45ca8490723e3eb Source-Link: googleapis/googleapis@e0f9d9e * chore(python): create thread_safety doc (#517) This will be included in index.rst files. See https://github.com/googleapis/python-bigtable/pull/26/files Source-Author: Bu Sun Kim <[email protected]> Source-Date: Tue May 5 10:06:52 2020 -0700 Source-Repo: googleapis/synthtool Source-Sha: 09c48461232ce929c34386259eb59018ad2d8eef Source-Link: googleapis/synthtool@09c4846 * chore(python): remove extra #!/bin/bash (#538) Co-authored-by: Jeffrey Rennie <[email protected]> Source-Author: Bu Sun Kim <[email protected]> Source-Date: Tue May 12 09:51:12 2020 -0700 Source-Repo: googleapis/synthtool Source-Sha: 7482e79a82e353248769d819788adc1213e8c207 Source-Link: googleapis/synthtool@7482e79 * chore!: enable gapicv2 for monitoring/v3 API This introduces the following breakages upon code regeneration, which are due to the `TimeSeriesQueryLanguageCondition` type being removed from `alert.proto` in a preceding change. ``` [ERROR] 6011: com.google.monitoring.v3.AlertPolicy$Condition: Field CONDITION_TIME_SERIES_QUERY_LANGUAGE_FIELD_NUMBER has been removed, but it was previously a constant [ERROR] 7002: com.google.monitoring.v3.AlertPolicy$Condition: Method 'public com.google.monitoring.v3.AlertPolicy$Condition$TimeSeriesQueryLanguageCondition getConditionTimeSeriesQueryLanguage()' has been removed [ERROR] 7002: com.google.monitoring.v3.AlertPolicy$Condition: Method 'public com.google.monitoring.v3.AlertPolicy$Condition$TimeSeriesQueryLanguageConditionOrBuilder getConditionTimeSeriesQueryLanguageOrBuilder()' has been removed [ERROR] 7002: com.google.monitoring.v3.AlertPolicy$Condition: Method 'public boolean hasConditionTimeSeriesQueryLanguage()' has been removed [ERROR] 7002: com.google.monitoring.v3.AlertPolicy$Condition$Builder: Method 'public com.google.monitoring.v3.AlertPolicy$Condition$Builder clearConditionTimeSeriesQueryLanguage()' has been removed [ERROR] 7002: com.google.monitoring.v3.AlertPolicy$Condition$Builder: Method 'public com.google.monitoring.v3.AlertPolicy$Condition$TimeSeriesQueryLanguageCondition getConditionTimeSeriesQueryLanguage()' has been removed [ERROR] 7002: com.google.monitoring.v3.AlertPolicy$Condition$Builder: Method 'public com.google.monitoring.v3.AlertPolicy$Condition$TimeSeriesQueryLanguageCondition$Builder getConditionTimeSeriesQueryLanguageBuilder()' has been removed [ERROR] 7002: com.google.monitoring.v3.AlertPolicy$Condition$Builder: Method 'public com.google.monitoring.v3.AlertPolicy$Condition$TimeSeriesQueryLanguageConditionOrBuilder getConditionTimeSeriesQueryLanguageOrBuilder()' has been removed [ERROR] 7002: com.google.monitoring.v3.AlertPolicy$Condition$Builder: Method 'public boolean hasConditionTimeSeriesQueryLanguage()' has been removed [ERROR] 7002: com.google.monitoring.v3.AlertPolicy$Condition$Builder: Method 'public com.google.monitoring.v3.AlertPolicy$Condition$Builder mergeConditionTimeSeriesQueryLanguage(com.google.monitoring.v3.AlertPolicy$Condition$TimeSeriesQueryLanguageCondition)' has been removed [ERROR] 7002: com.google.monitoring.v3.AlertPolicy$Condition$Builder: Method 'public com.google.monitoring.v3.AlertPolicy$Condition$Builder setConditionTimeSeriesQueryLanguage(com.google.monitoring.v3.AlertPolicy$Condition$TimeSeriesQueryLanguageCondition)' has been removed [ERROR] 7002: com.google.monitoring.v3.AlertPolicy$Condition$Builder: Method 'public com.google.monitoring.v3.AlertPolicy$Condition$Builder setConditionTimeSeriesQueryLanguage(com.google.monitoring.v3.AlertPolicy$Condition$TimeSeriesQueryLanguageCondition$Builder)' has been removed [ERROR] 6001: com.google.monitoring.v3.AlertPolicy$Condition$ConditionCase: Removed field CONDITION_TIME_SERIES_QUERY_LANGUAGE [ERROR] 8001: com.google.monitoring.v3.AlertPolicy$Condition$TimeSeriesQueryLanguageCondition: Class com.google.monitoring.v3.AlertPolicy$Condition$TimeSeriesQueryLanguageCondition removed [ERROR] 8001: com.google.monitoring.v3.AlertPolicy$Condition$TimeSeriesQueryLanguageCondition$Builder: Class com.google.monitoring.v3.AlertPolicy$Condition$TimeSeriesQueryLanguageCondition$Builder removed [ERROR] 8001: com.google.monitoring.v3.AlertPolicy$Condition$TimeSeriesQueryLanguageConditionOrBuilder: Class com.google.monitoring.v3.AlertPolicy$Condition$TimeSeriesQueryLanguageConditionOrBuilder removed [ERROR] 7002: com.google.monitoring.v3.AlertPolicy$ConditionOrBuilder: Method 'public com.google.monitoring.v3.AlertPolicy$Condition$TimeSeriesQueryLanguageCondition getConditionTimeSeriesQueryLanguage()' has been removed [ERROR] 7002: com.google.monitoring.v3.AlertPolicy$ConditionOrBuilder: Method 'public com.google.monitoring.v3.AlertPolicy$Condition$TimeSeriesQueryLanguageConditionOrBuilder getConditionTimeSeriesQueryLanguageOrBuilder()' has been removed [ERROR] 7002: com.google.monitoring.v3.AlertPolicy$ConditionOrBuilder: Method 'public boolean hasConditionTimeSeriesQueryLanguage()' has been removed ``` Committer: @miraleung PiperOrigin-RevId: 311581003 Source-Author: Google APIs <[email protected]> Source-Date: Thu May 14 12:13:51 2020 -0700 Source-Repo: googleapis/googleapis Source-Sha: 123873dc7e2be35252d172205f67a375e70e9747 Source-Link: googleapis/googleapis@123873d * fix: restore GAPIC v2 retry configs Restores GAPIC v2 retry config overrides that were mistakenly removed during migration. PiperOrigin-RevId: 312088359 Source-Author: Google APIs <[email protected]> Source-Date: Mon May 18 08:57:12 2020 -0700 Source-Repo: googleapis/googleapis Source-Sha: 5a90d467aa65e7f038f87585e8fbb45d74475e7c Source-Link: googleapis/googleapis@5a90d46 * feat(v1p3beta1): added support for streaming automl action recognition. PiperOrigin-RevId: 312101156 Source-Author: Google APIs <[email protected]> Source-Date: Mon May 18 10:04:40 2020 -0700 Source-Repo: googleapis/googleapis Source-Sha: d1a9f02fd4fb263bae0383b4a5af0bbef33753d6 Source-Link: googleapis/googleapis@d1a9f02 * fix: point artman at gapic v1 for monitoring/v3 API Committer: @miraleung PiperOrigin-RevId: 312104480 Source-Author: Google APIs <[email protected]> Source-Date: Mon May 18 10:19:39 2020 -0700 Source-Repo: googleapis/googleapis Source-Sha: e94ad376529fabdfd2fce00407926a0cefd38b9e Source-Link: googleapis/googleapis@e94ad37 * Dialogflow weekly v2 library update: - Minor comment updates. PiperOrigin-RevId: 312123588 Source-Author: Google APIs <[email protected]> Source-Date: Mon May 18 11:49:18 2020 -0700 Source-Repo: googleapis/googleapis Source-Sha: cd3ce2651c3921670217e664303976cdf76e9fe2 Source-Link: googleapis/googleapis@cd3ce26 * chore(python): remove one remaining extra bash line (#565) To avoid generating bogus PRs Co-authored-by: Jeffrey Rennie <[email protected]> Source-Author: Carlos de la Guardia <[email protected]> Source-Date: Tue May 19 11:57:19 2020 -0500 Source-Repo: googleapis/synthtool Source-Sha: d2364eb80b840a36136c8ce12f1c6efabcc9600e Source-Link: googleapis/synthtool@d2364eb * Upgrade protoc-docs-plugin version to 0.7.0 to fix unstable docstrings. PiperOrigin-RevId: 312689208 Source-Author: Google APIs <[email protected]> Source-Date: Thu May 21 10:00:47 2020 -0700 Source-Repo: googleapis/googleapis Source-Sha: dec3204175104cef49bf21d685d5517caaf0058f Source-Link: googleapis/googleapis@dec3204 * bazel: update protobuf, rules_go, gazelle, and gapic-generator-go versions - protobuf v3.12.1 - rules_go v0.23.0 - gazelle v0.21.0 - gapic-generator-go v0.14.1 PiperOrigin-RevId: 313460921 Source-Author: Google APIs <[email protected]> Source-Date: Wed May 27 14:10:16 2020 -0700 Source-Repo: googleapis/googleapis Source-Sha: c4e37010d74071851ff24121f522e802231ac86e Source-Link: googleapis/googleapis@c4e3701 * Use correct resource type for DetachSubscriptionRequest PiperOrigin-RevId: 313488995 Source-Author: Google APIs <[email protected]> Source-Date: Wed May 27 16:45:32 2020 -0700 Source-Repo: googleapis/googleapis Source-Sha: eafa840ceec23b44a5c21670288107c661252711 Source-Link: googleapis/googleapis@eafa840 * docs: update python docs template (#576) * docs: update python docs template * sphinx change Source-Author: kolea2 <[email protected]> Source-Date: Wed May 27 20:44:34 2020 -0400 Source-Repo: googleapis/synthtool Source-Sha: 71b8a272549c06b5768d00fa48d3ae990e871bec Source-Link: googleapis/synthtool@71b8a27 * feat: add templates for python samples projects (#506) These templates will be used for templates in python-docs-samples and in Python client libraries. The README generation code is a modified version of https://github.com/GoogleCloudPlatform/python-docs-samples/tree/master/scripts/readme-gen. Co-authored-by: Kurtis Van Gent <[email protected]> Source-Author: Bu Sun Kim <[email protected]> Source-Date: Thu May 28 14:39:58 2020 -0700 Source-Repo: googleapis/synthtool Source-Sha: ffe10407ee2f261c799fb0d01bf32a8abc67ed1e Source-Link: googleapis/synthtool@ffe1040 * chore: update default ignores for Python libraries (#586) Source-Author: Bu Sun Kim <[email protected]> Source-Date: Thu May 28 14:43:37 2020 -0700 Source-Repo: googleapis/synthtool Source-Sha: e99975b6b49827b8720f0a885e218dbdb67849ca Source-Link: googleapis/synthtool@e99975b * feat: allow custom python versions in noxfile (#585) Libraries on the microgenerator support a smaller range of Python versions (3.6+). Source-Author: Bu Sun Kim <[email protected]> Source-Date: Thu May 28 18:22:04 2020 -0700 Source-Repo: googleapis/synthtool Source-Sha: 4e1d2cb79b02d7496b1452f91c518630c207145e Source-Link: googleapis/synthtool@4e1d2cb * docs: fix docs Co-authored-by: Bu Sun Kim <[email protected]>
1 parent ce1e7de commit 586f920

File tree

66 files changed

+4016
-2600
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+4016
-2600
lines changed

.flake8

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ exclude =
2121
# Exclude generated code.
2222
**/proto/**
2323
**/gapic/**
24+
**/services/**
25+
**/types/**
2426
*_pb2.py
2527

2628
# Standard linting exemptions.

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
dist
1111
build
1212
eggs
13+
.eggs
1314
parts
1415
bin
1516
var
@@ -49,6 +50,7 @@ bigquery/docs/generated
4950
# Virtual environment
5051
env/
5152
coverage.xml
53+
sponge_log.xml
5254

5355
# System test environment variables.
5456
system_tests/local_test_setup

.kokoro/publish-docs.sh

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515

16-
#!/bin/bash
17-
1816
set -eo pipefail
1917

2018
# Disable buffering, so that the logs stream through.

.kokoro/release.sh

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515

16-
#!/bin/bash
17-
1816
set -eo pipefail
1917

2018
# Start the releasetool reporter

.kokoro/samples/lint/common.cfg

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Format: //devtools/kokoro/config/proto/build.proto
2+
3+
# Build logs will be here
4+
action {
5+
define_artifacts {
6+
regex: "**/*sponge_log.xml"
7+
}
8+
}
9+
10+
# Specify which tests to run
11+
env_vars: {
12+
key: "RUN_TESTS_SESSION"
13+
value: "lint"
14+
}
15+
16+
env_vars: {
17+
key: "TRAMPOLINE_BUILD_FILE"
18+
value: "github/python-videointelligence/.kokoro/test-samples.sh"
19+
}
20+
21+
# Configure the docker image for kokoro-trampoline.
22+
env_vars: {
23+
key: "TRAMPOLINE_IMAGE"
24+
value: "gcr.io/cloud-devrel-kokoro-resources/python-samples-testing-docker"
25+
}
26+
27+
# Download secrets for samples
28+
gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/python-docs-samples"
29+
30+
# Download trampoline resources.
31+
gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline"
32+
33+
# Use the trampoline script to run in docker.
34+
build_file: "python-videointelligence/.kokoro/trampoline.sh"

.kokoro/samples/lint/continuous.cfg

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Format: //devtools/kokoro/config/proto/build.proto
2+
3+
env_vars: {
4+
key: "INSTALL_LIBRARY_FROM_SOURCE"
5+
value: "True"
6+
}

.kokoro/samples/lint/periodic.cfg

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Format: //devtools/kokoro/config/proto/build.proto
2+
3+
env_vars: {
4+
key: "INSTALL_LIBRARY_FROM_SOURCE"
5+
value: "False"
6+
}

.kokoro/samples/lint/presubmit.cfg

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Format: //devtools/kokoro/config/proto/build.proto
2+
3+
env_vars: {
4+
key: "INSTALL_LIBRARY_FROM_SOURCE"
5+
value: "True"
6+
}

.kokoro/samples/python3.6/common.cfg

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Format: //devtools/kokoro/config/proto/build.proto
2+
3+
# Build logs will be here
4+
action {
5+
define_artifacts {
6+
regex: "**/*sponge_log.xml"
7+
}
8+
}
9+
10+
# Specify which tests to run
11+
env_vars: {
12+
key: "RUN_TESTS_SESSION"
13+
value: "py-3.6"
14+
}
15+
16+
env_vars: {
17+
key: "TRAMPOLINE_BUILD_FILE"
18+
value: "github/python-videointelligence/.kokoro/test-samples.sh"
19+
}
20+
21+
# Configure the docker image for kokoro-trampoline.
22+
env_vars: {
23+
key: "TRAMPOLINE_IMAGE"
24+
value: "gcr.io/cloud-devrel-kokoro-resources/python-samples-testing-docker"
25+
}
26+
27+
# Download secrets for samples
28+
gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/python-docs-samples"
29+
30+
# Download trampoline resources.
31+
gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline"
32+
33+
# Use the trampoline script to run in docker.
34+
build_file: "python-videointelligence/.kokoro/trampoline.sh"
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Format: //devtools/kokoro/config/proto/build.proto
2+
3+
env_vars: {
4+
key: "INSTALL_LIBRARY_FROM_SOURCE"
5+
value: "True"
6+
}
7+
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Format: //devtools/kokoro/config/proto/build.proto
2+
3+
env_vars: {
4+
key: "INSTALL_LIBRARY_FROM_SOURCE"
5+
value: "False"
6+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Format: //devtools/kokoro/config/proto/build.proto
2+
3+
env_vars: {
4+
key: "INSTALL_LIBRARY_FROM_SOURCE"
5+
value: "True"
6+
}

.kokoro/samples/python3.7/common.cfg

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Format: //devtools/kokoro/config/proto/build.proto
2+
3+
# Build logs will be here
4+
action {
5+
define_artifacts {
6+
regex: "**/*sponge_log.xml"
7+
}
8+
}
9+
10+
# Specify which tests to run
11+
env_vars: {
12+
key: "RUN_TESTS_SESSION"
13+
value: "py-3.7"
14+
}
15+
16+
env_vars: {
17+
key: "TRAMPOLINE_BUILD_FILE"
18+
value: "github/python-videointelligence/.kokoro/test-samples.sh"
19+
}
20+
21+
# Configure the docker image for kokoro-trampoline.
22+
env_vars: {
23+
key: "TRAMPOLINE_IMAGE"
24+
value: "gcr.io/cloud-devrel-kokoro-resources/python-samples-testing-docker"
25+
}
26+
27+
# Download secrets for samples
28+
gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/python-docs-samples"
29+
30+
# Download trampoline resources.
31+
gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline"
32+
33+
# Use the trampoline script to run in docker.
34+
build_file: "python-videointelligence/.kokoro/trampoline.sh"
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Format: //devtools/kokoro/config/proto/build.proto
2+
3+
env_vars: {
4+
key: "INSTALL_LIBRARY_FROM_SOURCE"
5+
value: "True"
6+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Format: //devtools/kokoro/config/proto/build.proto
2+
3+
env_vars: {
4+
key: "INSTALL_LIBRARY_FROM_SOURCE"
5+
value: "False"
6+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Format: //devtools/kokoro/config/proto/build.proto
2+
3+
env_vars: {
4+
key: "INSTALL_LIBRARY_FROM_SOURCE"
5+
value: "True"
6+
}

.kokoro/samples/python3.8/common.cfg

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Format: //devtools/kokoro/config/proto/build.proto
2+
3+
# Build logs will be here
4+
action {
5+
define_artifacts {
6+
regex: "**/*sponge_log.xml"
7+
}
8+
}
9+
10+
# Specify which tests to run
11+
env_vars: {
12+
key: "RUN_TESTS_SESSION"
13+
value: "py-3.8"
14+
}
15+
16+
env_vars: {
17+
key: "TRAMPOLINE_BUILD_FILE"
18+
value: "github/python-videointelligence/.kokoro/test-samples.sh"
19+
}
20+
21+
# Configure the docker image for kokoro-trampoline.
22+
env_vars: {
23+
key: "TRAMPOLINE_IMAGE"
24+
value: "gcr.io/cloud-devrel-kokoro-resources/python-samples-testing-docker"
25+
}
26+
27+
# Download secrets for samples
28+
gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/python-docs-samples"
29+
30+
# Download trampoline resources.
31+
gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline"
32+
33+
# Use the trampoline script to run in docker.
34+
build_file: "python-videointelligence/.kokoro/trampoline.sh"
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Format: //devtools/kokoro/config/proto/build.proto
2+
3+
env_vars: {
4+
key: "INSTALL_LIBRARY_FROM_SOURCE"
5+
value: "True"
6+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Format: //devtools/kokoro/config/proto/build.proto
2+
3+
env_vars: {
4+
key: "INSTALL_LIBRARY_FROM_SOURCE"
5+
value: "False"
6+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Format: //devtools/kokoro/config/proto/build.proto
2+
3+
env_vars: {
4+
key: "INSTALL_LIBRARY_FROM_SOURCE"
5+
value: "True"
6+
}

.kokoro/test-samples.sh

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
#!/bin/bash
2+
# Copyright 2020 Google LLC
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# https://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
16+
17+
# `-e` enables the script to automatically fail when a command fails
18+
# `-o pipefail` sets the exit code to the rightmost comment to exit with a non-zero
19+
set -eo pipefail
20+
# Enables `**` to include files nested inside sub-folders
21+
shopt -s globstar
22+
23+
cd github/python-videointelligence
24+
25+
# Run periodic samples tests at latest release
26+
if [[ $KOKORO_BUILD_ARTIFACTS_SUBDIR = *"periodic"* ]]; then
27+
LATEST_RELEASE=$(git describe --abbrev=0 --tags)
28+
git checkout $LATEST_RELEASE
29+
fi
30+
31+
# Disable buffering, so that the logs stream through.
32+
export PYTHONUNBUFFERED=1
33+
34+
# Debug: show build environment
35+
env | grep KOKORO
36+
37+
# Install nox
38+
python3.6 -m pip install --upgrade --quiet nox
39+
40+
# Use secrets acessor service account to get secrets
41+
if [[ -f "${KOKORO_GFILE_DIR}/secrets_viewer_service_account.json" ]]; then
42+
gcloud auth activate-service-account \
43+
--key-file="${KOKORO_GFILE_DIR}/secrets_viewer_service_account.json" \
44+
--project="cloud-devrel-kokoro-resources"
45+
fi
46+
47+
# This script will create 3 files:
48+
# - testing/test-env.sh
49+
# - testing/service-account.json
50+
# - testing/client-secrets.json
51+
./scripts/decrypt-secrets.sh
52+
53+
source ./testing/test-env.sh
54+
export GOOGLE_APPLICATION_CREDENTIALS=$(pwd)/testing/service-account.json
55+
56+
# For cloud-run session, we activate the service account for gcloud sdk.
57+
gcloud auth activate-service-account \
58+
--key-file "${GOOGLE_APPLICATION_CREDENTIALS}"
59+
60+
export GOOGLE_CLIENT_SECRETS=$(pwd)/testing/client-secrets.json
61+
62+
echo -e "\n******************** TESTING PROJECTS ********************"
63+
64+
# Switch to 'fail at end' to allow all tests to complete before exiting.
65+
set +e
66+
# Use RTN to return a non-zero value if the test fails.
67+
RTN=0
68+
ROOT=$(pwd)
69+
# Find all requirements.txt in the samples directory (may break on whitespace).
70+
for file in samples/**/requirements.txt; do
71+
cd "$ROOT"
72+
# Navigate to the project folder.
73+
file=$(dirname "$file")
74+
cd "$file"
75+
76+
echo "------------------------------------------------------------"
77+
echo "- testing $file"
78+
echo "------------------------------------------------------------"
79+
80+
# Use nox to execute the tests for the project.
81+
python3.6 -m nox -s "$RUN_TESTS_SESSION"
82+
EXIT=$?
83+
84+
# If this is a periodic build, send the test log to the Build Cop Bot.
85+
# See https://github.com/googleapis/repo-automation-bots/tree/master/packages/buildcop.
86+
if [[ $KOKORO_BUILD_ARTIFACTS_SUBDIR = *"periodic"* ]]; then
87+
chmod +x $KOKORO_GFILE_DIR/linux_amd64/buildcop
88+
$KOKORO_GFILE_DIR/linux_amd64/buildcop
89+
fi
90+
91+
if [[ $EXIT -ne 0 ]]; then
92+
RTN=1
93+
echo -e "\n Testing failed: Nox returned a non-zero exit code. \n"
94+
else
95+
echo -e "\n Testing completed.\n"
96+
fi
97+
98+
done
99+
cd "$ROOT"
100+
101+
# Workaround for Kokoro permissions issue: delete secrets
102+
rm testing/{test-env.sh,client-secrets.json,service-account.json}
103+
104+
exit "$RTN"

MANIFEST.in

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,6 @@ recursive-include google *.json *.proto
2020
recursive-include tests *
2121
global-exclude *.py[co]
2222
global-exclude __pycache__
23+
24+
# Exclude scripts for samples readmegen
25+
prune scripts/readme-gen

0 commit comments

Comments
 (0)