forked from GoogleCloudPlatform/continuous-deployment-demo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
41 lines (41 loc) · 1.54 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
# Use Dockerized infrastructure
sudo: false
language: python
# Cache our Gcloud SDK between commands
cache:
directories:
- "$HOME/google-cloud-sdk/"
env:
# Make sure gcloud command is on our PATH and the App Engine SDK is in the Python path
- GAE_PYTHONPATH=${HOME}/.cache/google_appengine PATH=$PATH:${HOME}/google-cloud-sdk/bin PYTHONPATH=${PYTHONPATH}:${GAE_PYTHONPATH} CLOUDSDK_CORE_DISABLE_PROMPTS=1
before_install:
# Install Google App Engine Python SDK
- if [ ! -d "${GAE_PYTHONPATH}" ]; then
python scripts/fetch_gae_sdk.py $(dirname "${GAE_PYTHONPATH}");
fi
# [START auth]
# Decrypt the credentials we added to the repo using the key we added with the Travis command line tool
- openssl aes-256-cbc -K $encrypted_d5544a893ebb_key -iv $encrypted_d5544a893ebb_iv -in credentials.tar.gz.enc -out credentials.tar.gz -d
# If the SDK is not already cached, download it and unpack it
- if [ ! -d ${HOME}/google-cloud-sdk ]; then
curl https://sdk.cloud.google.com | bash;
fi
- tar -xzf credentials.tar.gz
- mkdir -p lib
# Here we use the decrypted service account credentials to authenticate the command line tool
- gcloud auth activate-service-account --key-file client-secret.json
# [END auth]
install:
# Set the correct project to deploy to
- gcloud config set project travis-ci-update
# Install the Python dependencies
- pip install -r requirements.txt -t lib/
script:
# Run the unit tests
- python test_main.py
# [START deploy]
# Deploy the app
- gcloud -q app deploy app.yaml --promote
# Run and end to end test
- python e2e_test.py
# [END deploy]