-
-
Notifications
You must be signed in to change notification settings - Fork 27
/
.drone.yml
207 lines (194 loc) · 5.75 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
kind: pipeline
name: default
steps:
- name: composer
image: knik/php:7.3-fpm-stretch
commands:
- apt -y update && apt install -y git
- curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
- composer install --no-ansi
- touch composer_installed
- name: npm
image: node
commands:
- node --version
- npm install
- npm run prod
- name: tests
image: knik/php:7.3-fpm-stretch
environment:
APP_KEY: base64:QhlU2DzlLyaYVHzlh3RlSipTtBhwb3/5jPKbctx2lP8=
APP_DEBUG: true
APP_ENV: local
APP_ALLOW_REGISTRATION: true
DB_CONNECTION: mysql
DB_HOST: db
DB_PORT: 3306
DB_DATABASE: homestead
DB_USERNAME: homestead
DB_PASSWORD: secret
commands:
- php artisan migrate:fresh --seed
- vendor/bin/phpunit --verbose
- rm -rf storage/app/certs
- rm -rf storage/framework/cache/data/*
- rm -rf storage/framework/sessions/*
- rm -rf storage/framework/views/*
- rm -rf storage/debugbar/*
- rm -rf storage/logs/*
- name: browser-tests
image: knik/php:7.3-fpm-buster
environment:
SELENIUM_URL: http://selenium:4444/wd/hub
APP_KEY: base64:QhlU2DzlLyaYVHzlh3RlSipTtBhwb3/5jPKbctx2lP8=
APP_DEBUG: true
APP_ENV: local
APP_ALLOW_REGISTRATION: true
DB_CONNECTION: mysql
DB_HOST: db
DB_PORT: 3306
DB_DATABASE: homestead
DB_USERNAME: homestead
DB_PASSWORD: secret
APP_URL: http://webserver
commands:
- ./artisan migrate:fresh --seed
- ./artisan dusk --debug
- rm -rf storage/app/certs
- rm -rf storage/framework/cache/data/*
- rm -rf storage/framework/sessions/*
- rm -rf storage/framework/views/*
- rm -rf storage/debugbar/*
- rm -rf storage/logs/*
volumes:
- name: daemon_logs
path: /var/log/gameap-daemon
- name: composer-production
image: knik/php:7.3-fpm-stretch
commands:
- curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
- composer install --no-dev --optimize-autoloader --no-ansi
- rm composer_installed
when:
branch:
- master
- name: archive
image: debian:buster
commands:
- apt update && apt -y install rsync
- mkdir gameap
- rsync -rl --exclude=/gameap --exclude=/node_modules ./ gameap/
- mkdir "publish"
- tar czf "publish/gameap-3.0.0-beta.tar.gz" "gameap"
when:
branch:
- master
- name: archive-shared
image: knik/php:7.3-fpm-stretch
environment:
APP_KEY: base64:QhlU2DzlLyaYVHzlh3RlSipTtBhwb3/5jPKbctx2lP8=
APP_DEBUG: true
APP_ENV: local
APP_ALLOW_REGISTRATION: true
DB_CONNECTION: mysql
DB_HOST: db
DB_PORT: 3306
DB_DATABASE: homestead
DB_USERNAME: homestead
DB_PASSWORD: secret
APP_URL: http://webserver
commands:
- apt update && apt -y install default-mysql-client zip unzip rsync
- rm -rf storage/app/certs
- rm -rf storage/framework/cache/data/*
- rm -rf storage/framework/sessions/*
- rm -rf storage/framework/views/*
- rm -rf storage/debugbar/*
- rm -rf storage/logs/*
- mkdir -p gameap-shared/upload
- php artisan migrate:fresh --seed --force
- mysqldump -h db -u homestead -p --password=secret homestead > gameap.sql
- curl -O http://packages.gameap.ru/gameap/shared-build-artifacts.zip
- rsync -rl --exclude=/gameap --exclude=/node_modules --exclude=/publish --exclude=/shared-build-artifacts.zip ./ gameap-shared/upload/
- unzip -o shared-build-artifacts.zip -d gameap-shared
- cd gameap-shared
&& mv upload/gameap.sql gameap.sql
&& zip -r "../publish/gameap-3.0.0-beta-shared.zip" ./
when:
branch:
- master
- name: publish
image: cschlosser/drone-ftps
environment:
FTP_USERNAME:
from_secret: ftp_username
FTP_PASSWORD:
from_secret: ftp_password
settings:
hostname: packages.gameap.ru:21
secrets: [ ftp_username, ftp_password ]
secure: false
src_dir: /publish
dest_dir: /gameap
chmod: false
include:
- ^.*tar\.gz$
- ^.*zip$
when:
branch:
- master
- name: artifacts
image: knik/drone-s3-plugin
failure: ignore
settings:
endpoint:
from_secret: s3_endpoint
bucket: gameap-drone-tests
access_key:
from_secret: s3_access_key
secret_key:
from_secret: s3_secret_key
source:
- tests/Browser/screenshots/*
- tests/Browser/console/*
- storage/logs/*
- /var/log/gameap-daemon/*
target: /${DRONE_BRANCH}/${DRONE_BUILD_NUMBER}
path_style: true
volumes:
- name: daemon_logs
path: /var/log/gameap-daemon
when:
status:
- failure
services:
- name: db
image: mysql:5.6
environment:
MYSQL_ROOT_PASSWORD: userpass
MYSQL_DATABASE: homestead
MYSQL_USER: homestead
MYSQL_PASSWORD: secret
- name: webserver
image: knik/php:7.4-cli-alpine
environment:
APP_KEY: base64:QhlU2DzlLyaYVHzlh3RlSipTtBhwb3/5jPKbctx2lP8=
APP_DEBUG: true
APP_ENV: local
APP_ALLOW_REGISTRATION: true
DB_CONNECTION: mysql
DB_HOST: db
DB_PORT: 3306
DB_DATABASE: homestead
DB_USERNAME: homestead
DB_PASSWORD: secret
commands:
- while [[ ! -f composer_installed ]]; do sleep 2; echo "Waiting composer..."; done;
- ./artisan serve --host=webserver --port=80
- name: selenium
image: selenium/standalone-chrome:3.141.59-zirconium
environment:
HUB_PORT: 4444
volumes:
- name: daemon_logs
temp: {}