-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path.gitlab-ci.yml
222 lines (209 loc) · 4.7 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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
stages:
- build
- test
test:front:buildprod:
image: registry.gitlab.com/bagage/batimap/ci-test-front
stage: test
cache:
untracked: true
paths:
- cache-ci/
before_script:
- yarn config set cache-folder cache-ci
script:
- cd front/
- yarn
- yarn build --prod
only:
refs:
- merge_requests
changes:
- .gitlab-ci.yml
- front/**/*
test:front:
image: registry.gitlab.com/bagage/batimap/ci-test-front
stage: test
cache:
untracked: true
paths:
- cache-ci/
before_script:
- yarn config set cache-folder cache-ci
script:
- cd front/
- yarn
- yarn lint
- yarn prettier --check
- yarn test --karma-config karma-ci.conf.js
artifacts:
reports:
junit: front/src/junit_karma.xml
only:
refs:
- merge_requests
changes:
- .gitlab-ci.yml
- front/**/*
test:back:
image: registry.gitlab.com/bagage/batimap/ci-test-back
stage: test
services:
- name: registry.gitlab.com/bagage/batimap/postgis
alias: postgis
- name: redis:5-alpine
alias: redis
variables:
POSTGRES_DB: testdb
POSTGRES_USER: test
POSTGRES_PASSWORD: "batimap"
POSTGRES_HOST_AUTH_METHOD: trust
POSTGRES_URI: postgresql://test:batimap@postgis:5432/testdb
REDIS_URI: redis://redis
before_script:
- cd back/
script:
- sed -i 's/psycopg2 =/psycopg2-binary =/' Pipfile
- pipenv install -d
- pipenv run pre-commit run --all-files --show-diff-on-failure
- pipenv run pytest --color=yes --junitxml=junit.xml --cov=batimap -v -rf --cov-report xml:coverage.xml --cov-report term:skip-covered --no-cov-on-fail && pipenv run coverage xml
artifacts:
reports:
coverage_report:
coverage_format: cobertura
path: back/coverage.xml
junit: back/junit.xml
paths:
- back/coverage.xml
- back/junit.xml
coverage: '/TOTAL.+?(\d+%)/'
only:
refs:
- merge_requests
changes:
- .gitlab-ci.yml
- back/**/*
.build_docker_image: &build_docker_image
image: docker:stable
services:
- docker:20.10.11-dind
stage: build
before_script:
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN registry.gitlab.com
script:
- docker build -t registry.gitlab.com/bagage/batimap/$CONTAINER:$CI_COMMIT_REF_SLUG -f ${BASE_DIR:-$CONTAINER}/$DOCKERFILE ${BASE_DIR:-$CONTAINER}
- |
if test $CI_COMMIT_REF_NAME = master; then
docker tag registry.gitlab.com/bagage/batimap/$CONTAINER:$CI_COMMIT_REF_SLUG registry.gitlab.com/bagage/batimap/$CONTAINER:latest
docker push registry.gitlab.com/bagage/batimap/$CONTAINER:latest
docker push registry.gitlab.com/bagage/batimap/$CONTAINER:$CI_COMMIT_REF_SLUG
fi
build:ci_test_front:
<<: *build_docker_image
only:
refs:
- merge_requests
- master
changes:
- .gitlab-ci.yml
- front/**/*
variables:
CONTAINER: ci-test-front
DOCKERFILE: Dockerfile.ci
BASE_DIR: front
build:ci_test_back:
<<: *build_docker_image
only:
refs:
- merge_requests
- master
changes:
- .gitlab-ci.yml
- back/**/*
variables:
CONTAINER: ci-test-back
DOCKERFILE: Dockerfile.ci
BASE_DIR: back
build:tiles-cleaner:
<<: *build_docker_image
only:
refs:
- merge_requests
- master
changes:
- .gitlab-ci.yml
- tiles-cleaner/**/*
variables:
CONTAINER: tiles-cleaner
DOCKERFILE: Dockerfile
build:postgis:
<<: *build_docker_image
only:
refs:
- merge_requests
- master
changes:
- .gitlab-ci.yml
- postgis/**/*
variables:
CONTAINER: postgis
DOCKERFILE: Dockerfile
build:imposm:
<<: *build_docker_image
only:
refs:
- merge_requests
- master
changes:
- .gitlab-ci.yml
- imposm/**/*
variables:
CONTAINER: imposm
DOCKERFILE: Dockerfile
build:imposm-watcher:
<<: *build_docker_image
only:
refs:
- merge_requests
- master
changes:
- .gitlab-ci.yml
- imposm-watcher/**/*
variables:
CONTAINER: imposm-watcher
DOCKERFILE: Dockerfile
build:back:
<<: *build_docker_image
only:
refs:
- merge_requests
- master
changes:
- .gitlab-ci.yml
- back/**/*
variables:
CONTAINER: back
DOCKERFILE: Dockerfile
build:tiles:
<<: *build_docker_image
only:
refs:
- merge_requests
- master
changes:
- .gitlab-ci.yml
- tiles/**/*
variables:
CONTAINER: tiles
DOCKERFILE: Dockerfile
build:front:
<<: *build_docker_image
only:
refs:
- merge_requests
- master
changes:
- .gitlab-ci.yml
- front/**/*
variables:
CONTAINER: front
DOCKERFILE: Dockerfile