This repository has been archived by the owner on Aug 28, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy path.travis.yml
43 lines (43 loc) · 1.85 KB
/
.travis.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# Use Dockerized infrastructure
sudo: false
language: python
# Cache our gcloud SDK between commands
cache:
directories:
- "$HOME/gcloud/"
env:
# Make sure gcloud command is on our PATH and the App Engine SDK is in the Python path
globals:
- PATH=$PATH:$HOME/gcloud/google-cloud-sdk/bin
- PYTHONPATH=${HOME}/gcloud/google-cloud-sdk/platform/google_appengine
- GOOGLE_APPLICATION_CREDENTIALS=$TRAVIS_BUILD_DIR/credentials.json
before_install:
# Decrypt the credentials stored in the base64-encoded environment variable.
- python dump_credentials.py
# If the SDK is not already cached, download it and unpack it
- if [ ! -d $HOME/gcloud/google-cloud-sdk ]; then mkdir -p $HOME/gcloud && wget https://dl.google.com/dl/cloudsdk/release/google-cloud-sdk.tar.gz
--directory-prefix=$HOME/gcloud && cd $HOME/gcloud && tar xzf google-cloud-sdk.tar.gz
&& printf '\ny\n\ny\ny\n' | ./google-cloud-sdk/install.sh && cd $TRAVIS_BUILD_DIR;
fi
# Here we use the decrypted service account credentials to authenticate the command line tool
- gcloud auth activate-service-account --key-file ${GOOGLE_APPLICATION_CREDENTIALS}
install:
# Set the correct project to deploy to
- gcloud config set project ${GOOGLE_APP_ID}
# Install the AppEngine SDK
- gcloud -q components update
- gcloud info
# Have to wipe out the lib directory. See
# https://github.com/GoogleCloudPlatform/appengine-flask-skeleton/issues/1
- rm -rf appengine-python-flask/lib
- mkdir appengine-python-flask/lib
- pip install -r appengine-python-flask/requirements.txt -t appengine-python-flask/lib/
script:
# Deploy the app
- gcloud config set app/use_gsutil true
- gcloud -q app deploy appengine-python-flask/app.yaml --no-promote --version ${GOOGLE_APP_VERSION}
# Initialize it
- curl https://${GOOGLE_APP_VERSION}-dot-${GOOGLE_APP_ID}.appspot.com/init
# Run an end to end test
- python api_test.py
- phantomjs test.js