-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
123 lines (90 loc) · 4.72 KB
/
Makefile
File metadata and controls
123 lines (90 loc) · 4.72 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
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
.DEFAULT_GOAL = help
.PHONY : help
# Executables
COMPOSER = composer
DOCKER = docker
SYMFONY = symfony
# Alias
CONSOLE = $(SYMFONY) console
# Vendor executables
PHPUNIT = ./vendor/bin/phpunit
PHPSTAN = ./vendor/bin/phpstan
PHP_CS_FIXER = ./vendor/bin/php-cs-fixer
PSALM = ./vendor/bin/psalm
RECTOR = ./vendor/bin/rector
TWIG_CS_FIXER = ./vendor/bin/twig-cs-fixer
## —— 🎵 🐳 The Symfony Docker 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/'
## —— Project setup 🚀 ——————————————————————————————————————————————————————————
install: ## Setup the whole project
@$(COMPOSER) install --no-interaction
@$(SYMFONY) composer setup-env
@$(SYMFONY) composer setup-test-env
@$(CONSOLE) asset-map:compile
warmup: ## Warmup the dev environment (e.g. after purge)
@$(SYMFONY) composer setup-env
@$(SYMFONY) composer setup-test-env
@$(CONSOLE) asset-map:compile
@$(CONSOLE) cache:warmup
## —— Composer 🧙 ——————————————————————————————————————————————————————————————
vendor: composer.lock ## Install vendors according to the current composer.lock file
@$(COMPOSER) install --prefer-dist --no-dev --no-progress --no-interaction
## —— Docker 🐳 ————————————————————————————————————————————————————————————————
start: build up ## Build and start the containers
build: ## Builds the Docker images
@$(DOCKER) compose build --pull --no-cache
up: ## Start the docker hub in detached mode (no logs)
@$(DOCKER) compose up --detach
down: ## Stop the docker hub
@$(DOCKER) compose down --remove-orphans
logs: ## Show live logs
@$(DOCKER) compose logs --tail=0 --follow
## —— Symfony 🎵 ———————————————————————————————————————————————————————————————
compile: ## Execute some tasks before deployment
rm -rf public/assets/*
@$(CONSOLE) asset-map:compile
@$(CONSOLE) cache:clear
@$(CONSOLE) cache:warmup
consume: ## Consume messages from symfony messenger
@$(CONSOLE) messenger:consume async_priority_high async_priority_low -vv
trans: ## Extract translations from symfony
@$(CONSOLE) translation:extract --dump-messages --force --sort=asc en
## —— Coding standards ✨ ——————————————————————————————————————————————————————
lint: lint-container lint-php lint-twig lint-trans static-analysis ## Run continuous integration pipeline
cs: rector fix-php ## Run all coding standards checks
ci: rector fix-php fix-twig static-analysis
static-analysis: phpstan psalm ## Run the static analysis
fix-php: ## Fix files with php-cs-fixer
@$(PHP_CS_FIXER) fix
fix-twig: ## Fix files with twig-cs-fixer
@$(TWIG_CS_FIXER) --fix
lint-container: ## Lint translations
@$(CONSOLE) lint:container
lint-php: ## Lint files with php-cs-fixer
@$(PHP_CS_FIXER) fix --dry-run
lint-trans: ## Lint translations
@$(CONSOLE) lint:translations --locale=en
lint-twig: ## Lint files with twig-cs-fixer
@$(TWIG_CS_FIXER)
phpstan: ## Run PHPStan
@$(PHPSTAN) analyse --memory-limit=-1
psalm: ## Run Psalm
@$(PSALM) --show-info=true
rector: ## Run Rector
@$(RECTOR)
## —— Tests ✅ —————————————————————————————————————————————————————————————————
test: ## Run tests
@$(PHPUNIT) --stop-on-failure -d memory_limit=-1 --no-coverage
testdox: ## Run tests with testdox
@$(PHPUNIT) --testdox -d memory_limit=-1 --no-coverage
coverage: ## Run tests with Coverage reports
@XDEBUG_MODE=coverage $(PHPUNIT) -d memory_limit=-1
## —— Cleanup 🚮 ————————————————————————————————————————————————————————————————
purge: ## Purge temporary files
@rm -rf public/assets/*
@rm -rf var/cache/* var/logs/*
clear: ## Cleanup everything
@rm -rf vendor/*
@rm -rf public/assets/*
@rm -rf var/cache/* var/logs/*