-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
55 lines (40 loc) · 1.86 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
CONTAINER_NAME=symfony-examples-doctrine-fixture
.DEFAULT_GOAL := help
.PHONY: help
help : Makefile # Print commands help.
@grep -E '(^[a-zA-Z_-]+:.*?##.*$$)|(^##)' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[32m%-30s\033[0m %s\n", $$1, $$2}' | sed -e 's/\[32m##/[33m/'
ifneq (, $(shell which podman 2> /dev/null))
CONTAINER_ENGINE=podman
endif
ifneq (, $(shell which docker 2> /dev/null))
CONTAINER_ENGINE=docker
endif
##
## Container commands
##----------------------------------------------------------------------------------------------------------------------
.PHONY: build run
build: ## Build container for podman
${CONTAINER_ENGINE} build -f Containerfile -t ${CONTAINER_NAME} --target local .
run: ## Run container for podman
${CONTAINER_ENGINE} run --rm -it -v ${PWD}:/var/www/symfony --privileged -p 8000:8000 ${CONTAINER_NAME} bash
##
## Project commands
##----------------------------------------------------------------------------------------------------------------------
.PHONY: install
install: ## Build and run container
$(MAKE) build
${CONTAINER_ENGINE} run --rm -it -v ${PWD}:/var/www/symfony --privileged ${CONTAINER_NAME} composer install -n
##
## Quality tools
##----------------------------------------------------------------------------------------------------------------------
.PHONY: fix phpstan unit check-all
fix: ## Run php cs fixer for podman
${CONTAINER_ENGINE} run --rm -it -v ${PWD}:/var/www/symfony --privileged ${CONTAINER_NAME} vendor/bin/php-cs-fixer fix
phpstan: ## Run phpstan for podman
${CONTAINER_ENGINE} run --rm -it -v ${PWD}:/var/www/symfony --privileged ${CONTAINER_NAME} vendor/bin/phpstan
unit: ## Run phpstan for podman
${CONTAINER_ENGINE} run --rm -it -v ${PWD}:/var/www/symfony --privileged ${CONTAINER_NAME} vendor/bin/phpunit
check-all: ## Run all tests for podman
$(MAKE) fix
$(MAKE) phpstan
$(MAKE) unit