-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
78 lines (58 loc) · 2.91 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
$(shell (if [ ! -e .env ]; then cp default.env .env; fi))
include .env
export
RUN_ARGS = $(filter-out $@,$(MAKECMDGOALS))
.PHONY: fix-permission
fix-permission: ## fix permission for docker env
sudo chown -R $(shell whoami):$(shell whoami) *
sudo chown -R $(shell whoami):$(shell whoami) .docker/*
.PHONY: build
build: ## build environment and initialize composer and project dependencies
docker-compose build
make composer-install
.PHONY: composer-install
composer-install: ## Install project dependencies
docker-compose run --rm --no-deps php sh -lc 'composer install'
.PHONY: composer-update
composer-update: ## Update project dependencies
docker-compose run --rm --no-deps php sh -lc 'composer update'
.PHONY: composer-outdated
composer-outdated: ## Show outdated project dependencies
docker-compose run --rm --no-deps php sh -lc 'composer outdated'
.PHONY: composer-validate
composer-validate: ## Validate composer config
docker-compose run --rm --no-deps php sh -lc 'composer validate --no-check-publish'
.PHONY: composer
composer: ## Execute composer command
docker-compose run --rm --no-deps php sh -lc "composer $(RUN_ARGS)"
.PHONY: phpunit
phpunit: ## execute project unit tests
docker-compose run --rm php sh -lc "./vendor/bin/phpunit $(conf)"
.PHONY: style
style: ## executes php analizers
docker-compose run --rm --no-deps php sh -lc './vendor/bin/phpstan analyse -l 6 -c phpstan.neon src tests'
docker-compose run --rm --no-deps php sh -lc './vendor/bin/psalm --config=psalm.xml'
.PHONY: lint
lint: ## checks syntax of PHP files
docker-compose run --rm --no-deps php sh -lc './vendor/bin/parallel-lint ./ --exclude vendor'
.PHONY: logs
logs: ## look for service logs
docker-compose logs -f $(RUN_ARGS)
.PHONY: help
help: ## Display this help message
@cat $(MAKEFILE_LIST) | grep -e "^[a-zA-Z_\-]*: *.*## *" | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
.PHONY: php-shell
php-shell: ## PHP shell
docker-compose run --rm php sh -l
unit-tests: ## Run unit-tests suite
docker-compose run --rm php sh -lc 'vendor/bin/phpunit --testsuite unit-tests'
static-analysis: style coding-standards ## Run phpstan, easycoding standarts code static analysis
coding-standards: ## Run check and validate code standards tests
docker-compose run --rm --no-deps php sh -lc 'vendor/bin/ecs check src tests'
docker-compose run --rm --no-deps php sh -lc 'vendor/bin/phpmd src/ text phpmd.xml'
coding-standards-fixer: ## Run code standards fixer
docker-compose run --rm --no-deps php sh -lc 'vendor/bin/ecs check src tests --fix'
security-tests: ## The SensioLabs Security Checker
docker-compose run --rm --no-deps php sh -lc 'vendor/bin/security-checker security:check --end-point=http://security.sensiolabs.org/check_lock'
.PHONY: test lint static-analysis phpunit coding-standards composer-validate
test: build lint static-analysis phpunit coding-standards composer-validate stop ## Run all test suites