-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.travis.yml
73 lines (66 loc) · 2.39 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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
dist: trusty
sudo: false
language: node_js
node_js:
- "8"
services:
- docker
addons:
apt:
sources:
- google-chrome
packages:
- google-chrome-stable
cache:
directories:
- ./curiosidade-domiciliar/node_modules
- $HOME/google-cloud-sdk
before_install:
- cd curiosidade-domiciliar
stages:
- test
- build
- acceptance
- deploy
jobs:
include:
- stage: test
if : branch = /^feature.*$/
install: npm install
script:
- npm run lint
- npm run test-headless
- bash <(curl -s https://codecov.io/bash)
- stage: build
if : branch = /^feature.*$/
install: npm install --production
script:
- npm run build:prod
- docker build -t $DOCKER_USERNAME/$DOCKER_REPO:test .
- echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
- docker push $DOCKER_USERNAME/$DOCKER_REPO:test
- stage: acceptance
if: branch = /^feature.*$/
install: npm install -g cypress
script:
- echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
- docker pull $DOCKER_USERNAME/$DOCKER_REPO:test
- docker run -d -p 80:80 $DOCKER_USERNAME/$DOCKER_REPO:test
- cypress run --record --key $CYPRESS_KEY --env host=localhost
after_success:
- docker tag DOCKER_REPO DOCKER_USERNAME/DOCKER_REPO:staging
- docker push $DOCKER_USERNAME/$DOCKER_REPO:staging
- stage: deploy
if: branch = master
install:
- if [ ! -d "$HOME/google-cloud-sdk/bin" ]; then rm -rf $HOME/google-cloud-sdk; curl https://sdk.cloud.google.com | bash > /dev/null; fi
- source /home/travis/google-cloud-sdk/path.bash.inc
- gcloud version
- gcloud --quiet components update kubectl
- echo $GCLOUD_KEY | base64 --decode > gcloud.json
- gcloud auth activate-service-account --key-file gcloud.json
- ssh-keygen -f ~/.ssh/google_compute_engine -N ""
- gcloud --quiet container clusters get-credentials $CLOUDSDK_CONTAINER_CLUSTER --zone=$CLOUDSDK_COMPUTE_ZONE --project=$CLOUDSDK_CORE_PROJECT
- kubectl create secret docker-registry docker-auth --docker-server=$DOCKER_SERVER --docker-username=$DOCKER_USERNAME --docker-password=$DOCKER_PASSWORD --docker-email=$DOCKER_EMAIL --dry-run -o yaml | kubectl apply -f -
script:
- kubectl apply -f deployment.yml