]> git.mxchange.org Git - friendica.git/blob - .drone.yml
Remove all traces of "rino"
[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: Restore cache
347     image: meltwater/drone-cache:dev
348     settings:
349       backend: "filesystem"
350       restore: true
351       cache_key: '{{ .Repo.Name }}_php74_{{ arch }}_{{ os }}'
352       archive_format: "gzip"
353       mount:
354         - '.composer'
355     volumes:
356       - name: cache
357         path:
358           /tmp/cache
359   - name: Composer install
360     image: friendicaci/php7.4:php7.4.18
361     commands:
362       - export COMPOSER_HOME=.composer
363       - composer validate
364       - composer install --no-dev --optimize-autoloader
365   - name: Create artifacts
366     image: debian
367     commands:
368       - apt-get update
369       - apt-get install bzip2
370       - mkdir ./build
371       - export VERSION="$(cat VERSION)"
372       - # Create artifact
373       - export RELEASE="friendica-full-$VERSION"
374       - export ARTIFACT="$RELEASE.tar.gz"
375       - tar
376         --transform "s,^,$RELEASE/,"
377         -X mods/release-list-exclude.txt
378         -T mods/release-list-include.txt
379         -cvjf ./build/$ARTIFACT
380       - # calculate SHA256 checksum
381       - cd ./build
382       - sha256sum "$ARTIFACT" > "$ARTIFACT.sum256"
383       - ls -lh
384       - # output the sha256 sum for checking
385       - cat "$ARTIFACT.sum256"
386       - sha256sum "$ARTIFACT"
387   - name: Upload artifacts
388     image: alpine
389     environment:
390       LFTP_HOST:
391         from_secret: sftp_host
392       LFTP_USER:
393         from_secret: sftp_user
394       LFTP_KEY:
395         from_secret: ssh_key
396       LFTP_PORT: "22"
397       LFTP_SOURCE: "build"
398       LFTP_TARGET: "/http"
399     commands:
400       - apk add lftp openssh openssl
401       - touch drone.key
402       - chmod 400 drone.key
403       - echo "$LFTP_KEY" | openssl base64 -A -d > drone.key
404       - lftp -c "
405           set net:timeout 5;
406           set net:max-retries 2;
407           set net:reconnect-interval-base 5;
408           set sftp:auto-confirm true;
409           set sftp:connect-program 'ssh -q -a -x -i drone.key';
410           connect sftp://$LFTP_USER:@$LFTP_HOST:$LFTP_PORT;
411           cd $LFTP_TARGET;
412           mput $LFTP_SOURCE/*;
413         "
414       - rm drone.key
415
416 volumes:
417   - name: cache
418     host:
419       path: /tmp/drone-cache
420 ---
421 kind: pipeline
422 type: docker
423 name: release-deployment
424
425 trigger:
426   repo:
427     - friendica/friendica
428   branch:
429     - stable
430   event:
431     - tag
432
433 node:
434   node: releaser # This prevents executing this pipeline at other servers than drone.friendi.ca
435
436 steps:
437   - name: Restore cache
438     image: meltwater/drone-cache:dev
439     settings:
440       backend: "filesystem"
441       restore: true
442       cache_key: '{{ .Repo.Name }}_php74_{{ arch }}_{{ os }}'
443       archive_format: "gzip"
444       mount:
445         - '.composer'
446     volumes:
447       - name: cache
448         path:
449           /tmp/cache
450   - name: Composer install
451     image: friendicaci/php7.4:php7.4.18
452     commands:
453       - export COMPOSER_HOME=.composer
454       - composer validate
455       - composer install --no-dev --optimize-autoloader
456   - name: Create artifacts
457     image: debian
458     commands:
459       - apt-get update
460       - apt-get install bzip2
461       - mkdir ./build
462       - export VERSION="$(cat VERSION)"
463       - mkdir ./build
464       - export VERSION="$(cat VERSION)"
465       - # Create artifact
466       - export RELEASE="friendica-full-$VERSION"
467       - export ARTIFACT="$RELEASE.tar.gz"
468       - tar
469         --transform "s,^,$RELEASE/,"
470         -X mods/release-list-exclude.txt
471         -T mods/release-list-include.txt
472         -cvjf ./build/$ARTIFACT
473       - # calculate SHA256 checksum
474       - cd ./build
475       - sha256sum "$ARTIFACT" > "$ARTIFACT.sum256"
476       - ls -lh
477       - # output the sha256 sum for checking
478       - cat "$ARTIFACT.sum256"
479       - sha256sum "$ARTIFACT"
480   - name: Upload artifacts
481     image: alpine
482     environment:
483       LFTP_HOST:
484         from_secret: sftp_host
485       LFTP_USER:
486         from_secret: sftp_user
487       LFTP_KEY:
488         from_secret: ssh_key
489       LFTP_PORT: "22"
490       LFTP_SOURCE: "build"
491       LFTP_TARGET: "/http"
492     commands:
493       - apk add lftp openssh openssl
494       - touch drone.key
495       - chmod 400 drone.key
496       - echo "$LFTP_KEY" | openssl base64 -A -d > drone.key
497       - lftp -c "
498         set net:timeout 5;
499         set net:max-retries 2;
500         set net:reconnect-interval-base 5;
501         set sftp:auto-confirm true;
502         set sftp:connect-program 'ssh -q -a -x -i drone.key';
503         connect sftp://$LFTP_USER:@$LFTP_HOST:$LFTP_PORT;
504         cd $LFTP_TARGET;
505         mput $LFTP_SOURCE/*;
506         "
507       - rm drone.key
508
509 volumes:
510   - name: cache
511     host:
512       path: /tmp/drone-cache