Compare commits
2 commits
508a816642
...
2f45834c75
Author | SHA1 | Date | |
---|---|---|---|
Simon Vieille | 2f45834c75 | ||
Simon Vieille | 676e9dfe67 |
|
@ -8,44 +8,44 @@ when:
|
||||||
branch: [master, master-*, develop, develop-*, feature/*]
|
branch: [master, master-*, develop, develop-*, feature/*]
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
db-wait:
|
"Wait the database":
|
||||||
image: gitnet.fr/deblan/timeout:latest
|
image: gitnet.fr/deblan/timeout:latest
|
||||||
commands:
|
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'
|
- /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:
|
"Create database":
|
||||||
image: mariadb:10.3
|
image: mariadb:10.3
|
||||||
secrets: [mysqldump]
|
secrets: [mysqldump]
|
||||||
commands:
|
commands:
|
||||||
- mysql -hdb -uroot -proot -e "CREATE DATABASE app"
|
- mysql -hdb -uroot -proot -e "CREATE DATABASE app"
|
||||||
- eval "$MYSQLDUMP" | mysql -hdb -uroot -proot app
|
- eval "$MYSQLDUMP" | mysql -hdb -uroot -proot app
|
||||||
|
|
||||||
app-config:
|
"Configure app":
|
||||||
image: deblan/php:8.1
|
image: deblan/php:8.1
|
||||||
commands:
|
commands:
|
||||||
- echo APP_ENV=prod >> .env.local
|
- echo APP_ENV=prod >> .env.local
|
||||||
- echo APP_SECRET=$(openssl rand -hex 32) >> .env.local
|
- echo APP_SECRET=$(openssl rand -hex 32) >> .env.local
|
||||||
- echo DATABASE_URL=mysql://root:root@db/app >> .env.local
|
- echo DATABASE_URL=mysql://root:root@db/app >> .env.local
|
||||||
|
|
||||||
php-composer:
|
"Installs PHP dependencies":
|
||||||
image: deblan/php:8.1
|
image: deblan/php:8.1
|
||||||
commands:
|
commands:
|
||||||
- apt-get update && apt-get -y install git
|
- apt-get update && apt-get -y install git
|
||||||
- composer install --no-scripts
|
- composer install --no-scripts
|
||||||
|
|
||||||
db-migrate:
|
"Migrates database":
|
||||||
image: deblan/php:8.1
|
image: deblan/php:8.1
|
||||||
environment:
|
environment:
|
||||||
- PHP=php
|
- PHP=php
|
||||||
commands:
|
commands:
|
||||||
- ./bin/doctrine-migrate
|
- ./bin/doctrine-migrate
|
||||||
|
|
||||||
app-jsroutes:
|
"Generates JS routes":
|
||||||
image: deblan/php:8.1
|
image: deblan/php:8.1
|
||||||
commands:
|
commands:
|
||||||
- php bin/console fos:js-routing:dump --format=json --target=public/js/fos_js_routes.json
|
- php bin/console fos:js-routing:dump --format=json --target=public/js/fos_js_routes.json
|
||||||
|
|
||||||
node-build:
|
"Build assets":
|
||||||
image: node:16-alpine
|
image: node:16-alpine
|
||||||
environment:
|
environment:
|
||||||
- CPU_COUNT=3
|
- CPU_COUNT=3
|
||||||
|
@ -60,13 +60,13 @@ steps:
|
||||||
- test -f public/js/fos_js_routes.json || echo "{}" > public/js/fos_js_routes.json
|
- test -f public/js/fos_js_routes.json || echo "{}" > public/js/fos_js_routes.json
|
||||||
- npm run build
|
- npm run build
|
||||||
|
|
||||||
security-check:
|
"Check dependencies":
|
||||||
image: gitnet.fr/deblan/osv-detector:v0.9
|
image: gitnet.fr/deblan/osv-detector:v0.9
|
||||||
commands:
|
commands:
|
||||||
- osv-detector composer.lock yarn.lock
|
- osv-detector composer.lock yarn.lock
|
||||||
failure: ignore
|
failure: ignore
|
||||||
|
|
||||||
cache-build:
|
"Build the cache":
|
||||||
image: deblan/mage
|
image: deblan/mage
|
||||||
volumes: *volumes
|
volumes: *volumes
|
||||||
commands:
|
commands:
|
||||||
|
|
|
@ -8,7 +8,7 @@ when:
|
||||||
skip_clone: true
|
skip_clone: true
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
app-deploy:
|
"Deploy":
|
||||||
image: deblan/mage
|
image: deblan/mage
|
||||||
secrets: [ssh_priv_key, ssh_user, ssh_host, app_directory]
|
secrets: [ssh_priv_key, ssh_user, ssh_host, app_directory]
|
||||||
volumes: *volumes
|
volumes: *volumes
|
||||||
|
|
36
.woodpecker/mage.yml
Normal file
36
.woodpecker/mage.yml
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
variables:
|
||||||
|
volumes: &volumes
|
||||||
|
- /data/${CI_REPO}:/builds
|
||||||
|
|
||||||
|
steps:
|
||||||
|
"Deploy":
|
||||||
|
image: deblan/mage:test
|
||||||
|
secrets: [ssh_priv_key, ssh_user, ssh_host, app_directory]
|
||||||
|
volumes: *volumes
|
||||||
|
pull: true
|
||||||
|
settings:
|
||||||
|
directory: "/builds/$CI_COMMIT_SHA"
|
||||||
|
ssh_key:
|
||||||
|
content:
|
||||||
|
from_secret: ssh_priv_key
|
||||||
|
file: "$HOME/.ssh/id_ed25519"
|
||||||
|
template: .mage.yml.dist
|
||||||
|
substitutions:
|
||||||
|
- from: ssh_user
|
||||||
|
to:
|
||||||
|
from_secret: ssh_user
|
||||||
|
- from: ssh_host
|
||||||
|
to:
|
||||||
|
from_secret: ssh_host
|
||||||
|
targets: "$CI_PIPELINE_DEPLOY_TARGET"
|
||||||
|
# commands:
|
||||||
|
# - cd "/builds/$CI_COMMIT_SHA"
|
||||||
|
# - mkdir "$HOME/.ssh"
|
||||||
|
# - echo "$SSH_PRIV_KEY" > "$HOME/.ssh/id_ed25519"
|
||||||
|
# - chmod 700 "$HOME/.ssh"
|
||||||
|
# - chmod 600 "$HOME/.ssh/id_ed25519"
|
||||||
|
# - cp .mage.yml.dist .mage.yml
|
||||||
|
# - sed -i "s/ssh_user/$SSH_USER/g" .mage.yml
|
||||||
|
# - sed -i "s/ssh_host/$SSH_HOST/g" .mage.yml
|
||||||
|
# - sed -i "s#app_directory#$APP_DIRECTORY#g" .mage.yml
|
||||||
|
# - mage deploy "$CI_PIPELINE_DEPLOY_TARGET"
|
Loading…
Reference in a new issue