From b6c3e9837706163436edd426ea8329372fe9911a Mon Sep 17 00:00:00 2001 From: Simon Vieille Date: Thu, 28 Sep 2023 21:29:12 +0200 Subject: [PATCH 1/6] [wip] add phpmetrics on ci --- .woodpecker/build.yml | 141 ++++++++++++++++++++++++------------------ 1 file changed, 80 insertions(+), 61 deletions(-) diff --git a/.woodpecker/build.yml b/.woodpecker/build.yml index 357b389..64eed97 100644 --- a/.woodpecker/build.yml +++ b/.woodpecker/build.yml @@ -8,71 +8,90 @@ when: branch: [master, master-*, develop, develop-*, feature/*] pipeline: - db-wait: - image: gitnet.fr/deblan/timeout:latest - commands: - - /bin/timeout -t 30 -v -c 'while true; do nc -z -v db 3306 2>&1 | grep succeeded && exit 0; sleep 0.5; done' + # db-wait: + # image: gitnet.fr/deblan/timeout:latest + # commands: + # - /bin/timeout -t 30 -v -c 'while true; do nc -z -v db 3306 2>&1 | grep succeeded && exit 0; sleep 0.5; done' + # + # db-create: + # image: mariadb:10.3 + # secrets: [mysqldump] + # commands: + # - mysql -hdb -uroot -proot -e "CREATE DATABASE app" + # - eval "$MYSQLDUMP" | mysql -hdb -uroot -proot app + # + # app-config: + # image: deblan/php:8.1 + # commands: + # - echo APP_ENV=prod >> .env.local + # - echo APP_SECRET=$(openssl rand -hex 32) >> .env.local + # - echo DATABASE_URL=mysql://root:root@db/app >> .env.local + # + # php-composer: + # image: deblan/php:8.1 + # commands: + # - apt-get update && apt-get -y install git + # - composer install --no-scripts + # + # db-migrate: + # image: deblan/php:8.1 + # environment: + # - PHP=php + # commands: + # - ./bin/doctrine-migrate + # + # app-jsroutes: + # image: deblan/php:8.1 + # commands: + # - php bin/console fos:js-routing:dump --format=json --target=public/js/fos_js_routes.json + # + # node-build: + # image: node:16-alpine + # environment: + # - CPU_COUNT=3 + # volumes: *volumes + # commands: + # - apk add --no-cache git + # - npm install -g svg2ttf ttf2eot ttf2woff2 + # - svg2ttf assets/fonts/deblan/src/deblan-icon.svg assets/fonts/deblan/deblan-icon.ttf + # - cat assets/fonts/deblan/deblan-icon.ttf | ttf2woff2 > assets/fonts/deblan/deblan-icon.woff2 + # - ttf2eot assets/fonts/deblan/deblan-icon.ttf assets/fonts/deblan/deblan-icon.eot + # - yarn + # - test -f public/js/fos_js_routes.json || echo "{}" > public/js/fos_js_routes.json + # - npm run build + # + # security-check: + # image: gitnet.fr/deblan/osv-detector:v0.9 + # commands: + # - osv-detector composer.lock yarn.lock + # failure: ignore + # + # cache-build: + # image: deblan/php:8.1 + # volumes: *volumes + # commands: + # - apt-get update && apt-get -y install rsync + # - cd /data/deblan/deblan.io-murph/ + # - rsync -az "$CI_WORKSPACE/" "$CI_COMMIT_SHA" - db-create: - image: mariadb:10.3 - secrets: [mysqldump] - commands: - - mysql -hdb -uroot -proot -e "CREATE DATABASE app" - - eval "$MYSQLDUMP" | mysql -hdb -uroot -proot app - - app-config: + phpmetrics: image: deblan/php:8.1 commands: - - echo APP_ENV=prod >> .env.local - - echo APP_SECRET=$(openssl rand -hex 32) >> .env.local - - echo DATABASE_URL=mysql://root:root@db/app >> .env.local + - composer global require phpmetrics/phpmetrics + - $HOME/.composer/vendor/bin/phpmetrics --report-html=./var/phpmetrics src - php-composer: - image: deblan/php:8.1 - commands: - - apt-get update && apt-get -y install git - - composer install --no-scripts - - db-migrate: - image: deblan/php:8.1 - environment: - - PHP=php - commands: - - ./bin/doctrine-migrate - - app-jsroutes: - image: deblan/php:8.1 - commands: - - php bin/console fos:js-routing:dump --format=json --target=public/js/fos_js_routes.json - - node-build: - image: node:16-alpine - environment: - - CPU_COUNT=3 - volumes: *volumes - commands: - - apk add --no-cache git - - npm install -g svg2ttf ttf2eot ttf2woff2 - - svg2ttf assets/fonts/deblan/src/deblan-icon.svg assets/fonts/deblan/deblan-icon.ttf - - cat assets/fonts/deblan/deblan-icon.ttf | ttf2woff2 > assets/fonts/deblan/deblan-icon.woff2 - - ttf2eot assets/fonts/deblan/deblan-icon.ttf assets/fonts/deblan/deblan-icon.eot - - yarn - - test -f public/js/fos_js_routes.json || echo "{}" > public/js/fos_js_routes.json - - npm run build - - security-check: - image: gitnet.fr/deblan/osv-detector:v0.9 - commands: - - osv-detector composer.lock yarn.lock - failure: ignore - - cache-build: - image: deblan/php:8.1 - volumes: *volumes - commands: - - apt-get update && apt-get -y install rsync - - cd /data/deblan/deblan.io-murph/ - - rsync -az "$CI_WORKSPACE/" "$CI_COMMIT_SHA" + phpmetrics-deploy: + image: woodpeckerci/plugin-surge-preview + settings: + path: var/phpmetrics + surge_token: + from_secret: surge_token + forge_type: gitea + forge_url: https://gitnet.fr + forge_repo_token: + from_secret: gitea_token + when: + event: pull_request services: db: -- 2.47.3 From 91f357d0a0f474baa1cb2fb33769ff6c9388540d Mon Sep 17 00:00:00 2001 From: Simon Vieille Date: Thu, 28 Sep 2023 21:31:17 +0200 Subject: [PATCH 2/6] replace pipeline with steps --- .woodpecker/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.woodpecker/build.yml b/.woodpecker/build.yml index 64eed97..2099039 100644 --- a/.woodpecker/build.yml +++ b/.woodpecker/build.yml @@ -7,7 +7,7 @@ when: event: [push, pull_request, tag, manual] branch: [master, master-*, develop, develop-*, feature/*] -pipeline: +steps: # db-wait: # image: gitnet.fr/deblan/timeout:latest # commands: -- 2.47.3 From fb5f5f56037d4d1a044e3420111d91b17db51c8b Mon Sep 17 00:00:00 2001 From: Simon Vieille Date: Thu, 28 Sep 2023 21:32:54 +0200 Subject: [PATCH 3/6] replace pipeline with steps --- .woodpecker/deploy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.woodpecker/deploy.yml b/.woodpecker/deploy.yml index 963cc0d..89dc1e2 100644 --- a/.woodpecker/deploy.yml +++ b/.woodpecker/deploy.yml @@ -5,7 +5,7 @@ variables: when: event: [deployment] -pipeline: +steps: app-deploy: image: deblan/php:8.1 secrets: [ssh_user, ssh_host, ssh_priv_key, app_directory] -- 2.47.3 From abe8c80fafd9b8c534749b65b2aeca038ad1cd77 Mon Sep 17 00:00:00 2001 From: Simon Vieille Date: Thu, 28 Sep 2023 21:34:40 +0200 Subject: [PATCH 4/6] [wip] add phpmetrics on ci --- .woodpecker/build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.woodpecker/build.yml b/.woodpecker/build.yml index 2099039..ddb33dd 100644 --- a/.woodpecker/build.yml +++ b/.woodpecker/build.yml @@ -78,6 +78,7 @@ steps: image: deblan/php:8.1 commands: - composer global require phpmetrics/phpmetrics + - find / -name phpmetrics - $HOME/.composer/vendor/bin/phpmetrics --report-html=./var/phpmetrics src phpmetrics-deploy: -- 2.47.3 From 2f75204043b2f07fb6eb00052ceb09479626ead4 Mon Sep 17 00:00:00 2001 From: Simon Vieille Date: Thu, 28 Sep 2023 21:35:36 +0200 Subject: [PATCH 5/6] [wip] add phpmetrics on ci --- .woodpecker/build.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.woodpecker/build.yml b/.woodpecker/build.yml index ddb33dd..22605c7 100644 --- a/.woodpecker/build.yml +++ b/.woodpecker/build.yml @@ -78,8 +78,7 @@ steps: image: deblan/php:8.1 commands: - composer global require phpmetrics/phpmetrics - - find / -name phpmetrics - - $HOME/.composer/vendor/bin/phpmetrics --report-html=./var/phpmetrics src + - $HOME/.config/composer/vendor/bin/phpmetrics --report-html=./var/phpmetrics src phpmetrics-deploy: image: woodpeckerci/plugin-surge-preview -- 2.47.3 From 22558c85013ebaa15fd10c3a0e281e9d2bde1f2f Mon Sep 17 00:00:00 2001 From: Simon Vieille Date: Thu, 28 Sep 2023 21:46:03 +0200 Subject: [PATCH 6/6] [wip] add phpmetrics on ci --- .woodpecker/build.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.woodpecker/build.yml b/.woodpecker/build.yml index 22605c7..ea3e70e 100644 --- a/.woodpecker/build.yml +++ b/.woodpecker/build.yml @@ -76,7 +76,9 @@ steps: phpmetrics: image: deblan/php:8.1 + secrets: [surge_token] commands: + - echo $SURGE_TOKEN | cut -da -f2- - composer global require phpmetrics/phpmetrics - $HOME/.config/composer/vendor/bin/phpmetrics --report-html=./var/phpmetrics src -- 2.47.3