-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
71 lines (51 loc) · 2.52 KB
/
Makefile
File metadata and controls
71 lines (51 loc) · 2.52 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
# —— 🛠️ Configuration ————————————————————————————————————————————————————————————————
.DEFAULT_GOAL := help
.PHONY: help build installdeps updatedeps composer csfixer cscheck phpstan test twigcs qa php frontenddeps frontendtest
TOOLS_IMAGE ?= zhortein-datatable-tools:php84
APP_DIR := /app
TTY := $(shell test -t 0 && echo -it)
UID := $(shell id -u)
GID := $(shell id -g)
USER_FLAGS := --user $(UID):$(GID)
NPM_CACHE_HOST := $(PWD)/.cache/npm
NPM_CACHE_CONT := /tmp/npm-cache
COMPOSER_CACHE_HOST := $(PWD)/.cache/composer
COMPOSER_CACHE_CONT := /tmp/composer-cache
DOCKER_VOLUME := -v "$(PWD)":$(APP_DIR) -w $(APP_DIR) -v "$(COMPOSER_CACHE_HOST)":$(COMPOSER_CACHE_CONT) -v "$(NPM_CACHE_HOST)":$(NPM_CACHE_CONT)
DOCKER_RUN := docker run --rm $(TTY) $(USER_FLAGS) -e COMPOSER_CACHE_DIR=$(COMPOSER_CACHE_CONT) -e NPM_CONFIG_CACHE=$(NPM_CACHE_CONT) $(DOCKER_VOLUME) $(TOOLS_IMAGE)
## —— 🐳 Zhortein Datatable Bundle Makefile 🐳 ————————————————————————————————————————
help: ## 📖 Show available commands
@echo ""
@echo "📖 Available make commands:"
@echo ""
@grep -E '(^[a-zA-Z0-9\./_-]+:.*?##.*$$)|(^##)' $(MAKEFILE_LIST) \
| awk 'BEGIN {FS = ":.*?## "}{printf "\033[32m%-30s\033[0m %s\n", $$1, $$2}' \
| sed -e 's/\[32m##/[33m/'
build: ## Build local tooling image
@docker build -t $(TOOLS_IMAGE) -f docker/Dockerfile .
installdeps: build ## Install Composer deps
@mkdir -p .cache/composer
$(DOCKER_RUN) composer install --prefer-dist --no-progress
updatedeps: build ## Update deps
$(DOCKER_RUN) composer update --prefer-dist --no-progress
composer: build ## Run composer (usage: make composer ARGS='update')
$(DOCKER_RUN) composer $(ARGS)
csfixer: build ## Run PHP-CS-Fixer and fix files
$(DOCKER_RUN) composer cs:fix
cscheck: build ## Run PHP-CS-Fixer in check mode
$(DOCKER_RUN) composer cs:check
phpstan: build ## Run PHPStan
$(DOCKER_RUN) composer phpstan
test: build ## Run PHPUnit
$(DOCKER_RUN) composer test
twigcs: build ## Run twigcs
$(DOCKER_RUN) composer twigcs
qa: build ## Run all QA checks
$(DOCKER_RUN) composer qa
php: build ## Run PHP command (usage: make php ARGS='script.php')
$(DOCKER_RUN) php $(ARGS)
frontenddeps: build ## Install Composer deps
@mkdir -p .cache/composer .cache/npm
$(DOCKER_RUN) npm install
frontendtest: build ## Run frontend tests
$(DOCKER_RUN) npm run test:frontend