forked from paul-thebaud/phpunitgen-console
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
55 lines (41 loc) · 2 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
# Executables
DOCKER_COMPOSE?=docker compose
DOCKER_EXEC?=$(DOCKER_COMPOSE) exec -it
COMPOSER?=$(DOCKER_EXEC) php composer
# Misc
default: help
##
## —— Setup ————————————————————————————————————————————————————————————————————
.PHONY: build
build: ## Build and start containers.
@$(DOCKER_COMPOSE) up --build --no-recreate -d
.PHONY: rebuild
rebuild: ## Force rebuild and start all containers.
@$(DOCKER_COMPOSE) up --build --force-recreate --remove-orphans -d
.PHONY: up
up: ## Start containers without building.
@$(DOCKER_COMPOSE) up -d
.PHONY: stop
stop: ## Stop containers.
@$(DOCKER_COMPOSE) stop
.PHONY: down
down: ## Stop and remove containers.
@$(DOCKER_COMPOSE) down --remove-orphans --timeout=2
##
## —— Executables ——————————————————————————————————————————————————————————————
.PHONY: composer
composer: ## Run a Composer command (e.g. make composer c="update").
@$(COMPOSER) $(c)
##
## —— Tests ————————————————————————————————————————————————————————————————————
.PHONY: test
test: ## Run tests.
@$(DOCKER_EXEC) php php -d xdebug.mode=coverage vendor/bin/phpunit -c phpunit.xml.dist
##
## —— Utilities ————————————————————————————————————————————————————————————————
.PHONY: sh
sh: ## Run BASH on PHP container.
@$(DOCKER_EXEC) php bash
.PHONY: help
help: ## Show help for each of the Makefile recipes.
@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/'