-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
52 lines (40 loc) · 1.55 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
.PHONY: ${TARGETS}
.DEFAULT_GOAL := help
STRIPE_MOCK_VERSION=0.78.0
DIR := ${CURDIR}
QA_IMAGE := jakzal/phpqa:php7.3-alpine
define say_red =
echo "\033[31m$1\033[0m"
endef
define say_green =
echo "\033[32m$1\033[0m"
endef
define say_yellow =
echo "\033[33m$1\033[0m"
endef
help:
@echo "\033[33mUsage:\033[0m"
@echo " make [command]"
@echo ""
@echo "\033[33mAvailable commands:\033[0m"
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort \
| awk 'BEGIN {FS = ":.*?## "}; {printf " \033[32m%s\033[0m___%s\n", $$1, $$2}' | column -ts___
install: ## Install all applications
@$(call say_green,"Downloading Stripe mock server")
@curl -L "https://github.com/stripe/stripe-mock/releases/download/v${STRIPE_MOCK_VERSION}/stripe-mock_${STRIPE_MOCK_VERSION}_linux_amd64.tar.gz" -o "var/stripe-mock.tar.gz"
@$(call say_green,"Unpacking Stripe mock server")
@tar -zxf "var/stripe-mock.tar.gz" -C "var/"
@$(call say_green,"Installin PHP dependencies")
@composer install
start: ## Start application
@var/stripe-mock > /dev/null &
stop: ## Stop the application
@pkill stripe-mock || $(call say_red,"No running Stripe mock server")
test: ## Launch tests
@vendor/bin/phpunit
cs-lint: ## Verify check styles
@docker run --rm -v $(DIR):/project -w /project $(QA_IMAGE) php-cs-fixer fix --diff-format udiff --dry-run -vvv
cs-fix: ## Apply Check styles
@docker run --rm -v $(DIR):/project -w /project $(QA_IMAGE) php-cs-fixer fix --diff-format udiff -vvv
phpstan: ## Run PHPStan
@docker run --rm -v $(DIR):/project -w /project $(QA_IMAGE) phpstan analyse