2023-04-17 13:53:19 +02:00
|
|
|
variables:
|
2023-12-06 19:38:45 +01:00
|
|
|
volumes: &volumes
|
|
|
|
- node_cache:/root/.npm
|
2023-11-10 11:30:05 +01:00
|
|
|
- /data/${CI_REPO}:/builds
|
2023-04-17 13:53:19 +02:00
|
|
|
|
2023-09-22 22:07:17 +02:00
|
|
|
when:
|
|
|
|
event: [push, pull_request, tag, manual]
|
|
|
|
branch: [master, master-*, develop, develop-*, feature/*]
|
|
|
|
|
2023-09-29 16:02:54 +02:00
|
|
|
steps:
|
2024-03-03 19:34:27 +01:00
|
|
|
"Wait the database":
|
2023-12-06 19:40:30 +01:00
|
|
|
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'
|
|
|
|
|
2024-03-03 19:34:27 +01:00
|
|
|
"Create database":
|
2023-09-13 20:55:40 +02:00
|
|
|
image: mariadb:10.3
|
2024-01-10 10:08:20 +01:00
|
|
|
secrets: [mysqldump]
|
2023-09-13 20:55:40 +02:00
|
|
|
commands:
|
|
|
|
- mysql -hdb -uroot -proot -e "CREATE DATABASE app"
|
|
|
|
- eval "$MYSQLDUMP" | mysql -hdb -uroot -proot app
|
|
|
|
|
2024-03-03 19:34:27 +01:00
|
|
|
"Configure app":
|
2023-09-13 20:51:41 +02:00
|
|
|
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
|
2023-09-13 20:55:40 +02:00
|
|
|
|
2024-03-03 19:34:27 +01:00
|
|
|
"Installs PHP dependencies":
|
2023-09-13 20:55:40 +02:00
|
|
|
image: deblan/php:8.1
|
|
|
|
commands:
|
|
|
|
- apt-get update && apt-get -y install git
|
|
|
|
- composer install --no-scripts
|
|
|
|
|
2024-03-03 19:34:27 +01:00
|
|
|
"Migrates database":
|
2023-09-13 20:55:40 +02:00
|
|
|
image: deblan/php:8.1
|
|
|
|
environment:
|
|
|
|
- PHP=php
|
|
|
|
commands:
|
|
|
|
- ./bin/doctrine-migrate
|
|
|
|
|
2024-03-03 19:34:27 +01:00
|
|
|
"Generates JS routes":
|
2023-09-13 20:55:40 +02:00
|
|
|
image: deblan/php:8.1
|
|
|
|
commands:
|
|
|
|
- php bin/console fos:js-routing:dump --format=json --target=public/js/fos_js_routes.json
|
|
|
|
|
2024-03-03 19:34:27 +01:00
|
|
|
"Build assets":
|
2023-09-13 20:55:40 +02:00
|
|
|
image: node:16-alpine
|
|
|
|
environment:
|
|
|
|
- CPU_COUNT=3
|
2023-12-06 20:20:10 +01:00
|
|
|
volumes: *volumes
|
2023-09-13 20:55:40 +02:00
|
|
|
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
|
|
|
|
|
2024-03-03 19:34:27 +01:00
|
|
|
"Check dependencies":
|
2023-09-13 20:55:40 +02:00
|
|
|
image: gitnet.fr/deblan/osv-detector:v0.9
|
|
|
|
commands:
|
|
|
|
- osv-detector composer.lock yarn.lock
|
|
|
|
failure: ignore
|
2022-12-28 15:24:57 +01:00
|
|
|
|
2024-03-03 19:34:27 +01:00
|
|
|
"Build the cache":
|
2023-10-18 22:17:06 +02:00
|
|
|
image: deblan/mage
|
2023-09-13 20:50:20 +02:00
|
|
|
volumes: *volumes
|
2022-12-28 16:11:40 +01:00
|
|
|
commands:
|
2023-10-18 22:16:10 +02:00
|
|
|
- cd /builds
|
2023-09-24 19:28:27 +02:00
|
|
|
- rsync -az "$CI_WORKSPACE/" "$CI_COMMIT_SHA"
|
2022-12-28 13:44:31 +01:00
|
|
|
|
2022-12-28 16:11:40 +01:00
|
|
|
services:
|
|
|
|
db:
|
|
|
|
image: mariadb:10.3
|
|
|
|
environment:
|
|
|
|
- MARIADB_ROOT_PASSWORD=root
|
2023-04-17 13:53:19 +02:00
|
|
|
|
|
|
|
volumes:
|
2023-12-06 19:38:45 +01:00
|
|
|
node_cache:
|