]> git.mxchange.org Git - friendica.git/blob - .drone.yml
2021.09 CHANGELOG some work on translations has been done
[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 depends_on:
100   - php7.3-lint
101
102 steps:
103   - name: Restore cache
104     image: meltwater/drone-cache:dev
105     settings:
106       backend: "filesystem"
107       restore: true
108       cache_key: '{{ .Repo.Name }}_php73_{{ arch }}_{{ os }}'
109       archive_format: "gzip"
110       mount:
111         - '.composer'
112     volumes:
113       - name: cache
114         path: /tmp/cache
115   - name: Composer install
116     image: friendicaci/php7.3:php7.3.28
117     commands:
118       - export COMPOSER_HOME=.composer
119       - ./bin/composer.phar validate
120       - ./bin/composer.phar install --prefer-dist
121   - name: Rebuild cache
122     image: meltwater/drone-cache:dev
123     settings:
124       backend: "filesystem"
125       rebuild: true
126       cache_key: '{{ .Repo.Name }}_php73_{{ arch }}_{{ os }}'
127       archive_format: "gzip"
128       mount:
129         - '.composer'
130     volumes:
131       - name: cache
132         path: /tmp/cache
133   - name: Test Friendica
134     image: friendicaci/php7.3:php7.3.28
135     environment:
136       MYSQL_HOST: "mariadb"
137       MYSQL_PORT: 3306
138       MYSQL_DATABASE: "test"
139       MYSQL_PASSWORD: "test"
140       MYSQL_USER: "test"
141       REDIS_HOST: "redis"
142       MEMCACHED_HOST: "memcached"
143       MEMCACHE_HOST: "memcached"
144     commands:
145       - cp config/local-sample.config.php config/local.config.php
146       - if ! bin/wait-for-connection $MYSQL_HOST $MYSQL_PORT 300; then echo "[ERROR] Waited 300 seconds, no response" >&2; exit 1; fi
147       - mysql -h$MYSQL_HOST -P$MYSQL_PORT -p$MYSQL_PASSWORD -u$MYSQL_USER $MYSQL_DATABASE < database.sql
148       - phpunit --configuration tests/phpunit.xml
149
150 services:
151   - name: mariadb
152     image: mariadb:latest
153     environment:
154       MYSQL_ALLOW_EMPTY_PASSWORD: "true"
155       MYSQL_DATABASE: "test"
156       MYSQL_PASSWORD: "test"
157       MYSQL_USER: "test"
158     tmpfs:
159       - /var/lib/mysql
160
161   - name: memcached
162     image: memcached
163
164   - name: redis
165     image: redis
166
167 volumes:
168   - name: cache
169     host:
170       path: /tmp/drone-cache
171 ---
172 kind: pipeline
173 type: docker
174 name: php7.4-mariadb
175
176 depends_on:
177   - php7.4-lint
178
179 steps:
180   - name: Restore cache
181     image: meltwater/drone-cache:dev
182     settings:
183       backend: "filesystem"
184       restore: true
185       cache_key: '{{ .Repo.Name }}_php74_{{ arch }}_{{ os }}'
186       archive_format: "gzip"
187       mount:
188         - '.composer'
189     volumes:
190       - name: cache
191         path: /tmp/cache
192   - name: Composer install
193     image: friendicaci/php7.4:php7.4.18
194     commands:
195       - export COMPOSER_HOME=.composer
196       - ./bin/composer.phar validate
197       - ./bin/composer.phar install --prefer-dist
198   - name: Rebuild cache
199     image: meltwater/drone-cache:dev
200     settings:
201       backend: "filesystem"
202       rebuild: true
203       cache_key: '{{ .Repo.Name }}_php74_{{ arch }}_{{ os }}'
204       archive_format: "gzip"
205       mount:
206         - '.composer'
207     volumes:
208       - name: cache
209         path: /tmp/cache
210   - name: Test Friendica
211     image: friendicaci/php7.4:php7.4.18
212     environment:
213       MYSQL_HOST: "mariadb"
214       MYSQL_PORT: 3306
215       MYSQL_DATABASE: "test"
216       MYSQL_PASSWORD: "test"
217       MYSQL_USER: "test"
218       REDIS_HOST: "redis"
219       MEMCACHED_HOST: "memcached"
220       MEMCACHE_HOST: "memcached"
221       XDEBUG_MODE: "coverage"
222     commands:
223       - phpenmod xdebug
224       - cp config/local-sample.config.php config/local.config.php
225       - if ! bin/wait-for-connection $MYSQL_HOST $MYSQL_PORT 300; then echo "[ERROR] Waited 300 seconds, no response" >&2; exit 1; fi
226       - mysql -h$MYSQL_HOST -P$MYSQL_PORT -p$MYSQL_PASSWORD -u$MYSQL_USER $MYSQL_DATABASE < database.sql
227       - phpunit --configuration tests/phpunit.xml --coverage-clover clover.xml
228   - name: Codecov
229     image: plugins/codecov
230     when:
231       repo:
232         - friendica/friendica
233     settings:
234       token:
235         from_secret: codecov-token
236       files:
237         - clover.xml
238
239 services:
240   - name: mariadb
241     image: mariadb:latest
242     environment:
243       MYSQL_ALLOW_EMPTY_PASSWORD: "true"
244       MYSQL_DATABASE: "test"
245       MYSQL_PASSWORD: "test"
246       MYSQL_USER: "test"
247     tmpfs:
248       - /var/lib/mysql
249
250   - name: memcached
251     image: memcached
252
253   - name: redis
254     image: redis
255
256 volumes:
257   - name: cache
258     host:
259       path: /tmp/drone-cache
260 ---
261 kind: pipeline
262 type: docker
263 name: php8.0-mariadb
264
265 depends_on:
266   - php8.0-lint
267
268 steps:
269   - name: Restore cache
270     image: meltwater/drone-cache:dev
271     settings:
272       backend: "filesystem"
273       restore: true
274       cache_key: '{{ .Repo.Name }}_php80_{{ arch }}_{{ os }}'
275       archive_format: "gzip"
276       mount:
277         - '.composer'
278     volumes:
279       - name: cache
280         path: /tmp/cache
281   - name: Composer install
282     image: friendicaci/php8.0:php8.0.5
283     commands:
284       - export COMPOSER_HOME=.composer
285       - ./bin/composer.phar validate
286       - ./bin/composer.phar install --prefer-dist
287   - name: Rebuild cache
288     image: meltwater/drone-cache:dev
289     settings:
290       backend: "filesystem"
291       rebuild: true
292       cache_key: '{{ .Repo.Name }}_php80_{{ arch }}_{{ os }}'
293       archive_format: "gzip"
294       mount:
295         - '.composer'
296     volumes:
297       - name: cache
298         path: /tmp/cache
299   - name: Test Friendica
300     image: friendicaci/php8.0:php8.0.5
301     environment:
302       MYSQL_HOST: "mariadb"
303       MYSQL_PORT: 3306
304       MYSQL_DATABASE: "test"
305       MYSQL_PASSWORD: "test"
306       MYSQL_USER: "test"
307       REDIS_HOST: "redis"
308       MEMCACHED_HOST: "memcached"
309       MEMCACHE_HOST: "memcached"
310     commands:
311       - cp config/local-sample.config.php config/local.config.php
312       - if ! bin/wait-for-connection $MYSQL_HOST $MYSQL_PORT 300; then echo "[ERROR] Waited 300 seconds, no response" >&2; exit 1; fi
313       - mysql -h$MYSQL_HOST -P$MYSQL_PORT -p$MYSQL_PASSWORD -u$MYSQL_USER $MYSQL_DATABASE < database.sql
314       - phpunit --configuration tests/phpunit.xml
315
316 services:
317   - name: mariadb
318     image: mariadb:latest
319     environment:
320       MYSQL_ALLOW_EMPTY_PASSWORD: "true"
321       MYSQL_DATABASE: "test"
322       MYSQL_PASSWORD: "test"
323       MYSQL_USER: "test"
324     tmpfs:
325       - /var/lib/mysql
326
327   - name: memcached
328     image: memcached
329
330   - name: redis
331     image: redis
332
333 volumes:
334   - name: cache
335     host:
336       path: /tmp/drone-cache
337 ---
338 kind: pipeline
339 type: docker
340 name: continuous-deployment
341
342 depends_on:
343   - php7.3-mariadb
344   - php7.4-mariadb
345   - php8.0-mariadb
346
347 trigger:
348   repo:
349     - friendica/friendica
350   branch:
351     - develop
352     - 20*-rc
353   event:
354     - push
355
356 node:
357   node: releaser # This prevents executing this pipeline at other servers than drone.friendi.ca
358
359 steps:
360   - name: Restore cache
361     image: meltwater/drone-cache:dev
362     settings:
363       backend: "filesystem"
364       restore: true
365       cache_key: '{{ .Repo.Name }}_php74_{{ arch }}_{{ os }}'
366       archive_format: "gzip"
367       mount:
368         - '.composer'
369     volumes:
370       - name: cache
371         path:
372           /tmp/cache
373   - name: Composer install
374     image: friendicaci/php7.4:php7.4.18
375     commands:
376       - export COMPOSER_HOME=.composer
377       - composer validate
378       - composer install --no-dev --optimize-autoloader
379   - name: Create artifacts
380     image: debian
381     commands:
382       - apt-get update
383       - apt-get install bzip2
384       - mkdir ./build
385       - export VERSION="$(cat VERSION)"
386       - # Create artifact
387       - export RELEASE="friendica-full-$VERSION"
388       - export ARTIFACT="$RELEASE.tar.gz"
389       - tar
390         --transform "s,^,$RELEASE/,"
391         -X mods/release-list-exclude.txt
392         -T mods/release-list-include.txt
393         -cvzf ./build/$ARTIFACT
394       - # calculate SHA256 checksum
395       - cd ./build
396       - sha256sum "$ARTIFACT" > "$ARTIFACT.sum256"
397       - ls -lh
398       - # output the sha256 sum for checking
399       - cat "$ARTIFACT.sum256"
400       - sha256sum "$ARTIFACT"
401   - name: Sign artifacts
402     image: plugins/gpgsign
403     settings:
404       key:
405         from_secret: gpg_key
406       passphrase:
407         from_secret: gpg_password
408       files:
409         - build/*
410       exclude:
411         - build/*.sum256
412       detach_sign: true
413   - name: Upload artifacts
414     image: alpine
415     environment:
416       LFTP_HOST:
417         from_secret: sftp_host
418       LFTP_USER:
419         from_secret: sftp_user
420       LFTP_KEY:
421         from_secret: ssh_key
422       LFTP_PORT: "22"
423       LFTP_SOURCE: "build"
424       LFTP_TARGET: "/http"
425     commands:
426       - apk add lftp openssh openssl
427       - touch drone.key
428       - chmod 400 drone.key
429       - echo "$LFTP_KEY" | openssl base64 -A -d > drone.key
430       - lftp -c "
431           set net:timeout 5;
432           set net:max-retries 2;
433           set net:reconnect-interval-base 5;
434           set sftp:auto-confirm true;
435           set sftp:connect-program 'ssh -q -a -x -i drone.key';
436           connect sftp://$LFTP_USER:@$LFTP_HOST:$LFTP_PORT;
437           cd $LFTP_TARGET;
438           mput $LFTP_SOURCE/*;
439         "
440       - rm drone.key
441
442 volumes:
443   - name: cache
444     host:
445       path: /tmp/drone-cache
446 ---
447 kind: pipeline
448 type: docker
449 name: release-deployment
450
451 depends_on:
452   - php7.3-mariadb
453   - php7.4-mariadb
454   - php8.0-mariadb
455
456 trigger:
457   repo:
458     - friendica/friendica
459   branch:
460     - stable
461   event:
462     - tag
463
464 node:
465   node: releaser # This prevents executing this pipeline at other servers than drone.friendi.ca
466
467 steps:
468   - name: Restore cache
469     image: meltwater/drone-cache:dev
470     settings:
471       backend: "filesystem"
472       restore: true
473       cache_key: '{{ .Repo.Name }}_php74_{{ arch }}_{{ os }}'
474       archive_format: "gzip"
475       mount:
476         - '.composer'
477     volumes:
478       - name: cache
479         path:
480           /tmp/cache
481   - name: Composer install
482     image: friendicaci/php7.4:php7.4.18
483     commands:
484       - export COMPOSER_HOME=.composer
485       - composer validate
486       - composer install --no-dev --optimize-autoloader
487   - name: Create artifacts
488     image: debian
489     commands:
490       - apt-get update
491       - apt-get install bzip2
492       - mkdir ./build
493       - export VERSION="$(cat VERSION)"
494       - # Create artifact
495       - export RELEASE="friendica-full-$VERSION"
496       - export ARTIFACT="$RELEASE.tar.gz"
497       - tar
498         --transform "s,^,$RELEASE/,"
499         -X mods/release-list-exclude.txt
500         -T mods/release-list-include.txt
501         -cvzf ./build/$ARTIFACT
502       - # calculate SHA256 checksum
503       - cd ./build
504       - sha256sum "$ARTIFACT" > "$ARTIFACT.sum256"
505       - ls -lh
506       - # output the sha256 sum for checking
507       - cat "$ARTIFACT.sum256"
508       - sha256sum "$ARTIFACT"
509   - name: Sign artifacts
510     image: plugins/gpgsign
511     settings:
512       key:
513         from_secret: gpg_key
514       passphrase:
515         from_secret: gpg_password
516       files:
517         - build/*
518       exclude:
519         - build/*.sum256
520       detach_sign: true
521   - name: Upload artifacts
522     image: alpine
523     environment:
524       LFTP_HOST:
525         from_secret: sftp_host
526       LFTP_USER:
527         from_secret: sftp_user
528       LFTP_KEY:
529         from_secret: ssh_key
530       LFTP_PORT: "22"
531       LFTP_SOURCE: "build"
532       LFTP_TARGET: "/http"
533     commands:
534       - apk add lftp openssh openssl
535       - touch drone.key
536       - chmod 400 drone.key
537       - echo "$LFTP_KEY" | openssl base64 -A -d > drone.key
538       - lftp -c "
539         set net:timeout 5;
540         set net:max-retries 2;
541         set net:reconnect-interval-base 5;
542         set sftp:auto-confirm true;
543         set sftp:connect-program 'ssh -q -a -x -i drone.key';
544         connect sftp://$LFTP_USER:@$LFTP_HOST:$LFTP_PORT;
545         cd $LFTP_TARGET;
546         mput $LFTP_SOURCE/*;
547         "
548       - rm drone.key
549
550 volumes:
551   - name: cache
552     host:
553       path: /tmp/drone-cache