-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
97 lines (68 loc) · 2.61 KB
/
Makefile
File metadata and controls
97 lines (68 loc) · 2.61 KB
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
# Executables (local)
DOCKER_COMP = docker-compose
# Docker containers
PHP_CONT = $(DOCKER_COMP) exec php
# Executables
PHP = $(PHP_CONT) php
COMPOSER = $(PHP_CONT) composer
SYMFONY = $(PHP_CONT) bin/console
# Misc
.DEFAULT_GOAL = help
.PHONY = help build up start down logs sh composer vendor sf cc
## 👷 Makefile
help: ## Outputs this help screen
@grep -E '(^[a-zA-Z0-9_-]+:.*?##.*$$)|(^##)' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}{printf "\033[32m%-30s\033[0m %s\n", $$1, $$2}' | sed -e 's/\[32m##/[33m/'
## 🐳 Docker
setup: ## Sets up dependencies for environment
sh docker/setup.sh
build: ## Builds container(s)
@$(DOCKER_COMP) build --pull --no-cache $(c)
up: ## Start container(s)
@$(DOCKER_COMP) up $(c)
up-d: ## Start container(s) in detached mode (no logs)
@$(DOCKER_COMP) up --detach $(c)
start: setup build up-d ## Set up, build and start the containers
stop: ## Stop container(s)
@$(DOCKER_COMP) stop $(c)
down: ## Stop and remove container(s)
@$(DOCKER_COMP) down $(c) --remove-orphans
logs: ## Show logs
@$(DOCKER_COMP) logs $(c)
logs-f: ## Show live logs
@$(DOCKER_COMP) logs --tail=0 --follow $(c)
ps: ## Show containers' statuses
@$(DOCKER_COMP) ps
sh: ## Connect to a container via SH
$(DOCKER_COMP) exec $(c) sh
bash: ## Connect to a container via BASH
$(DOCKER_COMP) exec $(c) bash
php-sh: ## Connect to the PHP FPM container via SH
@$(PHP_CONT)
php-bash: ## Connect to the PHP FPM container via BASH
@$(PHP_CONT) bash
## ✅ Code Quality
phpcs: ## Run PHP Code Sniffer
@$(PHP_CONT) ./vendor/bin/phpcs
phpcs-fix: ## Run PHP Code Sniffer (fix)
@$(PHP_CONT) ./vendor/bin/phpcbf
phpstan: ## Run PHPStan
@$(PHP_CONT) ./vendor/bin/phpstan
lint: phpcs phpstan ## Run PHP Code Sniffer and PHPStan
test: ## Run tests, pass the parameter "args=" to run the command with arguments or options
@$(PHP) bin/phpunit $(args)
test-cov: ## Run tests and generate coverage report
@$(DOCKER_COMP) exec -e XDEBUG_MODE=coverage php bin/phpunit --coverage-clover coverage/clover/clover.xml --coverage-html coverage/html
## 🧙 Composer
composer: ## Run composer, pass the parameter "c=" to run a given command, example: make composer c='req symfony/orm-pack'
@$(eval c ?=)
@$(COMPOSER) $(c)
## 🎶 Symfony
sf: ## List all Symfony commands or pass the parameter "c=" to run a given command, example: make sf c=about
@$(eval c ?=)
@$(SYMFONY) $(c)
cc: c=c:c ## Clear the cache
cc: sf
migrations-diff: c=doctrine:migrations:diff ## Generate diff of migrations based on entities
migrations-diff: sf
migrations-migrate: c=doctrine:migrations:migrate ## Execute all migrations
migrations-migrate: sf