2023-11-03 18:07:10 +01:00
|
|
|
variables:
|
|
|
|
- &volumes
|
|
|
|
- /data/${CI_REPO}:/builds
|
|
|
|
|
2024-03-22 09:58:49 +01:00
|
|
|
when:
|
|
|
|
event: [push, pull_request, tag, manual]
|
|
|
|
branch: [master, develop]
|
2023-11-03 18:07:10 +01:00
|
|
|
|
|
|
|
steps:
|
2024-03-29 13:04:39 +01:00
|
|
|
"Wait the database":
|
2023-11-03 18:07:10 +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-29 13:04:39 +01:00
|
|
|
"Create database":
|
2023-11-03 18:07:10 +01:00
|
|
|
image: mariadb:10.3
|
|
|
|
commands:
|
|
|
|
- mysql -hdb -uroot -proot -e "CREATE DATABASE app"
|
|
|
|
|
2024-03-29 13:04:39 +01:00
|
|
|
"Configure app":
|
2023-11-03 22:21:17 +01:00
|
|
|
image: deblan/php:8.0
|
2023-11-03 18:07:10 +01:00
|
|
|
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
|
|
|
|
|
2024-03-29 13:04:39 +01:00
|
|
|
"Installs PHP dependencies":
|
2023-11-03 22:21:17 +01:00
|
|
|
image: deblan/php:8.0
|
2023-11-03 18:07:10 +01:00
|
|
|
commands:
|
|
|
|
- apt-get update && apt-get -y install git
|
|
|
|
- composer install --no-scripts
|
|
|
|
|
2024-03-29 13:04:39 +01:00
|
|
|
"Migrates database":
|
2023-11-03 22:21:17 +01:00
|
|
|
image: deblan/php:8.0
|
2023-11-03 18:07:10 +01:00
|
|
|
environment:
|
|
|
|
- PHP=php
|
|
|
|
commands:
|
|
|
|
- ./bin/doctrine-migrate
|
2024-03-29 13:04:39 +01:00
|
|
|
|
|
|
|
"Generates JS routes":
|
|
|
|
image: deblan/php:8.0
|
|
|
|
commands:
|
2023-11-03 18:07:10 +01:00
|
|
|
- php bin/console fos:js-routing:dump --format=json --target=public/js/fos_js_routes.json
|
|
|
|
|
2024-03-29 13:04:39 +01:00
|
|
|
"Build assets":
|
2024-03-29 13:46:18 +01:00
|
|
|
image: node:21-alpine
|
2023-11-03 18:07:10 +01:00
|
|
|
commands:
|
2023-11-03 21:55:44 +01:00
|
|
|
- yarn
|
|
|
|
- npm run build
|
2023-11-03 18:07:10 +01:00
|
|
|
|
2024-03-29 13:04:39 +01:00
|
|
|
"Check dependencies":
|
2023-11-03 18:07:10 +01:00
|
|
|
image: gitnet.fr/deblan/osv-detector:v0.9
|
|
|
|
commands:
|
|
|
|
- osv-detector composer.lock yarn.lock
|
|
|
|
failure: ignore
|
|
|
|
|
2024-03-29 13:04:39 +01:00
|
|
|
"Build the cache":
|
2023-11-03 18:07:10 +01:00
|
|
|
image: deblan/mage
|
|
|
|
volumes: *volumes
|
|
|
|
commands:
|
|
|
|
- cd /builds
|
|
|
|
- rsync -az "$CI_WORKSPACE/" "$CI_COMMIT_SHA"
|
|
|
|
|
|
|
|
services:
|
|
|
|
db:
|
|
|
|
image: mariadb:10.3
|
|
|
|
environment:
|
|
|
|
- MARIADB_ROOT_PASSWORD=root
|