Move prepare database commands to the bootstrap file

This commit is contained in:
Yassine Guedidi 2024-01-07 22:29:51 +01:00
parent c35aa64079
commit 4a4b584a46
3 changed files with 31 additions and 19 deletions

View file

@ -73,12 +73,8 @@ jobs:
with:
composer-options: "--optimize-autoloader --prefer-dist"
- name: "Prepare database"
run: |
cp app/config/tests/parameters_test.${{ matrix.database }}.yml app/config/parameters_test.yml
php bin/console doctrine:database:drop --force --env=test
php bin/console doctrine:database:create --env=test
php bin/console doctrine:migrations:migrate --no-interaction --env=test -vv
- name: "Prepare database configuration"
run: cp app/config/tests/parameters_test.${{ matrix.database }}.yml app/config/parameters_test.yml
- name: "Prepare fixtures"
run: "make fixtures"
@ -148,12 +144,8 @@ jobs:
with:
composer-options: "--optimize-autoloader --prefer-dist"
- name: "Prepare database"
run: |
cp app/config/tests/parameters_test.${{ matrix.database }}.yml app/config/parameters_test.yml
php bin/console doctrine:database:drop --force --env=test
php bin/console doctrine:database:create --env=test
php bin/console doctrine:migrations:migrate --no-interaction --env=test -vv
- name: "Prepare database configuration"
run: cp app/config/tests/parameters_test.${{ matrix.database }}.yml app/config/parameters_test.yml
- name: "Prepare fixtures"
run: "make fixtures"

View file

@ -31,15 +31,10 @@ build: ## Run webpack
@yarn install
@yarn build:$(ENV)
prepare: ## Prepare database for testsuite
-php bin/console doctrine:database:drop --force --env=test
php bin/console doctrine:database:create --env=test
php bin/console doctrine:migrations:migrate --no-interaction --env=test -vv
fixtures: ## Load fixtures into database
php bin/console doctrine:fixtures:load --no-interaction --env=test
test: prepare fixtures ## Launch wallabag testsuite
test: fixtures ## Launch wallabag testsuite
XDEBUG_MODE=off php -dmemory_limit=-1 bin/phpunit -v
release: ## Create a package. Need a VERSION parameter (eg: `make release VERSION=master`).
@ -51,6 +46,6 @@ endif
deploy: ## Deploy wallabag
@bundle exec cap staging deploy
.PHONY: help prepare install fixtures update build test release deploy run dev
.PHONY: help install fixtures update build test release deploy run dev
.DEFAULT_GOAL := install

View file

@ -1,7 +1,32 @@
<?php
use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\Process\Process;
require __DIR__ . '/../vendor/autoload.php';
(new Filesystem())->remove(__DIR__ . '/../var/cache/test');
(new Process([
'php',
__DIR__ . '/../bin/console',
'doctrine:database:drop',
'--force',
'--env=test',
]))->run();
(new Process([
'php',
__DIR__ . '/../bin/console',
'doctrine:database:create',
'--env=test',
]))->mustRun();
(new Process([
'php',
__DIR__ . '/../bin/console',
'doctrine:migrations:migrate',
'--no-interaction',
'--env=test',
'-vv',
]))->mustRun();