-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
75 lines (55 loc) · 1.68 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
COMPOSER ?= composer
DOCKER_COMPOSE = docker-compose
PROJECT = "TicTacToe."
COMPOSE_PROJECT_NAME ?= $(notdir $(shell pwd))
PHP_SERVICE = php
PHP_CMD = php
ifeq ($(RUNNER), PIPELINE)
CMD :=
else
CMD := docker-compose exec $(PHP_SERVICE)
endif
all: container-up clear composer lint-composer lint-php phpcs tests
lint-composer:
@echo "\n==> Validating composer.json and composer.lock:"
$(CMD) $(COMPOSER) validate --strict
lint-php:
@echo "\n==> Validating all php files:"
$(CMD) find src -type f -iname '*php' -exec $(PHP_CMD) -l {} \;
composer:
@echo "\n==> Running composer install, runner $(RUNNER)"
$(CMD) $(COMPOSER) install
lint: lint-composer lint-php
clear:
$(CMD) rm -rf vendor
$(CMD) rm -rf bin/php*
phpcs:
@echo "\n==> Checking style guidelines"
$(CMD) vendor/bin/phpcs --standard=phpcs.xml -p
phpcbf:
$(CMD) vendor/bin/phpcbf
coverage:
@echo "\n==> Generating coverage report"
$(CMD) vendor/bin/phpunit --coverage-html coverage
tests:
@echo "\n==> Running tests"
$(CMD) vendor/bin/phpunit
play:
$(CMD) $(PHP_CMD) main.php
stan:
@echo "\n==> Running stan for analysis"
$(CMD) vendor/bin/phpstan analyse --memory-limit=-1 src
container-stop:
@echo "\n==> Stopping docker container"
$(DOCKER_COMPOSE) stop
container-down:
@echo "\n==> Removing docker container"
$(DOCKER_COMPOSE) down
container-remove:
@echo "\n==> Removing docker container(s)"
$(DOCKER_COMPOSE) rm
container-up:
@echo "\n==> Docker container building and starting ..."
$(DOCKER_COMPOSE) up --build -d
tear-down: clear container-stop container-down container-remove
.PHONY: lint-php lint-composer phpcs phpcbf composer clear tests coverage container-up container-stop container-down container-remove