forked from eventoL/eventoL
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
145 lines (132 loc) · 2.97 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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
stages:
- testing
- styling
- build
- deploy
variables:
CONTAINER_DEPLOY_IMAGE: $CI_REGISTRY_IMAGE:$CI_BUILD_REF_NAME
CONTAINER_RELEASE_IMAGE: $CI_REGISTRY_IMAGE:latest
IMAGE_NAME: eventol
docker master image:
stage: build
image: docker:git
tags:
- docker
services:
- docker:dind
script:
- VERSION=$(date +"%y%m%d")
- docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN $CI_REGISTRY
- docker pull $CONTAINER_RELEASE_IMAGE || true
- docker build --cache-from $CONTAINER_RELEASE_IMAGE -t $CONTAINER_RELEASE_IMAGE .
- docker tag $CONTAINER_RELEASE_IMAGE $CI_REGISTRY_IMAGE:$VERSION
- docker push $CONTAINER_RELEASE_IMAGE
- docker push $CI_REGISTRY_IMAGE:$VERSION
only:
- master
docker dev image:
stage: build
image: docker:git
tags:
- docker
services:
- docker:dind
script:
- docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN $CI_REGISTRY
- docker pull $CI_REGISTRY_IMAGE:latest-dev || true
- docker build --cache-from $CI_REGISTRY_IMAGE:latest-dev -t $CI_REGISTRY_IMAGE:latest-dev .
- docker push $CI_REGISTRY_IMAGE:latest-dev
only:
- develop
docker image:
stage: build
image: docker:git
tags:
- docker
services:
- docker:dind
script:
- docker build .
except:
- develop
- master
python-testing:
services:
- postgres:9.6
variables:
PSQL_USER: eventol
PSQL_DBNAME: eventol
PSQL_HOST: postgres
POSTGRES_DB: eventol
POSTGRES_USER: eventol
POSTGRES_PASSWORD: secret
image: python:3.7
stage: testing
script:
- make gitlab-python-testing
artifacts:
paths:
- eventol/htmlcov
react-testing:
image: node:10
stage: testing
script:
- make gitlab-react-testing
artifacts:
paths:
- eventol/front/coverage
python-lint:
image: python:3.7
stage: styling
allow_failure: true
script:
- make gitlab-python-lint
react-lint-report:
image: node:10
stage: styling
allow_failure: true
script:
- make gitlab-react-lint-with-report
artifacts:
paths:
- eventol/front/report.html
react-lint:
image: node:10
stage: styling
allow_failure: true
script:
- make gitlab-react-lint
sass-lint-report:
image: node:10
stage: styling
allow_failure: true
script:
- make gitlab-react-sasslint-with-report
artifacts:
paths:
- eventol/front/scss-lint-report.html
sass-lint:
image: node:10
stage: styling
allow_failure: true
script:
- make gitlab-react-sasslint
deploy:
stage: deploy
when: manual
only:
- master
image: docker:git
script:
- apk update && apk add sshpass
- export SSHPASS=$SSH_PASS
- sshpass -e ssh -p$SSH_PORT -o stricthostkeychecking=no -x $SSH_USER@$SSH_HOST $SSH_SCRIPT
deploy-sandbox:
stage: deploy
only:
- develop
image: docker:git
script:
- apk update && apk add sshpass
- export SSHPASS=$SANDBOX_PASS
- sshpass -e ssh -p$SANDBOX_PORT -o stricthostkeychecking=no -x $SANDBOX_USER@$SANDBOX_HOST $SANDBOX_SCRIPT