-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
57 lines (44 loc) · 1.49 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
ifneq (, $(shell which docker-compose))
DOCKER_COMPOSE := docker-compose
endif
ifneq (, $(shell docker compose version 2>/dev/null))
DOCKER_COMPOSE := docker compose
endif
ifndef DOCKER_COMPOSE
$(error "No docker-compose nor valid 'docker compose' in $(PATH), what now?")
endif
dcphp=$$(echo "$(DOCKER_COMPOSE) exec php")
.PHONY: it
it: fix stan test ## Run the commonly used targets
.PHONY: help
help: ## Displays this list of targets with descriptions
@grep -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(firstword $(MAKEFILE_LIST)) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[32m%-30s\033[0m %s\n", $$1, $$2}'
.PHONY: setup
setup: build vendor ## Setup the local environment
.PHONY: build
build: ## Build the local Docker containers
${DOCKER_COMPOSE} build --pull --build-arg USER_ID=$(shell id --user) --build-arg GROUP_ID=$(shell id --group)
.PHONY: up
up: ## Bring up the docker compose stack
${DOCKER_COMPOSE} up --detach
.PHONY: fix
fix: rector php-cs-fixer
.PHONY: rector
rector: up
${dcphp} vendor/bin/rector process
.PHONY: php-cs-fixer
php-cs-fixer: up
${dcphp} vendor/bin/php-cs-fixer fix
.PHONY: stan
stan: up ## Runs a static analysis with phpstan
${dcphp} vendor/bin/phpstan
.PHONY: test
test: up ## Runs auto-review, unit, and integration tests with phpunit
${dcphp} vendor/bin/phpunit
vendor: up composer.json
${dcphp} composer update
${dcphp} composer validate --strict
${dcphp} composer normalize
.PHONY: php
php: up ## Open an interactive shell into the PHP container
${dcphp} bash