]> git.mxchange.org Git - friendica.git/blob - .woodpecker/.database_checks.yml
Merge pull request #12807 from HankG/mastodon-trending-api-updates
[friendica.git] / .woodpecker / .database_checks.yml
1 matrix:
2   include:
3     - PHP_MAJOR_VERSION: 7.4
4       PHP_VERSION: 7.4.33
5
6 branches:
7   exclude: [ stable ]
8
9 pipeline:
10   db_version_match:
11     image: friendicaci/transifex
12     commands:
13       - export DBSTRUCTURE_VERSION="$(sed -rn "s/.*'DB_UPDATE_VERSION', ([0-9]+).*/\1/p" static/dbstructure.config.php)"
14       - export DATABASE_VERSION="$(sed -rn 's/.*DB_UPDATE_VERSION ([0-9]+).*/\1/p' database.sql)"
15       - echo "Database $DATABASE_VERSION - DB-Structure $DBSTRUCTURE_VERSION"
16       - if [ "$DBSTRUCTURE_VERSION" != "$DATABASE_VERSION" ]; then
17           echo "Database version mismatch.";
18           exit 1;
19         fi
20   restore_cache:
21     image: meltwater/drone-cache:dev
22     settings:
23       backend: "filesystem"
24       restore: true
25       cache_key: "{{ .Repo.Name }}_php${PHP_MAJOR_VERSION}_{{ arch }}_{{ os }}"
26       archive_format: "gzip"
27       mount:
28         - '.composer'
29     volumes:
30       - /tmp/drone-cache:/tmp/cache
31   composer_install:
32     image: friendicaci/php${PHP_MAJOR_VERSION}:php${PHP_VERSION}
33     commands:
34       - export COMPOSER_HOME=.composer
35       - ./bin/composer.phar validate
36       - ./bin/composer.phar install --prefer-dist
37     volumes:
38       - /etc/hosts:/etc/hosts
39   rebuild_cache:
40     image: meltwater/drone-cache:dev
41     settings:
42       backend: "filesystem"
43       rebuild: true
44       cache_key: "{{ .Repo.Name }}_php${PHP_MAJOR_VERSION}_{{ arch }}_{{ os }}"
45       archive_format: "gzip"
46       mount:
47         - '.composer'
48     volumes:
49       - /tmp/drone-cache:/tmp/cache
50   recreate_database.sql:
51     image: friendicaci/php${PHP_MAJOR_VERSION}:php${PHP_VERSION}
52     environment:
53       MYSQL_HOST: "mariadb"
54       MYSQL_PORT: "3306"
55       MYSQL_DATABASE: "test"
56       MYSQL_PASSWORD: "test"
57       MYSQL_USER: "test"
58       REDIS_HOST: "redis"
59       MEMCACHED_HOST: "memcached"
60       MEMCACHE_HOST: "memcached"
61       XDEBUG_MODE: "coverage"
62     commands:
63       - phpenmod xdebug
64       - cp config/local-sample.config.php config/local.config.php
65       - if ! bin/wait-for-connection $MYSQL_HOST $MYSQL_PORT 300; then echo "[ERROR] Waited 300 seconds, no response" >&2; exit 1; fi
66       - mysql -h$MYSQL_HOST -P$MYSQL_PORT -p$MYSQL_PASSWORD -u$MYSQL_USER $MYSQL_DATABASE < database.sql
67       - php ./bin/console.php dbstructure dumpsql > database.sql
68   check_database.sql:
69     image: alpine/git
70     commands:
71       - git update-index --refresh
72       - git diff-index --quiet HEAD --
73       - if [[ $? -ne 0 ]]; then
74           echo "database.sql mismatch.";
75           exit 1;
76         fi
77
78 services:
79   mariadb:
80     image: mariadb:latest
81     environment:
82       MYSQL_ALLOW_EMPTY_PASSWORD: "true"
83       MYSQL_DATABASE: "test"
84       MYSQL_PASSWORD: "test"
85       MYSQL_USER: "test"