]> git.mxchange.org Git - friendica.git/blob - .drone.yml
Update .drone.yml
[friendica.git] / .drone.yml
1 kind: pipeline
2 type: docker
3 name: Check messages.po
4
5 steps:
6   - name: Run default Xgettext
7     image: friendicaci/transifex
8     commands:
9       - ./bin/run_xgettext.sh
10
11   - name: Check default
12     image: friendicaci/transifex
13     commands:
14       - /check-messages.sh
15 ---
16 kind: pipeline
17 type: docker
18 name: php7.3-lint
19
20 steps:
21   - name: Test
22     image: php:7.3
23     commands:
24       - ./bin/composer.phar run lint
25 ---
26 kind: pipeline
27 type: docker
28 name: php7.4-lint
29
30 steps:
31   - name: Test
32     image: php:7.4
33     commands:
34       - ./bin/composer.phar run lint
35 ---
36 kind: pipeline
37 type: docker
38 name: php8.0-lint
39
40 steps:
41   - name: Test
42     image: php:8.0
43     commands:
44       - ./bin/composer.phar run lint
45 ---
46 kind: pipeline
47 type: docker
48 name: php-cs check
49
50 trigger:
51   event:
52     - pull_request
53
54 steps:
55   - name: Restore cache
56     image: meltwater/drone-cache:dev
57     settings:
58       backend: "filesystem"
59       restore: true
60       cache_key: '{{ .Repo.Name }}_phpcs_{{ arch }}_{{ os }}'
61       archive_format: "gzip"
62       mount:
63         - '.composer'
64     volumes:
65       - name: cache
66         path: /tmp/cache
67   - name: Install dependencies
68     image: composer
69     commands:
70       - export COMPOSER_HOME=.composer
71       - ./bin/composer.phar run cs:install
72   - name: Rebuild cache
73     image: meltwater/drone-cache:dev
74     settings:
75       backend: "filesystem"
76       rebuild: true
77       cache_key: '{{ .Repo.Name }}_phpcs_{{ arch }}_{{ os }}'
78       archive_format: "gzip"
79       mount:
80         - '.composer'
81     volumes:
82       - name: cache
83         path: /tmp/cache
84   - name: Run coding standards check
85     image: friendicaci/php-cs
86     commands:
87       - export CHANGED_FILES="$(git diff --name-status ${DRONE_COMMIT_BEFORE}..${DRONE_COMMIT_AFTER} | grep ^A | cut -f2)"
88       - /check-php-cs.sh
89
90 volumes:
91   - name: cache
92     host:
93       path: /tmp/drone-cache
94 ---
95 kind: pipeline
96 type: docker
97 name: php7.3-mariadb
98
99 steps:
100   - name: Restore cache
101     image: meltwater/drone-cache:dev
102     settings:
103       backend: "filesystem"
104       restore: true
105       cache_key: '{{ .Repo.Name }}_php73_{{ arch }}_{{ os }}'
106       archive_format: "gzip"
107       mount:
108         - '.composer'
109     volumes:
110       - name: cache
111         path: /tmp/cache
112   - name: Composer install
113     image: friendicaci/php7.3:php7.3.28
114     commands:
115       - export COMPOSER_HOME=.composer
116       - ./bin/composer.phar validate
117       - ./bin/composer.phar install --prefer-dist
118   - name: Rebuild cache
119     image: meltwater/drone-cache:dev
120     settings:
121       backend: "filesystem"
122       rebuild: true
123       cache_key: '{{ .Repo.Name }}_php73_{{ arch }}_{{ os }}'
124       archive_format: "gzip"
125       mount:
126         - '.composer'
127     volumes:
128       - name: cache
129         path: /tmp/cache
130   - name: Test Friendica
131     image: friendicaci/php7.3:php7.3.28
132     environment:
133       MYSQL_HOST: "mariadb"
134       MYSQL_PORT: 3306
135       MYSQL_DATABASE: "test"
136       MYSQL_PASSWORD: "test"
137       MYSQL_USER: "test"
138       REDIS_HOST: "redis"
139       MEMCACHED_HOST: "memcached"
140       MEMCACHE_HOST: "memcached"
141     commands:
142       - cp config/local-sample.config.php config/local.config.php
143       - if ! bin/wait-for-connection $MYSQL_HOST $MYSQL_PORT 300; then echo "[ERROR] Waited 300 seconds, no response" >&2; exit 1; fi
144       - mysql -h$MYSQL_HOST -P$MYSQL_PORT -p$MYSQL_PASSWORD -u$MYSQL_USER $MYSQL_DATABASE < database.sql
145       - phpunit --configuration tests/phpunit.xml
146
147 services:
148   - name: mariadb
149     image: mariadb:latest
150     environment:
151       MYSQL_ALLOW_EMPTY_PASSWORD: "true"
152       MYSQL_DATABASE: "test"
153       MYSQL_PASSWORD: "test"
154       MYSQL_USER: "test"
155     tmpfs:
156       - /var/lib/mysql
157
158   - name: memcached
159     image: memcached
160
161   - name: redis
162     image: redis
163
164 volumes:
165   - name: cache
166     host:
167       path: /tmp/drone-cache
168 ---
169 kind: pipeline
170 type: docker
171 name: php7.4-mariadb
172
173 steps:
174   - name: Restore cache
175     image: meltwater/drone-cache:dev
176     settings:
177       backend: "filesystem"
178       restore: true
179       cache_key: '{{ .Repo.Name }}_php74_{{ arch }}_{{ os }}'
180       archive_format: "gzip"
181       mount:
182         - '.composer'
183     volumes:
184       - name: cache
185         path: /tmp/cache
186   - name: Composer install
187     image: friendicaci/php7.4:php7.4.18
188     commands:
189       - export COMPOSER_HOME=.composer
190       - ./bin/composer.phar validate
191       - ./bin/composer.phar install --prefer-dist
192   - name: Rebuild cache
193     image: meltwater/drone-cache:dev
194     settings:
195       backend: "filesystem"
196       rebuild: true
197       cache_key: '{{ .Repo.Name }}_php74_{{ arch }}_{{ os }}'
198       archive_format: "gzip"
199       mount:
200         - '.composer'
201     volumes:
202       - name: cache
203         path: /tmp/cache
204   - name: Test Friendica
205     image: friendicaci/php7.4:php7.4.18
206     environment:
207       MYSQL_HOST: "mariadb"
208       MYSQL_PORT: 3306
209       MYSQL_DATABASE: "test"
210       MYSQL_PASSWORD: "test"
211       MYSQL_USER: "test"
212       REDIS_HOST: "redis"
213       MEMCACHED_HOST: "memcached"
214       MEMCACHE_HOST: "memcached"
215       XDEBUG_MODE: "coverage"
216     commands:
217       - phpenmod xdebug
218       - cp config/local-sample.config.php config/local.config.php
219       - if ! bin/wait-for-connection $MYSQL_HOST $MYSQL_PORT 300; then echo "[ERROR] Waited 300 seconds, no response" >&2; exit 1; fi
220       - mysql -h$MYSQL_HOST -P$MYSQL_PORT -p$MYSQL_PASSWORD -u$MYSQL_USER $MYSQL_DATABASE < database.sql
221       - phpunit --configuration tests/phpunit.xml --coverage-clover clover.xml
222   - name: Codecov
223     image: plugins/codecov
224     when:
225       repo:
226         - friendica/friendica
227     settings:
228       token:
229         from_secret: codecov-token
230       files:
231         - clover.xml
232
233 services:
234   - name: mariadb
235     image: mariadb:latest
236     environment:
237       MYSQL_ALLOW_EMPTY_PASSWORD: "true"
238       MYSQL_DATABASE: "test"
239       MYSQL_PASSWORD: "test"
240       MYSQL_USER: "test"
241     tmpfs:
242       - /var/lib/mysql
243
244   - name: memcached
245     image: memcached
246
247   - name: redis
248     image: redis
249
250 volumes:
251   - name: cache
252     host:
253       path: /tmp/drone-cache
254 ---
255 kind: pipeline
256 type: docker
257 name: php8.0-mariadb
258
259 steps:
260   - name: Restore cache
261     image: meltwater/drone-cache:dev
262     settings:
263       backend: "filesystem"
264       restore: true
265       cache_key: '{{ .Repo.Name }}_php80_{{ arch }}_{{ os }}'
266       archive_format: "gzip"
267       mount:
268         - '.composer'
269     volumes:
270       - name: cache
271         path: /tmp/cache
272   - name: Composer install
273     image: friendicaci/php8.0:php8.0.5
274     commands:
275       - export COMPOSER_HOME=.composer
276       - ./bin/composer.phar validate
277       - ./bin/composer.phar install --prefer-dist
278   - name: Rebuild cache
279     image: meltwater/drone-cache:dev
280     settings:
281       backend: "filesystem"
282       rebuild: true
283       cache_key: '{{ .Repo.Name }}_php80_{{ arch }}_{{ os }}'
284       archive_format: "gzip"
285       mount:
286         - '.composer'
287     volumes:
288       - name: cache
289         path: /tmp/cache
290   - name: Test Friendica
291     image: friendicaci/php8.0:php8.0.5
292     environment:
293       MYSQL_HOST: "mariadb"
294       MYSQL_PORT: 3306
295       MYSQL_DATABASE: "test"
296       MYSQL_PASSWORD: "test"
297       MYSQL_USER: "test"
298       REDIS_HOST: "redis"
299       MEMCACHED_HOST: "memcached"
300       MEMCACHE_HOST: "memcached"
301     commands:
302       - cp config/local-sample.config.php config/local.config.php
303       - if ! bin/wait-for-connection $MYSQL_HOST $MYSQL_PORT 300; then echo "[ERROR] Waited 300 seconds, no response" >&2; exit 1; fi
304       - mysql -h$MYSQL_HOST -P$MYSQL_PORT -p$MYSQL_PASSWORD -u$MYSQL_USER $MYSQL_DATABASE < database.sql
305       - phpunit --configuration tests/phpunit.xml
306
307 services:
308   - name: mariadb
309     image: mariadb:latest
310     environment:
311       MYSQL_ALLOW_EMPTY_PASSWORD: "true"
312       MYSQL_DATABASE: "test"
313       MYSQL_PASSWORD: "test"
314       MYSQL_USER: "test"
315     tmpfs:
316       - /var/lib/mysql
317
318   - name: memcached
319     image: memcached
320
321   - name: redis
322     image: redis
323
324 volumes:
325   - name: cache
326     host:
327       path: /tmp/drone-cache
328 ---
329 kind: pipeline
330 type: docker
331 name: continuous-deployment
332
333 trigger:
334   repo:
335     - friendica/friendica
336   branch:
337     - develop
338     - 20*-rc
339   event:
340     - push
341
342 node:
343   node: releaser # This prevents executing this pipeline at other servers than drone.friendi.ca
344
345 steps:
346   - name: Clone addon
347     image: alpine/git
348     commands:
349       - git clone https://github.com/friendica/friendica-addons ./addon
350       - cd ./addon
351       - git checkout $DRONE_REPO_BRANCH
352   - name: Restore cache
353     image: meltwater/drone-cache:dev
354     settings:
355       backend: "filesystem"
356       restore: true
357       cache_key: '{{ .Repo.Name }}_php74_{{ arch }}_{{ os }}'
358       archive_format: "gzip"
359       mount:
360         - '.composer'
361     volumes:
362       - name: cache
363         path:
364           /tmp/cache
365   - name: Composer install
366     image: friendicaci/php7.4:php7.4.18
367     commands:
368       - export COMPOSER_HOME=.composer
369       - composer validate
370       - composer install --no-dev --optimize-autoloader
371   - name: Create artifacts
372     image: debian
373     commands:
374       - apt-get update
375       - apt-get install bzip2
376       - mkdir ./build
377       - export VERSION="$(cat VERSION)"
378       - # Create artifact
379       - export RELEASE="friendica-full-$VERSION"
380       - export ARTIFACT="$RELEASE.tar.gz"
381       - tar
382         --transform "s,^,$RELEASE/,"
383         -X mods/release-list-exclude.txt
384         -T mods/release-list-include.txt
385         -cvjf ./build/$ARTIFACT
386       - # calculate SHA256 checksum
387       - cd ./build
388       - sha256sum "$ARTIFACT" > "$ARTIFACT.sha256"
389       - ls -lh
390       - # output the sha256 sum for checking
391       - cat "$ARTIFACT.sha256"
392       - sha256sum "$ARTIFACT"
393   - name: Upload artifacts
394     image: alpine
395     environment:
396       LFTP_HOST:
397         from_secret: sftp_host
398       LFTP_USER:
399         from_secret: sftp_user
400       LFTP_KEY:
401         from_secret: ssh_key
402       LFTP_PORT: "22"
403       LFTP_SOURCE: "build"
404       LFTP_TARGET: "/http"
405     commands:
406       - apk add lftp openssh openssl
407       - touch drone.key
408       - chmod 400 drone.key
409       - echo "$LFTP_KEY" | openssl base64 -A -d > drone.key
410       - lftp -c "
411           set net:timeout 5;
412           set net:max-retries 2;
413           set net:reconnect-interval-base 5;
414           set sftp:auto-confirm true;
415           set sftp:connect-program 'ssh -q -a -x -i drone.key';
416           connect sftp://$LFTP_USER:@$LFTP_HOST:$LFTP_PORT;
417           cd $LFTP_TARGET;
418           mput $LFTP_SOURCE/*;
419         "
420       - rm drone.key
421
422 volumes:
423   - name: cache
424     host:
425       path: /tmp/drone-cache
426 ---
427 kind: pipeline
428 type: docker
429 name: release-deployment
430
431 trigger:
432   repo:
433     - friendica/friendica
434   branch:
435     - stable
436   event:
437     - tag
438
439 node:
440   node: releaser # This prevents executing this pipeline at other servers than drone.friendi.ca
441
442 steps:
443   - name: Clone addon
444     image: alpine/git
445     commands:
446       - git clone https://github.com/friendica/friendica-addons ./addon
447       - cd ./addon
448       - git checkout $DRONE_REPO_BRANCH
449   - name: Restore cache
450     image: meltwater/drone-cache:dev
451     settings:
452       backend: "filesystem"
453       restore: true
454       cache_key: '{{ .Repo.Name }}_php74_{{ arch }}_{{ os }}'
455       archive_format: "gzip"
456       mount:
457         - '.composer'
458     volumes:
459       - name: cache
460         path:
461           /tmp/cache
462   - name: Composer install
463     image: friendicaci/php7.4:php7.4.18
464     commands:
465       - export COMPOSER_HOME=.composer
466       - composer validate
467       - composer install --no-dev --optimize-autoloader
468   - name: Create artifacts
469     image: debian
470     commands:
471       - apt-get update
472       - apt-get install bzip2
473       - mkdir ./build
474       - export VERSION="$(cat VERSION)"
475       - mkdir ./build
476       - export VERSION="$(cat VERSION)"
477       - # Create artifact
478       - export RELEASE="friendica-full-$VERSION"
479       - export ARTIFACT="$RELEASE.tar.gz"
480       - tar
481         --transform "s,^,$RELEASE/,"
482         -X mods/release-list-exclude.txt
483         -T mods/release-list-include.txt
484         -cvjf ./build/$ARTIFACT
485       - # calculate SHA256 checksum
486       - cd ./build
487       - sha256sum "$ARTIFACT" > "$ARTIFACT.sha256"
488       - ls -lh
489       - # output the sha256 sum for checking
490       - cat "$ARTIFACT.sha256"
491       - sha256sum "$ARTIFACT"
492   - name: Upload artifacts
493     image: alpine
494     environment:
495       LFTP_HOST:
496         from_secret: sftp_host
497       LFTP_USER:
498         from_secret: sftp_user
499       LFTP_KEY:
500         from_secret: ssh_key
501       LFTP_PORT: "22"
502       LFTP_SOURCE: "build"
503       LFTP_TARGET: "/http"
504     commands:
505       - apk add lftp openssh openssl
506       - touch drone.key
507       - chmod 400 drone.key
508       - echo "$LFTP_KEY" | openssl base64 -A -d > drone.key
509       - lftp -c "
510         set net:timeout 5;
511         set net:max-retries 2;
512         set net:reconnect-interval-base 5;
513         set sftp:auto-confirm true;
514         set sftp:connect-program 'ssh -q -a -x -i drone.key';
515         connect sftp://$LFTP_USER:@$LFTP_HOST:$LFTP_PORT;
516         cd $LFTP_TARGET;
517         mput $LFTP_SOURCE/*;
518         "
519       - rm drone.key
520
521 volumes:
522   - name: cache
523     host:
524       path: /tmp/drone-cache