-
Notifications
You must be signed in to change notification settings - Fork 7
/
Makefile
175 lines (134 loc) · 6.62 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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
.PHONY: help runprod rundev runtest runcoverage update updatecomposer getvendordir phpstan phpcs phpcbf phpcsfix phpcsfixtypes replenish compilelang build buildprod builddev update
help:
@echo "Makefile commands:"
@echo "runprod"
@echo "rundev"
@echo "updatecomposer"
@echo "updatedocker"
@echo "getvendordir"
@echo "phpstan"
@echo "phpcs"
@echo "phpcbf"
@echo "phpcsfix"
@echo "phpcsfixtypes"
@echo "replenish"
@echo "compilelang"
@echo "build"
@echo "buildprod"
@echo "builddev"
@echo "update = updatecomposer"
.DEFAULT_GOAL := rundev
SHELL = /bin/bash
LAST_WEB_COMMIT := $(shell git rev-parse --short HEAD)
runprod:
@docker compose -f docker-compose.yml up -d --force-recreate --remove-orphans
runprodtest: buildprod
@docker compose -f docker-compose.yml up -d --force-recreate --remove-orphans
rundev: builddev
@docker compose up -d --remove-orphans
@make replenish
@docker compose exec web rm -rf data/cache/module-config-cache.application.config.cache.php
updatedb: rundev
@docker compose exec -T web ./orm orm:schema-tool:update --force --no-interaction --complete
@docker compose exec -T web /bin/sh -c "EM_ALIAS=orm_report ./orm orm:schema-tool:update --force --no-interaction --complete"
stop:
@docker compose down
runtest: loadenv
@vendor/phpunit/phpunit/phpunit --bootstrap ./bootstrap.php --configuration ./phpunit.xml --stop-on-error --stop-on-failure
runcoverage: loadenv
@vendor/phpunit/phpunit/phpunit --bootstrap ./bootstrap.php --configuration ./phpunit.xml --coverage-html ./coverage
getvendordir:
@rm -Rf ./vendor
@docker cp $(shell docker compose ps -q web):/code/vendor ./vendor
replenish:
@docker cp ./public "$(shell docker compose ps -q web)":/code
@docker cp ./module "$(shell docker compose ps -q web)":/code
@docker compose exec web chown -R www-data:www-data /code/public
@docker cp ./data "$(shell docker compose ps -q web)":/code
@docker compose exec web chown -R www-data:www-data /code/data
@docker compose exec web rm -rf data/cache/module-config-cache.application.config.cache.php
@docker compose exec web composer dump-autoload --dev
@docker compose exec web ./orm orm:generate-proxies
@docker compose exec web /bin/sh -c "EM_ALIAS=orm_report ./orm orm:generate-proxies"
compilelang:
msgfmt module/Application/language/en.po -o module/Application/language/en -c --strict -v
msgfmt module/Application/language/nl.po -o module/Application/language/nl -c --strict -v
getlangfiles:
./translate-helper
update: updatecomposer updatedocker
loadenv: copyprodconf
@set -o allexport
@source .env
@set +o allexport
copyconf:
cp config/autoload/local.development.php.dist config/autoload/local.php
cp config/autoload/doctrine.local.development.php.dist config/autoload/doctrine.local.php
copyprodconf:
@cp config/autoload/local.production.php.dist config/autoload/local.php
@cp config/autoload/doctrine.local.production.php.dist config/autoload/doctrine.local.php
phpstan:
@docker compose exec web echo "" > phpstan/phpstan-baseline-pr.neon
@docker compose exec web vendor/bin/phpstan analyse -c phpstan.neon --memory-limit 1G
phpstanpr:
@git fetch --all
@git update-ref refs/heads/temp-phpstanpr refs/remotes/origin/main
@git checkout --detach temp-phpstanpr
@echo "" > phpstan/phpstan-baseline.neon
@echo "" > phpstan/phpstan-baseline-pr.neon
@make rundev
@docker compose exec web vendor/bin/phpstan analyse -c phpstan.neon --generate-baseline phpstan/phpstan-baseline-pr.neon --memory-limit 1G --no-progress
@git checkout -- phpstan/phpstan-baseline.neon
@git checkout -
@docker cp $(shell docker compose ps -q web):/code/phpstan/phpstan-baseline-pr.neon ./phpstan/phpstan-baseline-pr.neon
@make rundev
@docker compose exec web vendor/bin/phpstan analyse -c phpstan.neon --memory-limit 1G --no-progress
psalm: loadenv
@echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?><files/>" > psalm/psalm-baseline-pr.xml
@vendor/bin/psalm --no-cache
psalmall: loadenv
@echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?><files/>" > psalm/psalm-baseline-pr.xml
@vendor/bin/psalm --no-cache --ignore-baseline
psalmdiff: loadenv
@echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?><files/>" > psalm/psalm-baseline-pr.xml
@vendor/bin/psalm --no-cache --show-info=true
psalmbaseline: loadenv
@echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?><files/>" > psalm/psalm-baseline-pr.xml
@vendor/bin/psalm --set-baseline=psalm/psalm-baseline.xml --no-cache
psalmfix: loadenv
@echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?><files/>" > psalm/psalm-baseline-pr.xml
@vendor/bin/psalm --no-cache --alter --issues=InvalidReturnType,InvalidNullableReturnType
phpcs: loadenv
@vendor/bin/phpcs -p
phpcbf: loadenv
@vendor/bin/phpcbf -p --filter=GitModified
phpcbfall: loadenv
@vendor/bin/phpcbf -p
phpcsfix: loadenv
@vendor/bin/php-cs-fixer fix --format=txt --verbose
phpcsfixrisky: loadenv
@vendor/bin/php-cs-fixer fix --cache-file=data/cache/.php-cs-fixer.cache --allow-risky=yes --rules=@PHP82Migration,@PHP80Migration:risky,-declare_strict_types,-use_arrow_functions module
@vendor/bin/php-cs-fixer fix --cache-file=data/cache/.php-cs-fixer.cache --allow-risky=yes --rules=@PHP82Migration,@PHP80Migration:risky,-declare_strict_types,-use_arrow_functions config
checkcomposer: loadenv
@XDEBUG_MODE=off vendor/bin/composer-require-checker check composer.json
@vendor/bin/composer-unused
updatecomposer:
@docker cp ./composer.json $(shell docker compose ps -q web):/code/composer.json
@docker compose exec web composer update -W
@docker cp $(shell docker compose ps -q web):/code/composer.lock ./composer.lock
updatedocker:
@docker compose pull
@docker build --pull --no-cache -t abc.docker-registry.gewis.nl/db/gewisdb/web:production -f docker/web/production/Dockerfile .
@docker build --pull --no-cache -t abc.docker-registry.gewis.nl/db/gewisdb/web:development -f docker/web/development/Dockerfile .
@docker build --pull --no-cache -t abc.docker-registry.gewis.nl/db/gewisdb/nginx:latest -f docker/nginx/Dockerfile docker/nginx
build: buildweb buildnginx
buildprod: buildwebprod buildnginx
builddev: buildwebdev buildnginx
buildweb: buildwebprod buildwebdev
buildwebprod:
@docker build --build-arg GIT_COMMIT="$(LAST_WEB_COMMIT)" -t abc.docker-registry.gewis.nl/db/gewisdb/web:production -f docker/web/production/Dockerfile .
buildwebdev:
@docker build --build-arg GIT_COMMIT="$(LAST_WEB_COMMIT)" -t abc.docker-registry.gewis.nl/db/gewisdb/web:development -f docker/web/development/Dockerfile .
buildnginx:
@docker build -t abc.docker-registry.gewis.nl/db/gewisdb/nginx:latest -f docker/nginx/Dockerfile docker/nginx
buildpgadmin:
@docker compose build pgadmin