-
Notifications
You must be signed in to change notification settings - Fork 4
/
.travis.yml
32 lines (28 loc) · 1.69 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
sudo: required
services:
- docker
env:
global:
- GIT_SHA=$(git rev-parse HEAD) # Enviroment variable which holds the current git SHA
- CLOUDSDK_CORE_DISABLE_PROMPTS=1 # Do not ask for user input when installing google sdk
before_install:
# All this scripts will run inside travis
# Install Google Cloud SDK
- curl https://sdk.cloud.google.com | bash > /dev/null;
- source $HOME/google-cloud-sdk/path.bash.inc # Source the path.bash.inc
- gcloud components update kubectl # Install/Update kubectl
- openssl aes-256-cbc -K $encrypted_356d6ef83503_key -iv $encrypted_356d6ef83503_iv -in factorial-project-5fa4988e91fc.json.enc -out factorial-project-5fa4988e91fc.json -d
- gcloud auth activate-service-account --key-file factorial-project-5fa4988e91fc.json # Authenticate to Google cloud. Similar to AWS IAM user we will use service account in GCP. With authentication google-sdk can use our GCP account
- gcloud config set project factorial-project # Your Project ID on GCP
- gcloud config set compute/zone us-central1-c # Find this information on your Kubernetes cluster page on GCP
- gcloud container clusters get-credentials factorial-project # Name of your Kubernetes cluster
- echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_ID" --password-stdin # Login to docker hub
- docker build -t singhabhinav/factorial-project-react-client-k8s -f ./react-client/Dockerfile.dev ./react-client # Build the image to run unit test cases
# Tell Travis how to run test suite
script:
- docker run -e CI=true singhabhinav/factorial-project-react-client-k8s npm run test
deploy:
provider: script
script: bash ./deploy.sh
on:
branch: master