-
Notifications
You must be signed in to change notification settings - Fork 2
/
.travis.yml
71 lines (60 loc) · 2.33 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
dist: bionic
language: go
go:
- 1.13.4
services:
- docker
env:
global:
- IMG_NAME=daocasino/platform-back
- IMG_TAG=${TRAVIS_TAG:-${TRAVIS_BRANCH}-${TRAVIS_COMMIT:0:5}}
environments:
- &DEV_ENV
- AWS_DEFAULT_REGION=${DEV_AWS_REGION}
- AWS_ACCESS_KEY_ID=${DEV_AWS_ACCESS_KEY_ID}
- AWS_SECRET_ACCESS_KEY=${DEV_AWS_SECRET}
before_install:
- echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
cache:
directories:
- $HOME/.ccache
timeout: 1000
git:
depth: false
notifications:
email: false
before_script:
- curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $GOPATH/bin v1.23.1
jobs:
include:
- stage: lint & test
script:
- golangci-lint run
- go test -v -race -coverprofile=coverage.txt -covermode=atomic ./...
- stage: build & push
script:
- docker build -t $IMG_NAME:$IMG_TAG .
- docker push $IMG_NAME:$IMG_TAG
- |
if [[ "$TRAVIS_PULL_REQUEST" == "false" ]]; then #tag latest image for branch
if [[ "$TRAVIS_BRANCH" == "develop" || "$TRAVIS_BRANCH" == "stage" || "$TRAVIS_BRANCH" == "master" ]]; then
docker tag $IMG_NAME:$IMG_TAG $IMG_NAME:$TRAVIS_BRANCH
docker push $IMG_NAME:$TRAVIS_BRANCH
fi
fi
- stage: deploy
env:
- *DEV_ENV
script:
|
if [[ "$TRAVIS_PULL_REQUEST" == "false" && "$TRAVIS_BRANCH" == "develop" ]]; then
docker run -e AWS_DEFAULT_REGION -e AWS_ACCESS_KEY_ID -e AWS_SECRET_ACCESS_KEY silintl/ecs-deploy -t 300 -c platform-dev -n platform-dev -i $IMG_NAME:$IMG_TAG --skip-deployments-check
elif
[[ "$TRAVIS_PULL_REQUEST" == "false" && "$TRAVIS_BRANCH" == "stage" ]]; then
docker run -e AWS_DEFAULT_REGION -e AWS_ACCESS_KEY_ID -e AWS_SECRET_ACCESS_KEY silintl/ecs-deploy -t 300 -c platform-stage -n platform-stage -i $IMG_NAME:$IMG_TAG --skip-deployments-check
elif
[[ "$TRAVIS_PULL_REQUEST" == "false" && "$TRAVIS_BRANCH" == "master" ]]; then
docker run -e AWS_DEFAULT_REGION -e AWS_ACCESS_KEY_ID -e AWS_SECRET_ACCESS_KEY silintl/ecs-deploy -t 300 -c platform-prod -n platform-prod -i $IMG_NAME:$IMG_TAG --skip-deployments-check
fi
after_success:
- bash <(curl -s https://codecov.io/bash)