-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
83 lines (73 loc) · 1.77 KB
/
.gitlab-ci.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
74
75
76
77
78
79
80
81
82
83
image: canopytax/dind
stages:
- build
- test
- push-to-dockerhub
- deploy-stage
- deploy-prod
variables:
REPO_NAME: canopytax/toggle-meister
CONTAINER_IMAGE: docker.io/$REPO_NAME:$CI_COMMIT_SHA
REGISTRY: docker.io
DOCKER_DRIVER: overlay
build:
stage: build
before_script:
- mkdir -p $HOME/.docker
- echo $DOCKER_AUTH_CONFIG > $HOME/.docker/config.json
script:
- docker build --pull -t $CONTAINER_IMAGE .
- docker push $REPO_NAME:$CI_COMMIT_SHA
lint:
image: $REPO_NAME:$CI_COMMIT_SHA
stage: test
script:
- invoke lint
test:
services:
- postgres:9.6-alpine
image: $REPO_NAME:$CI_COMMIT_SHA
stage: test
script:
- export DATABASE_URL=postgres
- export IS_LOCAL=true
- alembic upgrade head
- python3 -m coverage run run.py &
- tm_pid=$!
# wait for 8445 to be open
- while ! nc -z localhost 8445; do echo "."; sleep 2; done
- pyresttest http://localhost:8445 tests/api/test.yaml
- kill -SIGINT $tm_pid
- sleep 2
- python3 -m coverage report --include "tmeister/*"
push-to-dockerhub:
stage: push-to-dockerhub
before_script:
- mkdir -p $HOME/.docker
- echo $DOCKER_AUTH_CONFIG > $HOME/.docker/config.json
script:
- docker pull $REPO_NAME:$CI_COMMIT_SHA
- docker tag $REPO_NAME:$CI_COMMIT_SHA $REPO_NAME:latest
- docker push $REPO_NAME:latest
only:
- master
.deploy: &deploy
image: canopytax/deployment
script:
- /scripts/canopy-deploy.py --docker-tag "$CI_COMMIT_SHA"
only:
- master
allow_failure: false
deploy-stage:
<<: *deploy
stage: deploy-stage
environment:
name: stage
url: https://tm.canopy.ninja
deploy-prod:
<<: *deploy
stage: deploy-prod
environment:
name: production
url: https://tm.canopytax.com
when: manual