-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
120 lines (91 loc) · 3.16 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
start:
@cd docker/dev \
&& docker compose up -d
stop:
@cd docker/dev \
&& docker compose stop
########################
# Init (for production)
########################
init:
bin/console doctrine:database:create
bin/console doctrine:migrations:migrate
bin/console app:init-config
#############
# Containers
#############
nginx:
@cd docker/dev \
&& docker compose exec nginx bash
php:
@cd docker/dev \
&& docker compose exec php bash
mysql:
@cd docker/dev \
&& docker compose exec mysql bash
#############
# Tools
#############
#### External (outside the container)
phpstan:
@cd docker/dev \
&& docker compose exec php bash -c 'make phpstan_command'
phpunit:
@cd docker/dev \
&& docker compose exec php bash -c 'make create_test_db_command' \
&& docker compose exec php bash -c 'make phpunit_command'
phpcs:
@cd docker/dev \
&& docker compose exec php bash -c 'make phpcs_command'
security:
@cd docker/dev \
&& docker compose exec php bash -c '/usr/local/bin/local-php-security-checker'
schema_validate:
@cd docker/dev \
&& docker compose exec php bash -c 'make schema_validate_command'
schema_update:
@cd docker/dev \
&& docker compose exec php bash -c 'make update_db_schema_command'
db_drop:
@cd docker/dev \
&& docker compose exec php bash -c 'make drop_db_command'
migrate:
@cd docker/dev \
&& docker compose exec php bash -c 'make migrate_command'
fixtures:
@cd docker/dev \
&& docker compose exec php bash -c 'make load_fixtures_command'
dump_db:
@cd docker/dev \
&& docker compose exec mysql bash -c 'mysqldump -u root jaw -p > /var/www/html/dump.sql && `chown -R $$DOCKER_USER_UID:$$DOCKER_USER_GID /var/www/html/dump.sql`'
# To use when you want to create a new migration file. You have to run 'make migrate' just after.
make create_migration:
@cd docker/dev \
&& docker compose exec php bash -c 'bin/console doctrine:database:drop --force && bin/console doctrine:database:create && make migrate_command && bin/console doctrine:migration:diff'
#### Internal (inside the container)
phpstan_command:
@APP_ENV=test bin/console cache:warmup
vendor/bin/phpstan clear-result-cache
php vendor/bin/phpstan analyse --memory-limit=-1
phpunit_command:
make create_test_db_command
APP_ENV=test bin/console cache:warmup && vendor/bin/phpunit --testdox
phpcs_command:
tools/php-cs-fixer/vendor/bin/php-cs-fixer fix src
schema_validate_command:
APP_ENV=dev bin/console doctrine:schema:validate
update_db_schema_command:
APP_ENV=dev bin/console doctrine:schema:update --force
drop_db_command:
APP_ENV=dev bin/console doctrine:database:drop --force
migrate_command:
APP_ENV=dev bin/console doctrine:migrations:migrate
create_test_db_command:
bin/console doctrine:database:drop --force --env=test || true \
&& bin/console doctrine:database:create --env=test \
&& bin/console doctrine:migrations:migrate -n --env=test \
&& bin/console doctrine:fixtures:load -n --env=test \
&& bin/console app:add-user some_username_admin somePassword [email protected] "Foo BAR" --admin --env=test \
&& bin/console app:add-user some_username_not_admin somePassword [email protected] "Foofoo BARBAR" --env=test
load_fixtures_command:
APP_ENV=dev bin/console doctrine:fixtures:load