-
Notifications
You must be signed in to change notification settings - Fork 5
/
.drone.yml
182 lines (165 loc) · 5.15 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
branches: master
workspace:
base: /drone
path: shopelectro/
pipeline:
nodejs-build: # with `npm install` inside
image: docker/compose:1.22.0
commands:
- cd docker/
- cp drone_env/.env . && cp drone_env/* env_files/
# nodejs build is not in `docker-build` section,
# because we have this deps:
# build nodejs -> gulp build -> build python-prod
- docker-compose -f docker-compose-build.yml build nodejs
volumes:
- /var/run/docker.sock:/var/run/docker.sock
when:
event: [push, pull_request]
gulp-build:
image: fidals/se-nodejs:dev
environment:
# deps from nodejs image
- DEPS_DIR=/usr/app/deps
commands:
- cp -r /usr/app/src/node_modules .
- gulp build
when:
event: [push, pull_request]
python-build:
image: docker/compose:1.22.0
commands:
- cd docker/
# Build python images with sources and static files
- docker-compose -f docker-compose-build.yml build python-dev python-prod
volumes:
- /var/run/docker.sock:/var/run/docker.sock
when:
event: [push, pull_request]
test:
image: fidals/se:dev
secrets: [ FTP_IP, FTP_USER, FTP_PASS, SELENIUM_WAIT_SECONDS, SELENIUM_TIMEOUT_SECONDS ]
environment:
- TEST_ENV=true
- DJANGO_SETTINGS_MODULE=shopelectro.settings.drone
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=test
- POSTGRES_URL=postgres
- POSTGRES_DB=test
- RABBITMQ_DEFAULT_USER=rabbitmq
- RABBITMQ_DEFAULT_PASS=test
- RABBITMQ_URL=rabbitmq
- RABBITMQ_PORT=5672
- SELENIUM_URL=http://selenium:4444/wd/hub
- FTP_IP=${FTP_IP}
- FTP_USER=${FTP_USER}
- FTP_PASS=${FTP_PASS}
- SELENIUM_WAIT_SECONDS=${SELENIUM_WAIT_SECONDS}
- SELENIUM_TIMEOUT_SECONDS=${SELENIUM_TIMEOUT_SECONDS}
commands:
- python manage.py migrate
- python manage.py excel
- python manage.py price
- python manage.py collectstatic --noinput
- python manage.py test --parallel --liveserver=test:8021-8029
when:
event: [push, pull_request]
lint-coala:
image: fidals/coala-ci
group: lint
commands:
- coala --ci -j 2
when:
event: pull_request
lint-pdd:
image: fidals/pdd-ci
group: lint
commands:
- pdd --verbose
--exclude=node_modules/**/*
--exclude=static/**/*
--exclude=venv/**/*
--exclude=media/**/*
--exclude=.idea/**/*
--exclude=front_build
--exclude=front/images
--exclude=**/*.pyc
--exclude=**/*.jpg
-f report.xml
when:
event: pull_request
docker-push:
image: docker:latest
environment:
- DOCKER_HUB_LOGIN=${DOCKER_HUB_LOGIN}
- DOCKER_HUB_PASSWORD=${DOCKER_HUB_PASSWORD}
commands:
- docker login -u $DOCKER_HUB_LOGIN -p $DOCKER_HUB_PASSWORD
- docker push fidals/se-nodejs:dev
- docker push fidals/se:dev
- docker push fidals/se:prod
volumes:
- /var/run/docker.sock:/var/run/docker.sock
when:
event: push
secrets: [ DOCKER_HUB_LOGIN, DOCKER_HUB_PASSWORD ]
docker-up:
image: docker/compose:1.22.0
environment:
- DJANGO_SETTINGS_MODULE=shopelectro.settings.drone
commands:
- cd docker
- cp drone_env/* env_files/
- for x in drone_env/*; do cat $x >> .env; done;
- docker-compose up -d app-drone
- docker-compose exec -T app-drone docker/wait-for.sh postgres:5432 -- python manage.py migrate
- docker-compose exec -T app-drone python manage.py custom_pages
# - docker-compose exec -T app-drone docker/wait-for.sh localhost:8000 -- docker/check-health.sh localhost:8000
# @todo #534:60m Fix CI's error for docker-up pipe.
# Any of below commands returns this: "/bin/sh: syntax error: unterminated quoted string"
# docker-compose exec -T app-drone nc -z google.com 80 > /dev/null 2>&1
# docker-compose exec -T app-drone wget google.com
# docker-compose exec -T app-drone docker/check-health.sh localhost:8000
volumes:
- /var/run/docker.sock:/var/run/docker.sock
when:
event: [push, pull_request]
docker-rm:
image: docker/compose:1.22.0
commands:
- cd docker
- docker-compose logs app-drone
- docker-compose rm -fs
volumes:
- /var/run/docker.sock:/var/run/docker.sock
when:
status: [ success, failure ]
event: [push, pull_request]
services:
postgres:
image: postgres
environment:
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=test
- POSTGRES_DB=test
when:
event: [push, pull_request]
rabbitmq:
image: rabbitmq
environment:
- RABBITMQ_DEFAULT_USER=rabbitmq
- RABBITMQ_DEFAULT_PASS=test
when:
event: [push, pull_request]
selenium:
image: selenium/standalone-chrome-debug:3.10.0
environment:
# https://github.com/SeleniumHQ/docker-selenium/issues/392
- DBUS_SESSION_BUS_ADDRESS=/dev/null
- SCREEN_WIDTH=1366
- SCREEN_HEIGHT=768
shm_size: 4G
volumes: # https://github.com/SeleniumHQ/docker-selenium#running-the-images
- /dev/shm:/dev/shm
when:
event: [push, pull_request]