This repository has been archived by the owner on Feb 23, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
.drone.yml
160 lines (141 loc) · 3.77 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
# Anchors
when_pr_push: &when_pr_push
when:
event:
- push
- pull_request
docker-compose: &docker-compose
<<: *when_pr_push
image: docker/compose:1.22.0
volumes:
- /var/run/docker.sock:/var/run/docker.sock
test: &test
<<: *when_pr_push
image: fidals/stb:dev
environment:
- TEST_ENV=true
- DJANGO_SETTINGS_MODULE=stroyprombeton.settings.dev
- 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
# Hardcoded env values because of drone secret's bug. See stb#263
- SELENIUM_TIMEOUT_SECONDS=300
- SELENIUM_WAIT_SECONDS=300
lint: &lint
<<: *when_pr_push
group: lint
service: &service
<<: *when_pr_push
group: service
# CI config
branches: [ master ]
workspace:
base: /drone
path: stroyprombeton/
pipeline:
nodejs-build: # with `npm install` inside
<<: *docker-compose
commands:
- cd docker/
# 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 --no-cache nodejs
gulp-build:
<<: *when_pr_push
image: fidals/stb-nodejs:dev
commands:
- cp -r /usr/app/src/node_modules .
- gulp build
python-build:
<<: *docker-compose
commands:
- cd docker/
# Build python images with sources and static files
- docker-compose -f docker-compose-build.yml build python-dev python-prod
fast-test:
<<: *test
commands:
- python manage.py collectstatic --noinput
- python manage.py test --parallel --tag fast -k
slow-test:
<<: *test
commands:
- python manage.py collectstatic --noinput
- python manage.py test --parallel --tag slow -k --rerun-failed 2 --verbosity 3
lint-coala:
<<: *lint
image: fidals/coala-ci
commands:
- coala --ci -j 2
lint-pdd:
<<: *lint
image: fidals/pdd-ci
commands:
- pdd --verbose
--exclude=node_modules/**/* --exclude=static/**/*
--exclude=media/**/*
--exclude=.idea/**/*
--exclude=front_build
--exclude=front/images
--exclude=**/*.pyc
--exclude=**/*.jpg
-f report.xml
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/stb-nodejs:dev
- docker push fidals/stb:dev
- docker push fidals/stb:prod
volumes:
- /var/run/docker.sock:/var/run/docker.sock
secrets: [ DOCKER_HUB_LOGIN, DOCKER_HUB_PASSWORD ]
when:
event: push
docker-up:
<<: *docker-compose
commands:
- cd docker/
- cp drone_env/* env_files/
- cp drone_env/.env .
- docker-compose up -d app
- docker-compose stop
docker-rm:
<<: *docker-compose
commands:
- cd docker/
- cp drone_env/* env_files/
- cp drone_env/.env .
- docker-compose rm -fs
when:
status: [ success, failure ]
event: [push, pull_request]
services:
postgres:
<<: *service
image: postgres:9.5
environment:
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=test
- POSTGRES_DB=test
rabbitmq:
<<: *service
image: rabbitmq
environment:
- RABBITMQ_DEFAULT_USER=rabbitmq
- RABBITMQ_DEFAULT_PASS=test
selenium:
<<: *service
image: selenium/standalone-chrome:3.141.59
volumes: # https://github.com/SeleniumHQ/docker-selenium#running-the-images
- /dev/shm:/dev/shm