-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathMakefile
168 lines (112 loc) · 7.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
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
DOCKER_COMPOSE?=docker-compose -f docker/docker-compose.dev.yml -f docker/docker-compose.override.yml
EXEC?=$(DOCKER_COMPOSE) exec app
CONSOLE=php bin/console
PHPCSFIXER?=$(EXEC) php -d memory_limit=1024m vendor/bin/php-cs-fixer
.DEFAULT_GOAL := help
.PHONY: help start stop restart install uninstall reset clear-cache shell clear clean
.PHONY: db-diff db-migrate db-rollback db-fixtures db-validate
.PHONY: watch assets assets-build
.PHONY: tests lint lint-symfony lint-yaml lint-twig lint-xliff php-cs php-cs-fix security-check test-schema test-all
.PHONY: deps
.PHONY: build up perm docker-compose.override.yml
help:
@grep -E '(^[a-zA-Z_-]+:.*?##.*$$)|(^##)' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[32m%-30s\033[0m %s\n", $$1, $$2}' | sed -e 's/\[32m##/[33m/'
##
## Project setup
##---------------------------------------------------------------------------
start: ## Start docker containers
# $(DOCKER_COMPOSE) start
$(DOCKER_COMPOSE) up -d
stop: ## Stop docker containers
# $(DOCKER_COMPOSE) stop
$(DOCKER_COMPOSE) down
restart: ## Restart docker containers
$(DOCKER_COMPOSE) restart
install: build up deps perm ## Create and start docker containers
uninstall: stop ## Remove docker containers
$(DOCKER_COMPOSE) rm -vf
reset: uninstall install ## Remove and re-create docker containers
clear-cache: perm
$(EXEC) $(CONSOLE) cache:clear --no-warmup
$(EXEC) $(CONSOLE) cache:warmup
shell: ## Run app container in interactive mode
$(EXEC) /bin/bash
clear: perm ## Remove all the cache, the logs, the sessions and the built assets
$(EXEC) rm -rf var/cache/*
rm -rf var/log/*
rm -rf public/build
rm -f var/.php_cs.cache
clean: clear ## Clear and remove dependencies
rm -rf vendor node_modules
##
## Database
##---------------------------------------------------------------------------
db-diff: vendor ## Generate a migration by comparing your current database to your mapping information
$(EXEC) $(CONSOLE) doctrine:migration:diff
db-migrate: vendor ## Migrate database schema to the latest available version
$(EXEC) $(CONSOLE) doctrine:migration:migrate -n
db-rollback: vendor ## Rollback the latest executed migration
$(EXEC) $(CONSOLE) doctrine:migration:migrate prev -n
db-fixtures: vendor ## Apply doctrine fixtures
$(EXEC) $(CONSOLE) doctrine:fixtures:load -n
db-validate: vendor ## Check the ORM mapping
$(EXEC) $(CONSOLE) doctrine:schema:validate
##
## Assets
##---------------------------------------------------------------------------
watch: node_modules ## Watch the assets and build their development version on change
$(EXEC) yarn watch
assets: node_modules ## Build the development version of the assets
$(EXEC) yarn dev
assets-build: node_modules ## Build the production version of the assets
$(EXEC) yarn build
##
## Tests
##---------------------------------------------------------------------------
tests: ## Run all the PHP tests
$(EXEC) bin/phpunit
lint: lint-symfony php-cs ## Run lint on Twig, YAML, XLIFF, and PHP files
lint-symfony: lint-yaml lint-twig lint-xliff ## Lint Symfony (Twig and YAML) files
lint-yaml: ## Lint YAML files
$(EXEC) $(CONSOLE) lint:yaml config
lint-twig: ## Lint Twig files
$(EXEC) $(CONSOLE) lint:twig templates
lint-xliff: ## Lint Translation files
$(EXEC) $(CONSOLE) lint:xliff translations
php-cs: vendor ## Lint PHP code
$(PHPCSFIXER) fix --diff --dry-run --no-interaction -v
php-cs-fix: vendor ## Fix PHP code to follow the convention
$(PHPCSFIXER) fix
security-check: vendor ## Check for vulnerable dependencies
$(EXEC) vendor/bin/security-checker security:check
test-schema: vendor ## Test the doctrine Schema
$(EXEC) $(CONSOLE) doctrine:schema:validate --skip-sync -vvv --no-interaction
test-all: lint test-schema security-check tests ## Lint all, run schema and security check, then unit and functionnal tests
##
## Dependencies
##---------------------------------------------------------------------------
deps: vendor assets ## Install the project dependencies
##
# Internal rules
build:
$(DOCKER_COMPOSE) pull --ignore-pull-failures
$(DOCKER_COMPOSE) build --force-rm
up:
$(DOCKER_COMPOSE) up -d --remove-orphans
perm:
$(EXEC) chmod -R 777 var public/build node_modules vendor
$(EXEC) chown -R www-data:root var public/build node_modules vendor
docker-compose.override.yml:
ifneq ($(wildcard docker-compose.override.yml),docker-compose.override.yml)
@echo docker-compose.override.yml do not exists, copy docker-compose.override.yml.dist to create it, and fill it.
exit 1
endif
# Rules from files
vendor: composer.lock
$(EXEC) composer install -n
composer.lock: app/composer.json
@echo composer.lock is not up to date.
node_modules: yarn.lock
$(EXEC) yarn install
yarn.lock: package.json
@echo yarn.lock is not up to date.