You've already forked Php-Template
feat: enhance makefile with emoji support and improve command output
All checks were successful
🧪✨ Tests Workflow / 🛡️ 🔒 Library Audit (push) Successful in 3m18s
🧪✨ Tests Workflow / 📝 ✨ Code Lint (push) Successful in 3m9s
🧪✨ Tests Workflow / 🛡️ 🔒 License Check (push) Successful in 3m19s
🧪✨ Tests Workflow / 🧪 ✨ Database Migrations (push) Successful in 3m35s
🧪✨ Tests Workflow / 🐙 🔍 Code Sniffer (push) Successful in 3m18s
🧪✨ Tests Workflow / 🧪 ✅ Unit Tests (push) Successful in 1m53s
All checks were successful
🧪✨ Tests Workflow / 🛡️ 🔒 Library Audit (push) Successful in 3m18s
🧪✨ Tests Workflow / 📝 ✨ Code Lint (push) Successful in 3m9s
🧪✨ Tests Workflow / 🛡️ 🔒 License Check (push) Successful in 3m19s
🧪✨ Tests Workflow / 🧪 ✨ Database Migrations (push) Successful in 3m35s
🧪✨ Tests Workflow / 🐙 🔍 Code Sniffer (push) Successful in 3m18s
🧪✨ Tests Workflow / 🧪 ✅ Unit Tests (push) Successful in 1m53s
This commit is contained in:
51
makefile
51
makefile
@@ -20,16 +20,28 @@ GREEN := \033[32m
|
||||
YELLOW := \033[33m
|
||||
RESET := \033[0m
|
||||
|
||||
# Fancy emoji
|
||||
SPARK := ✨
|
||||
ROCKET := 🚀
|
||||
WARN := ⚠️
|
||||
MAGNIFY := 🔍
|
||||
BUG := 🐞
|
||||
COMPOSE := 🐳
|
||||
TRASH := 🧹
|
||||
PROTO := 🧩
|
||||
CHECK := ✅
|
||||
CROSS := ❌
|
||||
|
||||
# Align width for help display
|
||||
HELP_COL_WIDTH := 26
|
||||
|
||||
# Help: auto-generate from targets with "##" comments
|
||||
help: ## Show this help
|
||||
@echo "Available commands:"
|
||||
@echo "$(SPARK) Available commands:"
|
||||
@awk -F':|##' '/^[a-zA-Z0-9._-]+:.*##/ {printf " %-$(HELP_COL_WIDTH)s - %s\n", $$1, $$3}' $(MAKEFILE_LIST) | sort
|
||||
|
||||
start: ## Start the development runtime container
|
||||
@printf "$(GREEN)Starting $(DEV_RUNTIME)$(RESET)\n"
|
||||
@printf "$(GREEN)$(ROCKET) Starting $(DEV_RUNTIME)$(RESET)\n"
|
||||
$(DOCKER) up $(DEV_RUNTIME) -d --no-recreate
|
||||
|
||||
sh: ## Open a shell in the development runtime container
|
||||
@@ -41,7 +53,7 @@ run: ## Run the application server in the development runtime container
|
||||
$(DEV) "rr serve"
|
||||
|
||||
stop: ## Stop and remove the development runtime container
|
||||
@printf "$(YELLOW)Stopping all containers$(RESET)\n"
|
||||
@printf "$(YELLOW)$(WARN) Stopping all containers$(RESET)\n"
|
||||
$(DOCKER) down
|
||||
|
||||
restart: ## Restart dev container (stop + start)
|
||||
@@ -49,7 +61,7 @@ restart: ## Restart dev container (stop + start)
|
||||
@$(MAKE) start
|
||||
|
||||
rebuild: ## Rebuild containers (useful after Dockerfile changes)
|
||||
@printf "$(YELLOW)Rebuilding containers$(RESET)\n"
|
||||
@printf "$(YELLOW)$(SPARK) Rebuilding containers$(RESET)\n"
|
||||
$(DOCKER) build
|
||||
$(DOCKER) up --force-recreate --build -d
|
||||
|
||||
@@ -61,59 +73,78 @@ migrate: ## Run database migrations in the migration container
|
||||
|
||||
# Composer helpers
|
||||
composer-install: ## Install PHP dependencies in the composer runtime container
|
||||
@printf "$(COMPOSE) $(GREEN)Installing PHP dependencies in $(COMPOSER_RUNTIME)$(RESET)\n"
|
||||
@$(DOCKER) up $(COMPOSER_RUNTIME) -d --no-recreate
|
||||
$(COMPOSER) "composer install --no-interaction --prefer-dist --optimize-autoloader --ignore-platform-reqs"
|
||||
|
||||
composer-require: ## Require a PHP package in the composer runtime container (usage: make composer-require package=vendor/package)
|
||||
ifndef package
|
||||
$(error package variable is required: make composer-require package=vendor/package)
|
||||
endif
|
||||
@printf "$(COMPOSE) $(MAGNIFY) Requiring package $(package) in $(COMPOSER_RUNTIME)$(RESET)\n"
|
||||
@$(DOCKER) up $(COMPOSER_RUNTIME) -d --no-recreate
|
||||
$(COMPOSER) "composer require $(package) --ignore-platform-reqs"
|
||||
|
||||
composer-require-dev: ## Require a PHP package as dev in the composer runtime container (usage: make composer-require-dev package=vendor/package)
|
||||
ifndef package
|
||||
$(error package variable is required: make composer-require-dev package=vendor/package)
|
||||
endif
|
||||
@printf "$(COMPOSE) $(MAGNIFY) Requiring dev package $(package) in $(COMPOSER_RUNTIME)$(RESET)\n"
|
||||
@$(DOCKER) up $(COMPOSER_RUNTIME) -d --no-recreate
|
||||
$(COMPOSER) "composer require --dev $(package) --ignore-platform-reqs"
|
||||
|
||||
composer-update: ## Update PHP dependencies in the composer runtime container
|
||||
@printf "$(COMPOSE) $(MAGNIFY) Updating PHP dependencies$(RESET)\n"
|
||||
@$(DOCKER) up $(COMPOSER_RUNTIME) -d --no-recreate
|
||||
$(COMPOSER) "composer update --no-interaction --prefer-dist --optimize-autoloader --ignore-platform-reqs"
|
||||
|
||||
enable-debug: ## Enable Xdebug in the development runtime container
|
||||
@$(MAKE) start
|
||||
@$(DOCKER) up $(DEV_RUNTIME) -d --no-recreate
|
||||
@printf "$(GREEN)$(BUG) Enabling Xdebug in $(DEV_RUNTIME)$(RESET)\n"
|
||||
$(DEV) "bin/xdebug.sh"
|
||||
|
||||
enable-coverage: ## Enable PCOV code coverage in the composer runtime container
|
||||
@$(MAKE) start
|
||||
@printf "$(GREEN)$(MAGNIFY) Enabling PCOV in $(COMPOSER_RUNTIME)$(RESET)\n"
|
||||
@$(DOCKER) up $(COMPOSER_RUNTIME) -d --no-recreate
|
||||
$(COMPOSER) "bin/pcov.sh"
|
||||
|
||||
protoc: ## Generate PHP gRPC code from .proto files
|
||||
@printf "$(GREEN)Setting up protoc-gen-php-grpc plugin$(RESET)\n"
|
||||
@printf "$(PROTO) $(GREEN)Setting up protoc-gen-php-grpc plugin$(RESET)\n"
|
||||
@curl -LOs $(PROTOC_URL)
|
||||
@tar -xzf protoc-gen-php-grpc-2025.1.5-darwin-arm64.tar.gz
|
||||
@printf "$(GREEN)Generating PHP gRPC code from .proto files$(RESET)\n"
|
||||
@printf "$(PROTO) $(GREEN)Generating PHP gRPC code from .proto files$(RESET)\n"
|
||||
@protoc --plugin=./protoc-gen-php-grpc-2025.1.5-darwin-arm64/protoc-gen-php-grpc \
|
||||
--php_out=./generated \
|
||||
--php-grpc_out=./generated \
|
||||
protos/example.proto
|
||||
@printf "$(GREEN)Cleaning up protoc-gen-php-grpc plugin files$(RESET)\n"
|
||||
@printf "$(TRASH) $(GREEN)Cleaning up protoc-gen-php-grpc plugin files$(RESET)\n"
|
||||
@rm -rf $(PROTOC_GEN_DIR) protoc-gen-php-grpc-2025.1.5-darwin-arm64.tar.gz
|
||||
|
||||
license-check: ## Check license headers in source files
|
||||
@printf "$(MAGNIFY) $(GREEN)Checking license headers$(RESET)\n"
|
||||
@$(DOCKER) up $(COMPOSER_RUNTIME) -d --no-recreate
|
||||
$(COMPOSER) "composer run-script tests:license || true"
|
||||
|
||||
# Developer tasks
|
||||
lint: ## Run linting (phpcs/phpstan) in composer runtime
|
||||
@printf "$(MAGNIFY) $(GREEN)Running linters$(RESET)\n"
|
||||
@$(DOCKER) up $(COMPOSER_RUNTIME) -d --no-recreate
|
||||
$(COMPOSER) "composer run-script tests:lint || true"
|
||||
$(COMPOSER) "composer run-script tests:phpstan || true"
|
||||
|
||||
fmt: ## Format code (php-cs-fixer)
|
||||
@printf "$(MAGNIFY) $(GREEN)Formatting code$(RESET)\n"
|
||||
@$(DOCKER) up $(COMPOSER_RUNTIME) -d --no-recreate
|
||||
$(COMPOSER) "composer run-script tests:lint:fix"
|
||||
|
||||
test: ## Run test suite (phpunit)
|
||||
@printf "$(CHECK) $(GREEN)Running unit tests$(RESET)\n"
|
||||
@$(DOCKER) up $(COMPOSER_RUNTIME) -d --no-recreate
|
||||
$(COMPOSER) "composer run-script tests:unit || true"
|
||||
|
||||
# Convenience aliases
|
||||
dev: run ## Alias for start
|
||||
ci: composer-install test ## CI-like local flow
|
||||
ci: composer-install license-check lint test ## CI-like local flow
|
||||
down: stop ## Alias for stop
|
||||
up: start ## Alias for start
|
||||
|
||||
|
||||
Reference in New Issue
Block a user