-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
126 lines (93 loc) · 3.21 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
DOCKER_COMPOSE = docker-compose
docker_env_dev:
ifeq ($(ENV),dev)
DOCKER_COMPOSE = docker-compose -f docker-compose.yml
endif
DOCKER_COMPOSE_EXEC = $(DOCKER_COMPOSE) exec -T
DOCKER_COMPOSE_UP = $(DOCKER_COMPOSE) up -d --remove-orphans --no-recreate
EXEC_PHP = $(DOCKER_COMPOSE_EXEC) php gosu foo
EXEC_DATABASE = $(DOCKER_COMPOSE_EXEC) database
EXEC_NODE = $(DOCKER_COMPOSE_EXEC) node
SYMFONY = $(EXEC_PHP) php bin/console
COMPOSER = $(EXEC_PHP) composer
##
## File dependencies
## -----------------
##
composer.lock: ## Update Composer dependencies
$(COMPOSER) update
vendor: composer.lock ## Install Composer dependencies
$(COMPOSER) install --no-progress
composer-install-no-scripts: composer.lock ## Install Composer dependencies without running scripts
$(COMPOSER) install --no-progress --no-scripts
##
## Project
## -------
##
shell: ## Enter in web container
$(DOCKER_COMPOSE) exec php gosu foo sh
install: database assets ## Install everything
clean: start ## Remove dependencies and built resources
$(DOCKER_COMPOSE) exec php rm -Rf public/build/*
$(DOCKER_COMPOSE) exec php rm -Rf vendor
$(DOCKER_COMPOSE) exec php rm -Rf var/cache/ var/log var/app/sessions
$(DOCKER_COMPOSE) stop
$(DOCKER_COMPOSE) kill
$(DOCKER_COMPOSE) down --volumes --remove-orphans
reset: clean build start install ## Re-install all dependencies, clean cache, etc.
stop: ## Stop the project
$(DOCKER_COMPOSE) stop
start: ## Start Docker containers
$(DOCKER_COMPOSE_UP)
start-php: ## Start Docker container of PHP
$(DOCKER_COMPOSE_UP) php
start-mysql: ## Start Docker container of PHP
$(DOCKER_COMPOSE_UP) mysql
restart: ## Restart the project
$(DOCKER_COMPOSE) restart
build:
$(DOCKER_COMPOSE) pull --quiet --ignore-pull-failures
$(DOCKER_COMPOSE) build --pull
##
## Utils
## -----
##
assets: vendor ## Build assets
$(EXEC_NODE) yarn install
$(EXEC_NODE) yarn run dev
assets-prod: vendor ## Build assets
$(EXEC_NODE) yarn run build
cache-warmup: vendor ## Warmup caches
$(SYMFONY) cache:warmup --env=dev
cache-clear: vendor ## Clear caches
$(SYMFONY) cache:clear --env=dev
database: vendor ## Build the database
$(SYMFONY) doctrine:database:drop --if-exists --force
$(SYMFONY) doctrine:database:create --if-not-exists
$(SYMFONY) doctrine:migrations:migrate --no-interaction --allow-no-migration
migration: database
$(SYMFONY) doctrine:migrations:diff
migrate:
$(SYMFONY) doctrine:migrations:migrate --no-interaction --allow-no-migration
shell-database:
$(DOCKER_COMPOSE) exec database psql -Upostgres displeger
translations: vendor translations/messages.br.xlf ## Update the translation files
$(SYMFONY) tran:up br --output-format=xlf --force
$(SYMFONY) tran:up fr --output-format=xlf --force
$(SYMFONY) tran:up en --output-format=xlf --force
import-br:
$(SYMFONY) app:import-hunspell br_FR_mini.dic br_FR.aff
##
## Quality
## -----
##
php-stan: ## Perform PHPStan check
$(EXEC_PHP) vendor/phpstan/phpstan/phpstan analyse --no-progress --level 0 -c phpstan.neon src
php-cs-fixer: ## Run PHP-CS fixer
docker run -t --volume $(PWD):/project --workdir /project jakzal/phpqa:php7.1-alpine ci/php-cs-fixer
##
## Tests
## -----
##
phpunit: ## Run Behat tests without resetting database
$(EXEC_PHP) bin/phpunit