-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
83 lines (60 loc) · 3.26 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
# Executables (local)
DOCKER_COMP = docker-compose
DOCKER_PART_PHP_NAME = php-twigx-bundle
SHELL = bash
# Docker containers
PHP_CONT_PHP = cd ./docker/ && $(DOCKER_COMP) exec $(DOCKER_PART_PHP_NAME)
# Executables
PHP = $(PHP_CONT_PHP) php
COMPOSER = $(PHP_CONT_PHP) composer
MAKE = $(PHP_CONT_PHP) make
# Misc
.DEFAULT_GOAL = help
.PHONY = help build up start down logs sh bash composer vendor make phpunit test analyze
## —— 🐳 The TwigX Bundle 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/'
## —— Docker 🐳 ————————————————————————————————————————————————————————————————
build: ## Builds the Docker images
cd ./docker/ && $(DOCKER_COMP) build --pull --no-cache
up: ## Start the docker hub in detached mode (no logs), pass the parameter "f=" to docker-compose file (default docker-compose.yml)
@$(eval f ?= docker-compose.yml)
cd ./docker/ && $(DOCKER_COMP) --file $(f) up --detach
start: build up vendor ## Build and start the containers
down: ## Stop the docker hub
cd ./docker/ && $(DOCKER_COMP) down --remove-orphans
logs: ## Show live logs
cd ./docker/ && $(DOCKER_COMP) logs --tail=0 --follow
bash: ## Connect to the PHP container
$(PHP_CONT_PHP) bash
## —— Composer 🧙 ——————————————————————————————————————————————————————————————
composer: ## Run composer, pass the parameter "c=" to run a given command, example: make composer c='req symfony/orm-pack'
@$(eval c ?=)
@$(COMPOSER) $(c)
install: ## Install vendors according to the current composer.lock file
install: c=install --prefer-dist --no-progress --no-interaction
install: composer
phpstan: ## Run composer phpstan
@$(COMPOSER) phpstan
phpstan-baseline: ## Run composer phpstan-baseline
@$(COMPOSER) phpstan-baseline
phpunit: ## Run composer phpunit
@$(COMPOSER) phpunit
phpunit-coverage: ## Run composer phpunit:coverage
@$(COMPOSER) phpunit:coverage
ecs: ## Run composer ecs
@$(COMPOSER) ecs
ecs-fix: ## Run composer ecs-fix
@$(COMPOSER) ecs:fix
test: ## Run composer tests
@$(COMPOSER) tests
analyze: ## Run composer analyze
@$(COMPOSER) analyze
## —— Makefile —————————————————————————————————————————————————————————————————
make: ## Run makefile in app pass the parameter "c=" to run a given command, example: make make c=npm-test
@$(eval c ?=)
@$(MAKE) $(c)
## —— Release 🚀 —————————————————————————————————————————————————————————————————
version: ## Release new version of the package, pass the parameter "v=" to the version, example: make version v=1.0.0
@$(eval v ?=)
./bin/version.sh $(v)