[wip] add phpmetrics on ci

This commit is contained in:
Simon Vieille 2023-09-28 21:29:12 +02:00
parent 1a4bcf8755
commit b6c3e98377
Signed by: deblan
GPG key ID: 579388D585F70417

View file

@ -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: