From d3b0d4dbdeb59b705dff17c142c8c56c22843bb1 Mon Sep 17 00:00:00 2001 From: Philipp Date: Sun, 7 Nov 2021 23:36:37 +0100 Subject: [PATCH 1/6] Drone | check database.sql --- .drone.yml | 76 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) diff --git a/.drone.yml b/.drone.yml index 4c4555a8a..00bd46dbd 100644 --- a/.drone.yml +++ b/.drone.yml @@ -110,6 +110,82 @@ volumes: --- kind: pipeline type: docker +name: php7.4-database-check + +depends_on: + - Integrity checks + +steps: + - name: Restore cache + image: meltwater/drone-cache:dev + settings: + backend: "filesystem" + restore: true + cache_key: '{{ .Repo.Name }}_php74_{{ arch }}_{{ os }}' + archive_format: "gzip" + mount: + - '.composer' + volumes: + - name: cache + path: /tmp/cache + - name: Composer install + image: friendicaci/php7.4:php7.4.18 + commands: + - export COMPOSER_HOME=.composer + - ./bin/composer.phar validate + - ./bin/composer.phar install --prefer-dist + - name: Rebuild cache + image: meltwater/drone-cache:dev + settings: + backend: "filesystem" + rebuild: true + cache_key: '{{ .Repo.Name }}_php74_{{ arch }}_{{ os }}' + archive_format: "gzip" + mount: + - '.composer' + volumes: + - name: cache + path: /tmp/cache + - name: Test Friendica + image: friendicaci/php7.4:php7.4.18 + environment: + MYSQL_HOST: "mariadb" + MYSQL_PORT: 3306 + MYSQL_DATABASE: "test" + MYSQL_PASSWORD: "test" + MYSQL_USER: "test" + REDIS_HOST: "redis" + MEMCACHED_HOST: "memcached" + MEMCACHE_HOST: "memcached" + XDEBUG_MODE: "coverage" + commands: + - phpenmod xdebug + - cp config/local-sample.config.php config/local.config.php + - if ! bin/wait-for-connection $MYSQL_HOST $MYSQL_PORT 300; then echo "[ERROR] Waited 300 seconds, no response" >&2; exit 1; fi + - mysql -h$MYSQL_HOST -P$MYSQL_PORT -p$MYSQL_PASSWORD -u$MYSQL_USER $MYSQL_DATABASE < database.sql + - php ./bin/console.php dbstructure dumpsql > database.sql + - name: Codecov + image: plugins/codecov + when: + repo: + - friendica/friendica + settings: + token: + from_secret: codecov-token + files: + - clover.xml + - name: Check database.sql + image: alpine + commands: + - git update-index --refresh + - git diff-index --quiet HEAD -- + - if [[ $? -ne 0 ]]; then + echo "database.sql mismatch."; + exit 1; + fi +--- +kind: pipeline +type: docker name: php7.3-mariadb depends_on: From 5fa633eb39a67baa7700cdff247ffd59ab7ef5f5 Mon Sep 17 00:00:00 2001 From: Philipp Date: Sun, 7 Nov 2021 23:38:04 +0100 Subject: [PATCH 2/6] Drone | check database.sql --- .drone.yml | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/.drone.yml b/.drone.yml index 00bd46dbd..580d8b8af 100644 --- a/.drone.yml +++ b/.drone.yml @@ -146,7 +146,7 @@ steps: volumes: - name: cache path: /tmp/cache - - name: Test Friendica + - name: Recreate database.sql image: friendicaci/php7.4:php7.4.18 environment: MYSQL_HOST: "mariadb" @@ -183,6 +183,22 @@ steps: echo "database.sql mismatch."; exit 1; fi + +services: + - name: mariadb + image: mariadb:latest + environment: + MYSQL_ALLOW_EMPTY_PASSWORD: "true" + MYSQL_DATABASE: "test" + MYSQL_PASSWORD: "test" + MYSQL_USER: "test" + tmpfs: + - /var/lib/mysql + +volumes: + - name: cache + host: + path: /tmp/drone-cache --- kind: pipeline type: docker From 41d4f4183fc551389fba927e29406e7dbcedb6e4 Mon Sep 17 00:00:00 2001 From: Philipp Date: Sun, 7 Nov 2021 23:40:45 +0100 Subject: [PATCH 3/6] Drone | check database.sql --- .drone.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.drone.yml b/.drone.yml index 580d8b8af..6e1e7527f 100644 --- a/.drone.yml +++ b/.drone.yml @@ -175,13 +175,13 @@ steps: files: - clover.xml - name: Check database.sql - image: alpine + image: alpine/git commands: - git update-index --refresh - git diff-index --quiet HEAD -- - if [[ $? -ne 0 ]]; then - echo "database.sql mismatch."; - exit 1; + echo "database.sql mismatch."; + exit 1; fi services: From e251f8f60fe67c9c499aa399a83d9f98a98bbc7c Mon Sep 17 00:00:00 2001 From: Philipp Date: Sun, 7 Nov 2021 23:41:11 +0100 Subject: [PATCH 4/6] Test wrong database.sql --- database.sql | 3 --- 1 file changed, 3 deletions(-) diff --git a/database.sql b/database.sql index fbccddcb2..b7217a54f 100644 --- a/database.sql +++ b/database.sql @@ -2,9 +2,6 @@ -- Friendica 2021.12-dev (Siberian Iris) -- DB_UPDATE_VERSION 1443 -- ------------------------------------------ - - --- -- TABLE gserver -- CREATE TABLE IF NOT EXISTS `gserver` ( From cda6ed6f0519872800e83912b407c230ea96a502 Mon Sep 17 00:00:00 2001 From: Philipp Date: Sun, 7 Nov 2021 23:42:23 +0100 Subject: [PATCH 5/6] Restore database.sql --- database.sql | 3 +++ 1 file changed, 3 insertions(+) diff --git a/database.sql b/database.sql index b7217a54f..fbccddcb2 100644 --- a/database.sql +++ b/database.sql @@ -2,6 +2,9 @@ -- Friendica 2021.12-dev (Siberian Iris) -- DB_UPDATE_VERSION 1443 -- ------------------------------------------ + + +-- -- TABLE gserver -- CREATE TABLE IF NOT EXISTS `gserver` ( From 84133845a1d8146134fdab5294866845ef472d37 Mon Sep 17 00:00:00 2001 From: Philipp Date: Sun, 7 Nov 2021 23:47:29 +0100 Subject: [PATCH 6/6] Fixed drone script --- .drone.yml | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/.drone.yml b/.drone.yml index 6e1e7527f..99692d32c 100644 --- a/.drone.yml +++ b/.drone.yml @@ -164,16 +164,6 @@ steps: - if ! bin/wait-for-connection $MYSQL_HOST $MYSQL_PORT 300; then echo "[ERROR] Waited 300 seconds, no response" >&2; exit 1; fi - mysql -h$MYSQL_HOST -P$MYSQL_PORT -p$MYSQL_PASSWORD -u$MYSQL_USER $MYSQL_DATABASE < database.sql - php ./bin/console.php dbstructure dumpsql > database.sql - - name: Codecov - image: plugins/codecov - when: - repo: - - friendica/friendica - settings: - token: - from_secret: codecov-token - files: - - clover.xml - name: Check database.sql image: alpine/git commands: