-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
105 lines (88 loc) · 2.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
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
# leave empty to disable
# -v - verbose;
# -vv - more details
# -vvv - enable connection debugging
DEBUG_VERBOSITY ?=
DOCKER_CMD =
COMPOSER_RUN = $(DOCKER_CMD) composer
ifneq ($(TERM),)
BLACK := $(shell tput setaf 0)
RED := $(shell tput setaf 1)
GREEN := $(shell tput setaf 2)
YELLOW := $(shell tput setaf 3)
LIGHTPURPLE := $(shell tput setaf 4)
PURPLE := $(shell tput setaf 5)
BLUE := $(shell tput setaf 6)
WHITE := $(shell tput setaf 7)
RST := $(shell tput sgr0)
else
BLACK := ""
RED := ""
GREEN := ""
YELLOW := ""
LIGHTPURPLE := ""
PURPLE := ""
BLUE := ""
WHITE := ""
RST := ""
endif
MAKE_LOGFILE = /tmp/wayofdev-php-package-tpl.log
MAKE_CMD_COLOR := $(BLUE)
# https://phpstan.org/user-guide/output-format
export PHPSTAN_OUTPUT_FORMAT ?= table
help:
@echo 'Management commands for package:'
@echo 'Usage:'
@echo ' ${MAKE_CMD_COLOR}make${RST} Setups dependencies for fresh-project, like composer install, git hooks and others...'
@grep -E '^[a-zA-Z_0-9%-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf " ${MAKE_CMD_COLOR}make %-21s${RST} %s\n", $$1, $$2}'
@echo
@echo ' 📑 Logs are stored in $(MAKE_LOGFILE)'
@echo
@echo ' 📦 Package php-package-tpl (github.com/wayofdev/php-package-tpl)'
@echo ' 🤠 Author Andrij Orlenko (github.com/lotyp)'
@echo ' 🏢 ${YELLOW}Org wayofdev (github.com/wayofdev)${RST}'
.PHONY: help
all: install hooks
.PHONY: all
prepare:
mkdir -p .build/php-cs-fixer
.PHONY: prepare
# Composer
# ------------------------------------------------------------------------------------
install: ## Installs composer dependencies
$(COMPOSER_RUN) install
.PHONY: install
update: ## Updates composer dependencies by running composer update command
$(COMPOSER_RUN) update
.PHONY: update
# Testing
# ------------------------------------------------------------------------------------
cs-diff: prepare ## Runs php-cs-fixer in dry-run mode and shows diff which will by applied
$(COMPOSER_RUN) cs-diff
.PHONY: cs-diff
cs-fix: prepare ## Fixes code to follow coding standards using php-cs-fixer
$(COMPOSER_RUN) cs-fix
.PHONY: cs-fix
stan: ## Runs phpstan – static analysis tool
$(COMPOSER_RUN) stan
.PHONY: stan
stan-ci:
$(COMPOSER_RUN) stan-ci
.PHONY: stan-ci
test: ## Run project php-unit and pest tests
$(COMPOSER_RUN) test
.PHONY: test
test-cc: ## Run project php-unit and pest tests in coverage mode and build report
$(COMPOSER_RUN) test-cc
.PHONY: test-cc
# Yaml Actions
# ------------------------------------------------------------------------------------
lint: ## Lints yaml files inside project
yamllint .
.PHONY: lint
# Git Actions
# ------------------------------------------------------------------------------------
hooks: ## Install git hooks from pre-commit-config
pre-commit install
pre-commit autoupdate
.PHONY: hooks