forked from CodelyTV/php-ddd-example
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
92 lines (72 loc) · 3.05 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
current-dir := $(dir $(abspath $(lastword $(MAKEFILE_LIST))))
.PHONY: build
build: deps start
.PHONY: deps
deps: composer-install
# 🐘 Composer
composer-env-file:
@if [ ! -f .env.local ]; then echo '' > .env.local; fi
.PHONY: composer-install
composer-install: CMD=install
.PHONY: composer-update
composer-update: CMD=update
.PHONY: composer-require
composer-require: CMD=require
composer-require: INTERACTIVE=-ti --interactive
.PHONY: composer-require-module
composer-require-module: CMD=require $(module)
composer-require-module: INTERACTIVE=-ti --interactive
.PHONY: composer
composer composer-install composer-update composer-require composer-require-module: composer-env-file
@docker run --rm $(INTERACTIVE) --volume $(current-dir):/app --user $(id -u):$(id -g) \
composer:2.2.6 $(CMD) \
--ignore-platform-reqs \
--no-ansi
.PHONY: reload
reload: composer-env-file
@docker-compose exec php-fpm kill -USR2 1
@docker-compose exec nginx nginx -s reload
.PHONY: test
test: composer-env-file
docker exec codelytv-php_ddd_skeleton-mooc_backend-php ./vendor/bin/phpunit --testsuite mooc
docker exec codelytv-php_ddd_skeleton-mooc_backend-php ./vendor/bin/phpunit --testsuite shared
docker exec codelytv-php_ddd_skeleton-mooc_backend-php ./vendor/bin/behat -p mooc_backend --format=progress -v
docker exec codelytv-php_ddd_skeleton-backoffice_backend-php ./vendor/bin/phpunit --testsuite backoffice
.PHONY: static-analysis
static-analysis: composer-env-file
docker exec codelytv-php_ddd_skeleton-mooc_backend-php ./vendor/bin/psalm
.PHONY: run-tests
run-tests: composer-env-file
mkdir -p build/test_results/phpunit
./vendor/bin/phpunit --exclude-group='disabled' --log-junit build/test_results/phpunit/junit.xml --testsuite backoffice
./vendor/bin/phpunit --exclude-group='disabled' --log-junit build/test_results/phpunit/junit.xml --testsuite mooc
./vendor/bin/phpunit --exclude-group='disabled' --log-junit build/test_results/phpunit/junit.xml --testsuite shared
./vendor/bin/behat -p mooc_backend --format=progress -v
# 🐳 Docker Compose
.PHONY: start
start: CMD=up --build -d
.PHONY: stop
stop: CMD=stop
.PHONY: destroy
destroy: CMD=down
# Usage: `make doco CMD="ps --services"`
# Usage: `make doco CMD="build --parallel --pull --force-rm --no-cache"`
.PHONY: doco
doco start stop destroy: composer-env-file
@docker-compose $(CMD)
.PHONY: rebuild
rebuild: composer-env-file
docker-compose build --pull --force-rm --no-cache
make deps
make start
.PHONY: ping-mysql
ping-mysql:
@docker exec codelytv-php_ddd_skeleton-mooc-mysql mysqladmin --user=root --password= --host "127.0.0.1" ping --silent
.PHONY: ping-rabbitmq
ping-rabbitmq:
@docker exec codelytv-php_ddd_skeleton-rabbitmq rabbitmqctl ping --silent
clean-cache:
@rm -rf apps/*/*/var
@docker exec codelytv-php_ddd_skeleton-backoffice_backend-php ./apps/backoffice/backend/bin/console cache:warmup
@docker exec codelytv-php_ddd_skeleton-backoffice_frontend-php ./apps/backoffice/frontend/bin/console cache:warmup
@docker exec codelytv-php_ddd_skeleton-mooc_backend-php ./apps/mooc/backend/bin/console cache:warmup