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-datastore-flexible
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/datastore
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.flexible.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 $?
0 commit comments