-
-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathMakefile
More file actions
76 lines (56 loc) · 2.8 KB
/
Makefile
File metadata and controls
76 lines (56 loc) · 2.8 KB
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
PHP_VERSION=8.5
PROJECT_NAME=$(shell basename $(CURDIR))
UID=$(shell id -u)
GID=$(shell id -g)
IMAGE="${PROJECT_NAME}:${PHP_VERSION}"
.PHONY: help
help:
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
setup: build-php install test-load-fixtures ## Initialize project
build-php: ## Build PHP image
@echo "Build php ${PHP_VERSION}"
@DOCKER_BUILDKIT=1 docker build -t "${IMAGE}" --build-arg "VERSION=${PHP_VERSION}" --build-arg "UID=${UID}" --build-arg "GID=${GID}" .
install: ## Install PHP dependencies for given PHP version
rm -f composer.lock
@$(call run-php,composer install --no-progress --prefer-dist --optimize-autoloader)
rm -f tools/composer.lock
@$(call run-php,composer --working-dir=tools install --no-progress --prefer-dist --optimize-autoloader)
shell: ## Execute shell in given PHP version container
@$(call run-php,bash)
test: ## Execute tests for given PHP version
@$(call run-php,composer test -- $(filter-out $@,$(MAKECMDGOALS)))
test-ci: ## Execute tests and CI for given PHP version
@$(call run-php,composer test:ci -- $(filter-out $@,$(MAKECMDGOALS)))
test-load-fixtures: ## Execute tests and load fixtures for given PHP version
@$(call run-php,composer test:load-fixtures -- $(filter-out $@,$(MAKECMDGOALS)))
lint: ## Execute lint for given PHP version
$(MAKE) php-cs-fixer $(filter-out $@,$(MAKECMDGOALS))
$(MAKE) rector $(filter-out $@,$(MAKECMDGOALS))
$(MAKE) phpstan $(filter-out $@,$(MAKECMDGOALS))
lint-fix: ## Execute lint fixing for given PHP version
$(MAKE) php-cs-fixer-fix $(filter-out $@,$(MAKECMDGOALS))
$(MAKE) rector-fix $(filter-out $@,$(MAKECMDGOALS))
php-cs-fixer: ## Execute php-cs-fixer for given PHP version
@$(call run-php,composer php-cs-fixer -- $(filter-out $@,$(MAKECMDGOALS)))
php-cs-fixer-fix: ## Execute php-cs-fixer fixing for given PHP version
@$(call run-php,composer php-cs-fixer:fix -- $(filter-out $@,$(MAKECMDGOALS)))
rector: ## Execute rector for given PHP version
@$(call run-php,composer rector -- $(filter-out $@,$(MAKECMDGOALS)))
rector-fix: ## Execute rector fixing for given PHP version
@$(call run-php,composer rector:fix -- $(filter-out $@,$(MAKECMDGOALS)))
phpstan: ## Execute PHPStan for given PHP version
@$(call run-php,composer phpstan -- $(filter-out $@,$(MAKECMDGOALS)))
ci: ## Execute CI scripts for given PHP version
$(MAKE) setup
@$(call run-php,composer ci -- $(filter-out $@,$(MAKECMDGOALS)))
generate-css-referentials: ## Generate referentials for given PHP version
@$(call run-php,composer generate-css-referentials -- $(filter-out $@,$(MAKECMDGOALS)))
## Run PHP for given version
define run-php
@docker run -it --rm -v ${PWD}:${PWD} -w ${PWD} "${IMAGE}" $(1)
endef
#############################
# Argument fix workaround
#############################
%:
@: