forked from dotkom/onlineweb4
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.drone.yml
218 lines (203 loc) · 5.13 KB
/
.drone.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
kind: pipeline
type: docker
name: default
steps:
- name: restore-cache
image: plugins/s3-cache
settings:
pull: true
root:
from_secret: s3_bucket_name
access_key:
from_secret: s3_access_key
secret_key:
from_secret: s3_secret_key
restore: true
- name: setup
image: registry.online.ntnu.no/dotkom/onlineweb4-testbase:3.7
environment:
PIP_CACHE_DIR: ./.pip-cache
pull: true
volumes:
- name: python-dependencies
path: /usr/local/lib/python3.7/site-packages
- name: binaries
path: /usr/local/bin
when:
event:
- push
commands:
- cp onlineweb4/settings/example-local.py onlineweb4/settings/local.py
- yarn install --pure-lockfile
- poetry export -f requirements.txt > requirements.txt --dev -E prod --without-hashes
- poetry install --no-interaction --no-ansi
depends_on:
- restore-cache
- name: npm-build
image: registry.online.ntnu.no/dotkom/onlineweb4-testbase:3.7
when:
event:
- push
commands:
- npm run build:prod
depends_on:
- setup
- name: js-lint
image: registry.online.ntnu.no/dotkom/onlineweb4-testbase:3.7
when:
event:
- push
commands:
- npm run lint-js
depends_on:
- setup
- name: less-lint
image: registry.online.ntnu.no/dotkom/onlineweb4-testbase:3.7
when:
event:
- push
commands:
- npm run lint-less
depends_on:
- setup
- name: python-lint
image: registry.online.ntnu.no/dotkom/onlineweb4-testbase:3.7
volumes:
- name: python-dependencies
path: /usr/local/lib/python3.7/site-packages
- name: binaries
path: /usr/local/bin
when:
event:
- push
commands:
- tox -e flake8 -e isort -e black --recreate
depends_on:
- setup
- name: check-migrations
image: registry.online.ntnu.no/dotkom/onlineweb4-testbase:3.7
when:
event:
- push
volumes:
- name: python-dependencies
path: /usr/local/lib/python3.7/site-packages
commands:
- python manage.py makemigrations --check
depends_on:
- setup
- name: python-tests
image: registry.online.ntnu.no/dotkom/onlineweb4-testbase:3.7
secrets:
- codecov_token
volumes:
- name: python-dependencies
path: /usr/local/lib/python3.7/site-packages
- name: binaries
path: /usr/local/bin
environment:
PIP_CACHE_DIR: ./.pip-cache
CODECOV_TOKEN:
from_secret: codecov_token
OW4_DJANGO_STRIPE_PUBLIC_KEY_ARRKOM:
from_secret: OW4_DJANGO_STRIPE_PUBLIC_KEY_ARRKOM
OW4_DJANGO_STRIPE_PUBLIC_KEY_PROKOM:
from_secret: OW4_DJANGO_STRIPE_PUBLIC_KEY_PROKOM
OW4_DJANGO_STRIPE_PUBLIC_KEY_TRIKOM:
from_secret: OW4_DJANGO_STRIPE_PUBLIC_KEY_TRIKOM
OW4_DJANGO_STRIPE_PRIVATE_KEY_ARRKOM:
from_secret: OW4_DJANGO_STRIPE_PRIVATE_KEY_ARRKOM
OW4_DJANGO_STRIPE_PRIVATE_KEY_PROKOM:
from_secret: OW4_DJANGO_STRIPE_PRIVATE_KEY_PROKOM
OW4_DJANGO_STRIPE_PRIVATE_KEY_TRIKOM:
from_secret: OW4_DJANGO_STRIPE_PRIVATE_KEY_TRIKOM
when:
event:
- push
commands:
- pip install codecov
- tox -e tests --recreate
- codecov
depends_on:
- setup
- name: update-requires.io
image: registry.online.ntnu.no/dotkom/onlineweb4-testbase:3.7
environment:
PIP_CACHE_DIR: ./.pip-cache
REQUIRES_IO_API_KEY:
from_secret: REQUIRES_IO_API_KEY
when:
event:
- push
script:
- pip install requires.io
- poetry export -f requirements.txt > requirements.txt --dev -E prod -E docs --without-hashes
- requires.io update-branch -t $REQUIRES_IO_API_KEY -r onlineweb4 -n ${DRONE_BRANCH} ./
depends_on:
- setup
- name: rebuild-cache
image: plugins/s3-cache
settings:
pull: true
root:
from_secret: s3_bucket_name
access_key:
from_secret: s3_access_key
secret_key:
from_secret: s3_secret_key
rebuild: true
mount:
- .tox
- node_modules
- .pip-cache
when:
event: push
depends_on:
- python-lint
- python-tests
- name: flush-cache
image: plugins/s3-cache:1
settings:
pull: true
root:
from_secret: s3_bucket_name
access_key:
from_secret: s3_access_key
secret_key:
from_secret: s3_secret_key
flush: true
flush_age: 14
depends_on:
- rebuild-cache
- name: deploy
image: appleboy/drone-ssh
pull: true
secrets:
- ssh_key
when:
event:
- push
branch: develop
settings:
host: nansen.online.ntnu.no
port: 22
username: root
key:
from_secret: ssh_key
command_timeout: 600s
script:
- /srv/www/ow4dev/deploy.sh
depends_on:
- npm-build
- js-lint
- less-lint
- python-lint
- python-tests
- check-migrations
volumes:
- name: python-dependencies
temp: {}
- name: binaries
temp: {}
image_pull_secrets:
- dockerconfigjson