Skip to content

Commit a427810

Browse files
authored
Migrate tests to Kokoro (#652)
Migrate tests to Kokoro Move existing CircleCI tests to Kokoro. Add semistandard dev-dependency Update appengine/pubsub dependencies Skip pubsub Kokoro tests
1 parent 30f7631 commit a427810

Some content is hidden

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

51 files changed

+631
-23
lines changed

.kokoro/appengine-datastore.cfg

-10
This file was deleted.

.kokoro/appengine/analytics-flex.cfg

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Format: //devtools/kokoro/config/proto/build.proto
2+
3+
# Set GAE environment
4+
env_vars: {
5+
key: "APPENGINE_ENVIRONMENT"
6+
value: "flexible"
7+
}
8+
9+
# Set the folder in which the tests are run
10+
env_vars: {
11+
key: "PROJECT"
12+
value: "analytics"
13+
}
+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Format: //devtools/kokoro/config/proto/build.proto
2+
3+
# Set GAE environment
4+
env_vars: {
5+
key: "APPENGINE_ENVIRONMENT"
6+
value: "standard"
7+
}
8+
9+
# Set the folder in which the tests are run
10+
env_vars: {
11+
key: "PROJECT"
12+
value: "analytics"
13+
}

.kokoro/appengine/build.sh

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
#!/bin/bash
2+
3+
# Copyright 2018 Google Inc.
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
17+
export GCLOUD_PROJECT=nodejs-docs-samples-tests
18+
19+
export NODE_ENV=development
20+
export GAE_VERSION=appengine-${PROJECT}-${APPENGINE_ENVIRONMENT}
21+
22+
# Register post-test cleanup
23+
function cleanup {
24+
gcloud app versions delete $GAE_VERSION --quiet
25+
if [ -e "worker.yaml" ]; then
26+
gcloud app versions delete ${GAE_VERSION}-worker --quiet
27+
fi
28+
}
29+
trap cleanup EXIT
30+
set -e;
31+
32+
cd github/nodejs-docs-samples/appengine/${PROJECT}
33+
34+
# Install dependencies
35+
npm install
36+
37+
# Configure gcloud
38+
export GOOGLE_APPLICATION_CREDENTIALS=${KOKORO_GFILE_DIR}/secrets-key.json
39+
gcloud auth activate-service-account --key-file "$GOOGLE_APPLICATION_CREDENTIALS"
40+
gcloud config set project $GCLOUD_PROJECT
41+
42+
43+
# Deploy the app
44+
gcloud app deploy app.${APPENGINE_ENVIRONMENT}.yaml --version $GAE_VERSION --no-promote --quiet
45+
if [ -e "worker.yaml" ]; then
46+
gcloud app deploy worker.yaml --version ${GAE_VERSION} --no-promote --quiet
47+
fi
48+
49+
50+
# Test the deployed app
51+
npm test
52+
53+
exit $?

.kokoro/appengine/common.cfg

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Format: //devtools/kokoro/config/proto/build.proto
2+
3+
# Download trampoline resources. These will be in ${KOKORO_GFILE_DIR}
4+
gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline"
5+
6+
# Download secrets from Cloud Storage.
7+
gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/nodejs-docs-samples"
8+
9+
# All builds use the trampoline script to run in docker.
10+
build_file: "nodejs-docs-samples/.kokoro/trampoline.sh"
11+
12+
# Configure the docker image for kokoro-trampoline.
13+
env_vars: {
14+
key: "TRAMPOLINE_IMAGE"
15+
value: "gcr.io/cloud-docs-samples/nodejs"
16+
}
17+
18+
# Tell the trampoline which build file to use.
19+
env_vars: {
20+
key: "TRAMPOLINE_BUILD_FILE"
21+
value: "github/nodejs-docs-samples/.kokoro/appengine/build.sh"
22+
}

.kokoro/appengine/datastore-flex.cfg

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Format: //devtools/kokoro/config/proto/build.proto
2+
3+
# Set GAE environment
4+
env_vars: {
5+
key: "APPENGINE_ENVIRONMENT"
6+
value: "flexible"
7+
}
8+
9+
# Set the folder in which the tests are run
10+
env_vars: {
11+
key: "PROJECT"
12+
value: "datastore"
13+
}
+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Format: //devtools/kokoro/config/proto/build.proto
2+
3+
# Set GAE environment
4+
env_vars: {
5+
key: "APPENGINE_ENVIRONMENT"
6+
value: "standard"
7+
}
8+
9+
# Set the folder in which the tests are run
10+
env_vars: {
11+
key: "PROJECT"
12+
value: "datastore"
13+
}
+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
#!/bin/bash
2+
3+
# Copyright 2018 Google Inc.
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
17+
export GCLOUD_PROJECT=nodejs-docs-samples-tests
18+
19+
export NODE_ENV=development
20+
export GAE_VERSION=appengine-${PROJECT}-${APPENGINE_ENVIRONMENT}
21+
22+
# Register post-test cleanup
23+
function cleanup {
24+
gcloud app versions delete $GAE_VERSION --quiet
25+
if [ -e "worker.yaml" ]; then
26+
gcloud app versions delete ${GAE_VERSION}-worker --quiet
27+
fi
28+
}
29+
trap cleanup EXIT
30+
set -e;
31+
32+
cd github/nodejs-docs-samples/appengine/${PROJECT}/${APPENGINE_ENVIRONMENT}
33+
34+
# Install dependencies
35+
npm install
36+
37+
# Configure gcloud
38+
export GOOGLE_APPLICATION_CREDENTIALS=${KOKORO_GFILE_DIR}/secrets-key.json
39+
gcloud auth activate-service-account --key-file "$GOOGLE_APPLICATION_CREDENTIALS"
40+
gcloud config set project $GCLOUD_PROJECT
41+
42+
43+
# Deploy the app
44+
gcloud app deploy --version $GAE_VERSION --no-promote --quiet
45+
if [ -e "worker.yaml" ]; then
46+
gcloud app deploy worker.yaml --version ${GAE_VERSION} --no-promote --quiet
47+
fi
48+
49+
50+
# Test the deployed app
51+
npm test
52+
53+
exit $?
+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Format: //devtools/kokoro/config/proto/build.proto
2+
3+
# Download trampoline resources. These will be in ${KOKORO_GFILE_DIR}
4+
gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline"
5+
6+
# Download secrets from Cloud Storage.
7+
gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/nodejs-docs-samples"
8+
9+
# All builds use the trampoline script to run in docker.
10+
build_file: "nodejs-docs-samples/.kokoro/trampoline.sh"
11+
12+
# Configure the docker image for kokoro-trampoline.
13+
env_vars: {
14+
key: "TRAMPOLINE_IMAGE"
15+
value: "gcr.io/cloud-docs-samples/nodejs"
16+
}
17+
18+
# Tell the trampoline which build file to use.
19+
env_vars: {
20+
key: "TRAMPOLINE_BUILD_FILE"
21+
value: "github/nodejs-docs-samples/.kokoro/appengine/default-yml/build.sh"
22+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Format: //devtools/kokoro/config/proto/build.proto
2+
3+
# Set GAE environment
4+
env_vars: {
5+
key: "APPENGINE_ENVIRONMENT"
6+
value: "flexible"
7+
}
8+
9+
# Set the folder in which the tests are run
10+
env_vars: {
11+
key: "PROJECT"
12+
value: "hello-worl"
13+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Format: //devtools/kokoro/config/proto/build.proto
2+
3+
# Set GAE environment
4+
env_vars: {
5+
key: "APPENGINE_ENVIRONMENT"
6+
value: "standard"
7+
}
8+
9+
# Set the folder in which the tests are run
10+
env_vars: {
11+
key: "PROJECT"
12+
value: "hello-worl"
13+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Format: //devtools/kokoro/config/proto/build.proto
2+
3+
# Set GAE environment
4+
env_vars: {
5+
key: "APPENGINE_ENVIRONMENT"
6+
value: "flexible"
7+
}
8+
9+
# Set the folder in which the tests are run
10+
env_vars: {
11+
key: "PROJECT"
12+
value: "metadata"
13+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Format: //devtools/kokoro/config/proto/build.proto
2+
3+
# Set GAE environment
4+
env_vars: {
5+
key: "APPENGINE_ENVIRONMENT"
6+
value: "standard"
7+
}
8+
9+
# Set the folder in which the tests are run
10+
env_vars: {
11+
key: "PROJECT"
12+
value: "metadata"
13+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Format: //devtools/kokoro/config/proto/build.proto
2+
3+
# Set GAE environment
4+
env_vars: {
5+
key: "APPENGINE_ENVIRONMENT"
6+
value: "flexible"
7+
}
8+
9+
# Set the folder in which the tests are run
10+
env_vars: {
11+
key: "PROJECT"
12+
value: "storage"
13+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Format: //devtools/kokoro/config/proto/build.proto
2+
3+
# Set GAE environment
4+
env_vars: {
5+
key: "APPENGINE_ENVIRONMENT"
6+
value: "standard"
7+
}
8+
9+
# Set the folder in which the tests are run
10+
env_vars: {
11+
key: "PROJECT"
12+
value: "storage"
13+
}

.kokoro/appengine/endpoints-flex.cfg

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Format: //devtools/kokoro/config/proto/build.proto
2+
3+
# Set GAE environment
4+
env_vars: {
5+
key: "APPENGINE_ENVIRONMENT"
6+
value: "flexible"
7+
}
8+
9+
# Set the folder in which the tests are run
10+
env_vars: {
11+
key: "PROJECT"
12+
value: "endpoints"
13+
}
+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Format: //devtools/kokoro/config/proto/build.proto
2+
3+
# Set GAE environment
4+
env_vars: {
5+
key: "APPENGINE_ENVIRONMENT"
6+
value: "standard"
7+
}
8+
9+
# Set the folder in which the tests are run
10+
env_vars: {
11+
key: "PROJECT"
12+
value: "endpoints"
13+
}
+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Format: //devtools/kokoro/config/proto/build.proto
2+
3+
# Set GAE environment
4+
env_vars: {
5+
key: "APPENGINE_ENVIRONMENT"
6+
value: "flexible"
7+
}
8+
9+
# Set the folder in which the tests are run
10+
env_vars: {
11+
key: "PROJECT"
12+
value: "errorreporting"
13+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Format: //devtools/kokoro/config/proto/build.proto
2+
3+
# Set GAE environment
4+
env_vars: {
5+
key: "APPENGINE_ENVIRONMENT"
6+
value: "standard"
7+
}
8+
9+
# Set the folder in which the tests are run
10+
env_vars: {
11+
key: "PROJECT"
12+
value: "errorreporting"
13+
}

.kokoro/appengine/mailjet-flex.cfg

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Format: //devtools/kokoro/config/proto/build.proto
2+
3+
# Set GAE environment
4+
env_vars: {
5+
key: "APPENGINE_ENVIRONMENT"
6+
value: "flexible"
7+
}
8+
9+
# Set the folder in which the tests are run
10+
env_vars: {
11+
key: "PROJECT"
12+
value: "mailjet"
13+
}

0 commit comments

Comments
 (0)