forked from devgeniem/wp-project
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.drone.yml
170 lines (142 loc) · 3.93 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
clone:
path: project
cache:
mount:
- /drone/.composer
- /drone/src/project/web/app/themes/THEMENAME/node_modules
# List needed services here
compose:
db:
image: mariadb
environment:
MYSQL_DATABASE: wordpress
MYSQL_USER: wordpress
MYSQL_PASSWORD: wordpress
MYSQL_RANDOM_ROOT_PASSWORD: 1
cache:
image: redis
web:
image: devgeniem/wordpress-server
pull: true
environment:
OVERRIDE_ROOT: /drone/src/project
# Run processes as wordpress:web with these permissions
WP_UID: 100
WP_GID: 101
WP_REDIS_HOST: 127.0.0.1
WP_ENV: testing
WP_HOME: http://wordpress.test
WP_SITEURL: http://wordpress.test
DB_HOST: 127.0.0.1
DB_PORT: 3306
DB_NAME: wordpress
DB_USER: wordpress
DB_PASSWORD: wordpress
SMTP_FROM: [email protected]
extra_hosts:
- "wordpress.test:127.0.0.1"
build:
image: devgeniem/wordpress-project-builder
pull: true
commands:
# Our container mountpoint is fixed into /var/www/project
# Symlink it to current directory
- rm -r /var/www/project
- mkdir -p /var/www
- ln -s $PWD /var/www/project
- echo "127.0.0.1 wordpress.test" >> /etc/hosts
# Enforce coding practises by style checks
- ./scripts/code-style.sh
# Install php dependencies
- ./scripts/install.sh
# Wait for mysql and Install WordPress
- ./scripts/seed.sh
# Run the tests
- ./scripts/test.sh
environment:
# Allow better caching of composer packages
COMPOSER_HOME: /drone/.composer
# Run processes as wordpress:web with these
WP_UID: 100
WP_GID: 101
WP_ENV: testing
WP_HOME: http://wordpress.test
WP_SITEURL: http://wordpress.test
# Drone maps service containers to localhost
# Use mariadb container for testing
# Use 127.0.0.1 over localhost because mysql will try socket instead if it's localhost
DB_HOST: 127.0.0.1
DB_PORT: 3306
DB_NAME: wordpress
DB_USER: wordpress
DB_PASSWORD: wordpress
SMTP_FROM: [email protected]
cache:
mount:
- /drone/.composer
##
# Change your slack url here
##
#notify:
# slack:
# webhook_url: YOUR_SLACK_URL_HERE
# channel: drone
# username: Drone CI
# template: |
# {{#success build.status}}
# <{{ repo.link_url }}|{{ repo.full_name }}>: {{ build.author }} pushed succesfully to {{ build.branch }} branch.
# {{else}}
# <{{ repo.link_url }}|{{ repo.full_name }}>: {{ build.author }} broke {{ build.branch }} branch :(. <{{ build.link_url }}|See results>
# {{/success}}
# Use master branch for testing
publish:
ecr:
access_key: "$$AWS_ACCESS_KEY"
secret_key: "$$AWS_SECRET_KEY"
region: eu-west-1
repo: devgeniem/PROJECTNAME
tag: master
file: Dockerfile
storage_driver: vfs
when:
branch: master
success: true
# Use stable branch for production
publish:
ecr:
access_key: "$$AWS_ACCESS_KEY"
secret_key: "$$AWS_SECRET_KEY"
region: eu-west-1
repo: devgeniem/PROJECTNAME
tag: stable
file: Dockerfile
storage_driver: vfs
when:
branch: stable
success: true
##
# Deploy site using consul events
##
deploy:
# Always deploy to staging servers
webhook:
debug: true
method: PUT
urls:
- http://test.api.service.consul/v1/event/fire/deploy
content_type: application/json
template: '{ "name": "{{repo.name}}", "commit": "{{build.commit}}", "timestamp": "{{build.started_at}}", "number": "{{build.number}}" }'
when:
branch: master
success: true
# Deploy stable branch into production
webhook:
debug: true
method: PUT
urls:
- http://production.api.service.consul/v1/event/fire/deploy
content_type: application/json
template: '{ "name": "{{repo.name}}", "commit": "{{build.commit}}", "timestamp": "{{build.started_at}}", "number": "{{build.number}}" }'
when:
branch: stable
success: true