-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
164 lines (119 loc) · 4.84 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
# Executables (local)
DOCKER_COMP = docker-compose
PHP_SERVICE = app
NODE_SERVICE = node
DB_SERVICE = mysql
# Make Makefile available for users without Docker setup
ifeq ($(APP_DOCKER), 0)
PHP_CONT =
DB_CONT =
NODE_CONT =
else
PHP_CONT = $(DOCKER_COMP) exec $(PHP_SERVICE)
NODE_CONT = $(DOCKER_COMP) exec $(NODE_SERVICE)
DB_CONT = $(DOCKER_COMP) exec $(DB_SERVICE)
endif
# Executables
PHP = $(PHP_CONT) php
COMPOSER = $(PHP_CONT) composer
SYMFONY = $(PHP_CONT) tests/Application/bin/console
SYMFONY_CLI = $(PHP_CONT) symfony
NPM = $(NODE_CONT) npm
# Executables: vendors
PHPUNIT = $(PHP) vendor/bin/phpunit
PHPSPEC = $(PHP) vendor/bin/phpspec
ECS = $(PHP) vendor/bin/ecs
# Misc
.DEFAULT_GOAL := help
##
## —— Sylius Makefile 🦢 ———————————————————————————————————
##
help: ## Outputs 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 🐳 ————————————————————————————————————————————————————————————————
##
start-containers: ## Start all containers
$(DOCKER_COMP) up -d --remove-orphans
stop-containers: ## Stop all containers
$(DOCKER_COMP) stop || exit 0
down-containers: ## Stop and remove containers
$(DOCKER_COMP) down || exit 0
pull-containers: ## Pull containers from Docker hub
$(DOCKER_COMP) pull --no-parallel --include-deps --ignore-pull-failures
build-containers: ## Build project
$(DOCKER_COMP) build
logs: ## Show live logs
$(DOCKER_COMP) logs --tail=30 --follow
sh: ## Connect to the PHP FPM container
$(DOCKER_COMP) exec $(PHP_SERVICE) bash
ps: ## Display status of running containers
$(DOCKER_COMP) ps
##
## —— Symfony 🎶️ ————————————————————————————————————————————————————————————————
##
security: ## Check security issues in project dependencies
$(SYMFONY_CLI) security:check
##
## —— Composer 🎼 ———————————————————————————————————————————————————————————————
##
composer-install: ## Install project dependencies
docker-compose run --rm app composer install --no-scripts --no-interaction --no-progress --no-suggest
git clean -f -d
git clean -f
composer-reinstall: ## Reinstall composer dependencies
$(COMPOSER) clearcache
rm -rf vendor/*
make composer-install
composer-dump: ## Dump composer
$(COMPOSER) dump-autoload --optimize --classmap-authoritative --no-interaction --quiet
composer-validate: ## Validate composer json and lock
$(COMPOSER) validate --ansi --strict
##
## —— Database 📜 ————————————————————————————————————————————————————————————————
##
migrate:
$(SYMFONY) doctrine:migrations:migrate
migrations-status:
$(SYMFONY) doctrine:migrations:status
##
## —— Front 🎨 ————————————————————————————————————————————————————————————————
##
front-assets: ## Install all assets
$(PHP_CONT) rm -rf tests/Application/public/bundles
$(SYMFONY) sylius:install:assets --no-debug
front-watch: ## Build dev and watch project
$(PHP_CONT) rm -rf public/build/*
$(NPM) run watch
front-build: ## Build prod project
$(PHP_CONT) rm -rf public/build/*
$(NPM) run build:prod
front-lint: ## Run lint project
$(NPM) run lint:js
##
## —— Generic 🧭 ————————————————————————————————————————————————————————————————
##
install-backend: ## Install backend
$(SYMFONY) sylius:install --no-interaction
$(SYMFONY) sylius:fixtures:load default --no-interaction
install-frontend: ## Install frontend
$(NODE_CONT) yarn install --pure-lockfile
$(NODE_CONT) sh -c "GULP_ENV=prod yarn build"
install: ## Install everything
make composer-install
make install-backend
make install-frontend
make front-assets
phpunit: ## Run phpunit
vendor/bin/phpunit
phpspec: ## Run phpspec
vendor/bin/phpspec run --ansi --no-interaction -f dot
phpstan: ## Run phpstan
vendor/bin/phpstan analyse
psalm: ## Run psalm
vendor/bin/psalm
behat: ## Run behat
APP_ENV=test vendor/bin/behat --colors --strict --no-interaction -vvv -f progress
ci: install phpstan psalm phpunit phpspec behat
integration: install phpunit behat
static: install phpspec phpstan psalm