This repository has been archived by the owner on Feb 2, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
113 lines (87 loc) · 3.1 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
# Variables
DOCKER = docker
DOCKER_COMPOSE = docker-compose
PHP = $(EXEC) php
COMPOSER = $(EXEC) composer
NPM = $(EXEC) npm
SYMFONY_CONSOLE = $(PHP) bin/console
# Colors
GREEN = /bin/echo -e "\x1b[32m\#\# $1\x1b[0m"
RED = /bin/echo -e "\x1b[31m\#\# $1\x1b[0m"
## —— 🔥 App ——
init: ## Init the project
$(MAKE) start
$(MAKE) composer-install
$(MAKE) npm-install
@$(call GREEN,"The application is available at: http://127.0.0.1:8001/.")
cache-clear: ## Clear cache
$(SYMFONY_CONSOLE) cache:clear
## —— ✅ Test ——
.PHONY: tests
tests: ## Run all tests
$(MAKE) database-init-test
$(PHP) bin/phpunit --testdox tests/Unit/
$(PHP) bin/phpunit --testdox tests/Functional/
$(PHP) bin/phpunit --testdox tests/E2E/
database-init-test: ## Init database for test
$(SYMFONY_CONSOLE) d:d:d --force --if-exists --env=test
$(SYMFONY_CONSOLE) d:d:c --env=test
$(SYMFONY_CONSOLE) d:m:m --no-interaction --env=test
$(SYMFONY_CONSOLE) d:f:l --no-interaction --env=test
unit-test: ## Run unit tests
$(MAKE) database-init-test
$(PHP) bin/phpunit --testdox tests/Unit/
functional-test: ## Run functional tests
$(MAKE) database-init-test
$(PHP) bin/phpunit --testdox tests/Functional/
# PANTHER_NO_HEADLESS=1 ./bin/phpunit --filter LikeTest --debug to debug with Chrome
e2e-test: ## Run E2E tests
$(MAKE) database-init-test
$(PHP) bin/phpunit --testdox tests/E2E/
## —— 🐳 Docker ——
start: ## Start app
$(MAKE) docker-start
docker-start:
$(DOCKER_COMPOSE) up -d
stop: ## Stop app
$(MAKE) docker-stop
docker-stop:
$(DOCKER_COMPOSE) stop
@$(call RED,"The containers are now stopped.")
## —— 🎻 Composer ——
composer-install: ## Install dependencies
$(COMPOSER) install
composer-update: ## Update dependencies
$(COMPOSER) update
## —— 🐈 NPM —————————————————————————————————————————————————————————————————
npm-install: ## Install all npm dependencies
$(NPM) install
npm-update: ## Update all npm dependencies
$(NPM) update
npm-watch: ## Update all npm dependencies
$(NPM) run watch
## —— 📊 Database ——
database-init: ## Init database
$(MAKE) database-drop
$(MAKE) database-create
$(MAKE) database-migrate
$(MAKE) fixtures
database-drop: ## Drop database
$(SYMFONY_CONSOLE) d:d:d --force --if-exists
database-create: ## Create database
$(SYMFONY_CONSOLE) d:d:c --if-not-exists
database-migration: ## Make migration
$(SYMFONY_CONSOLE) make:migration
migration: ## Alias : database-migration
$(MAKE) database-migration
database-migrate: ## Migrate migrations
$(SYMFONY_CONSOLE) d:m:m --no-interaction
migrate: ## Alias : database-migrate
$(MAKE) database-migrate
database-fixtures-load: ## Load fixtures
$(SYMFONY_CONSOLE) d:f:l --no-interaction
fixtures: ## Alias : database-fixtures-load
$(MAKE) database-fixtures-load
## —— 🛠️ Others ——
help: ## List of commands
@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/'