This repository has been archived by the owner on Feb 21, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy path.gitlab-ci.yml
156 lines (138 loc) · 3.08 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
stages:
- test
- release
- staging
- ecole
- production
variables:
ANSIBLE_FORCE_COLOR: "1"
.deploy: &deploy
stage: staging
variables:
TIMEOUT: 1200
image: yourlabs/playlabs:master
script:
- playlabs git clone $INVENTORY_REPOSITORY
- playlabs deploy prefix=mrs instance=$CI_ENVIRONMENT_SLUG image=betagouv/mrs:$CI_COMMIT_SHA deploy@ --tags=update
.tox: &tox
stage: test
image: yourlabs/python
before_script:
- tar -xzf .gitlab-cache.tar.gz -C / || true
after_script:
- tar -czf .gitlab-cache.tar.gz /root/.cache/pip /root/.local || true
docker:
stage: test
image: docker:dind
before_script:
- echo $DOCKER_PASS | docker login -u $DOCKER_USER --password-stdin
script:
- docker build
--shm-size 512M
-t betagouv/mrs:$CI_COMMIT_SHA
--build-arg GIT_COMMIT=$CI_COMMIT_SHA
.
- docker push
betagouv/mrs:$CI_COMMIT_SHA
- docker tag
betagouv/mrs:$CI_COMMIT_SHA
betagouv/mrs:$CI_COMMIT_REF_NAME
- docker push
betagouv/mrs:$CI_COMMIT_REF_NAME
py-sec-bandit:
image: yourlabs/python
script: bandit -v -x commands,tests {posargs:-r src}
py-sec-safety:
image: yourlabs/python
script: safety check
py-qa:
image: yourlabs/python
script: ./sh.yml py.qa
py-test:
<<: *tox
cache:
paths: [.gitlab-cache.tar.gz]
key: ${CI_COMMIT_REF_SLUG}-django
services:
- postgres:10
script:
- DB_HOST=$POSTGRES_PORT_5432_TCP_ADDR
DB_USER=postgres
venv=none ./sh.yml py.test
js-qa:
stage: test
image: node:10
script:
- yarn install
- yarn run lint
js-test:
stage: test
image: node:10
script:
- yarn install
- yarn run test
- npm install -g codecov
- codecov
--token $CODECOV_TOKEN
-e $TOXENV
docs-qa:
<<: *tox
cache:
paths: [.gitlab-cache.tar.gz]
key: ${CI_COMMIT_REF_SLUG}-docs
script: tox --sitepackages -e docs
js-acceptance:
stage: release
image: betagouv/mrs:$CI_COMMIT_SHA
script:
- export HOST=localhost:8000
- DEBUG=1 mrs migrate
- echo 'from institution.models import Institution; Institution.objects.create(finess=310000000, origin="http://$HOST")' | DEBUG=1 mrs shell
- cd /app && DEBUG=1 mrs runserver $HOST &
- until curl $HOST; do sleep 1; done
- cd /app && node_modules/.bin/jest src/mrs/static/js/smoke.test.js
deploy-jpic:
<<: *deploy
only:
refs: [jpic]
environment:
name: jpic
url: https://jpic.mrs.yourlabs.org
deploy-tbinetruy:
<<: *deploy
only:
refs: [tbinetruy]
environment:
name: tbinetruy
url: https://tbinetruy.mrs.yourlabs.org
deploy-vince:
<<: *deploy
only:
refs: [vindarel]
environment:
name: vince
url: https://vince.mrs.yourlabs.org
deploy-staging:
<<: *deploy
only:
refs: [master]
environment:
name: staging
url: https://staging.mrs.beta.gouv.fr
deploy-ecole:
<<: *deploy
stage: ecole
only:
refs: [master]
environment:
name: ecole
url: https://ecole.mrs.beta.gouv.fr
deploy-production:
<<: *deploy
stage: production
when: manual
only:
refs: [master]
environment:
name: production
url: https://mrs.beta.gouv.fr