-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
62 lines (46 loc) · 2.19 KB
/
Copy pathMakefile
File metadata and controls
62 lines (46 loc) · 2.19 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
.PHONY: init build build-base workspace run test test-single test-coverage quality lint lint-fix check clean help
# Docker configuration
IMAGE_NAME = stateflow-php
DOCKER_RUN_IT = docker run --rm -it -v $(PWD):/app -v $(HOME)/.gitconfig:/home/appuser/.gitconfig:ro -v $(HOME)/.ssh/:/home/appuser/.ssh:ro -w /app $(IMAGE_NAME)
# Use Docker when available and the image exists; otherwise run natively on the host PHP binary
DOCKER_AVAILABLE := $(shell command -v docker >/dev/null 2>&1 && docker image inspect $(IMAGE_NAME) >/dev/null 2>&1 && echo true || echo false)
ifeq ($(DOCKER_AVAILABLE),true)
DOCKER_RUN = docker run --rm -v $(PWD):/app -w /app $(IMAGE_NAME)
else
DOCKER_RUN =
endif
help: ## Show this help message
@echo 'Usage: make [target]'
@echo ''
@echo 'Available targets:'
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-15s\033[0m %s\n", $$1, $$2}'
build: ## Build the Docker image with dependencies
@echo "Building Docker image..."
docker build --target dev -t $(IMAGE_NAME) .
build-base: ## Build base Docker image without dependencies
@echo "Building base Docker image..."
docker build --target base -t $(IMAGE_NAME)-base .
init: build ## Build Docker image (dependencies included)
@echo "Docker image built successfully with all dependencies!"
workspace: ## Enter the Docker container workspace
@echo "Entering workspace..."
$(DOCKER_RUN_IT) /bin/bash
run: ## Run arbitrary command in Docker container (usage: make run ARGS="composer update")
$(DOCKER_RUN) $(ARGS)
test: ## Run PHPUnit tests (parallel execution with 4 processes)
$(DOCKER_RUN) composer test
test-single: ## Run PHPUnit tests without parallelization
$(DOCKER_RUN) composer test:single
test-coverage: ## Run PHPUnit tests with coverage report
$(DOCKER_RUN) composer test:coverage
quality: ## Run PHPMD/PHPStan static analysis
$(DOCKER_RUN) composer quality
lint: ## Check code style
$(DOCKER_RUN) composer lint
lint-fix: ## Fix code style
$(DOCKER_RUN) composer lint:fix
check: ## Run all checks (code style, PHPStan, tests)
$(DOCKER_RUN) composer check
clean: ## Remove vendor directory and composer.lock
@echo "Cleaning up..."
rm -rf vendor composer.lock