Skip to content
/ app-api Public template
generated from yiisoft/package-template
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
- Bug #260: Fix psalm cache directory in configuration file (@vjik)
- Enh #260, #265: Update composer dependencies and refactor to replace use of deprecated classes (@vjik)
- Chg #265: Refactor `PresenterInterface` and implementations for preparing data only (@vjik)
- Enh #266: Add grouping to `make` help output (@Xakki, @samdark)

## 1.1.0 December 22, 2025

Expand Down
53 changes: 33 additions & 20 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -26,53 +26,57 @@ DOCKER_COMPOSE_TEST := docker compose -f docker/compose.yml -f docker/test/compo
#

ifeq ($(PRIMARY_GOAL),build)
build: ## Build docker images
build: ## Build docker images.
$(DOCKER_COMPOSE_DEV) build $(CLI_ARGS)
endif

ifeq ($(PRIMARY_GOAL),up)
up: ## Up the dev environment
up: ## Up the dev environment.
$(DOCKER_COMPOSE_DEV) up -d --remove-orphans
endif

ifeq ($(PRIMARY_GOAL),down)
down: ## Down the dev environment
down: ## Down the dev environment.
$(DOCKER_COMPOSE_DEV) down --remove-orphans
endif

ifeq ($(PRIMARY_GOAL),stop)
stop: ## Stop the dev environment
stop: ## Stop the dev environment.
$(DOCKER_COMPOSE_DEV) stop
endif

ifeq ($(PRIMARY_GOAL),clear)
clear: ## Remove development docker containers and volumes
clear: ## Remove development docker containers and volumes.
$(DOCKER_COMPOSE_DEV) down --volumes --remove-orphans
endif

ifeq ($(PRIMARY_GOAL),shell)
shell: ## Get into container shell
shell: ## Get into container shell.
$(DOCKER_COMPOSE_DEV) exec app /bin/bash
endif

#
# Tools
#

ifeq ($(PRIMARY_GOAL),yii)
yii: ## Execute Yii command
yii: ## Execute Yii command.
$(DOCKER_COMPOSE_DEV) run --rm app ./yii $(CLI_ARGS)
.PHONY: yii
endif

ifeq ($(PRIMARY_GOAL),composer)
composer: ## Run Composer
composer: ## Run Composer.
$(DOCKER_COMPOSE_DEV) run --rm app composer $(CLI_ARGS)
endif

ifeq ($(PRIMARY_GOAL),rector)
rector: ## Run Rector
rector: ## Run Rector.
$(DOCKER_COMPOSE_DEV) run --rm app ./vendor/bin/rector $(CLI_ARGS)
endif

ifeq ($(PRIMARY_GOAL),cs-fix)
cs-fix: ## Run PHP CS Fixer
cs-fix: ## Run PHP CS Fixer.
$(DOCKER_COMPOSE_DEV) run --rm app ./vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.php --diff
endif

Expand All @@ -81,27 +85,27 @@ endif
#

ifeq ($(PRIMARY_GOAL),test)
test:
test: ## Run tests.
$(DOCKER_COMPOSE_TEST) run --rm app ./vendor/bin/codecept run $(CLI_ARGS)
endif

ifeq ($(PRIMARY_GOAL),test-coverage)
test-coverage:
test-coverage: ## Run tests with coverage.
$(DOCKER_COMPOSE_TEST) run --rm app ./vendor/bin/codecept run --coverage --coverage-html --disable-coverage-php
endif

ifeq ($(PRIMARY_GOAL),codecept)
codecept: ## Run Codeception
codecept: ## Run Codeception.
$(DOCKER_COMPOSE_TEST) run --rm app ./vendor/bin/codecept $(CLI_ARGS)
endif

ifeq ($(PRIMARY_GOAL),psalm)
psalm: ## Run Psalm
psalm: ## Run Psalm.
$(DOCKER_COMPOSE_DEV) run --rm app ./vendor/bin/psalm $(CLI_ARGS)
endif

ifeq ($(PRIMARY_GOAL),composer-dependency-analyser)
composer-dependency-analyser: ## Run Composer Dependency Analyser
composer-dependency-analyser: ## Run Composer Dependency Analyser.
$(DOCKER_COMPOSE_DEV) run --rm app ./vendor/bin/composer-dependency-analyser --config=composer-dependency-analyser.php $(CLI_ARGS)
endif

Expand All @@ -110,17 +114,17 @@ endif
#

ifeq ($(PRIMARY_GOAL),prod-build)
prod-build: ## PROD | Build an image
prod-build: ## Build an image.
docker build --file docker/Dockerfile --target prod --pull -t ${IMAGE}:${IMAGE_TAG} .
endif

ifeq ($(PRIMARY_GOAL),prod-push)
prod-push: ## PROD | Push image to repository
prod-push: ## Push image to repository.
docker push ${IMAGE}:${IMAGE_TAG}
endif

ifeq ($(PRIMARY_GOAL),prod-deploy)
prod-deploy: ## PROD | Deploy to production
prod-deploy: ## Deploy to production.
@set -euo pipefail; \
docker -H ${PROD_SSH} stack deploy --prune --detach=false --with-registry-auth -c docker/compose.yml -c docker/prod/compose.yml ${STACK_NAME} 2>&1 | tee deploy.log; \
if grep -qiE 'rollback:|update rolled back' deploy.log; then \
Expand All @@ -141,7 +145,16 @@ endif
#

ifeq ($(PRIMARY_GOAL),help)
# Output the help for each task, see https://marmelab.com/blog/2016/02/29/auto-documented-makefile.html
help: ## This help.
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)
@awk 'BEGIN { printf "\nUsage:\n make \033[36m<target>\033[0m\n" } \
/^#$$/ { blank = 1; next } \
blank && /^# [a-zA-Z]/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 3); blank = 0; next } \
/^[a-zA-Z_-]+:([^=]|$$)/ { \
split($$0, parts, "##"); \
target = parts[1]; sub(/:.*/, "", target); \
desc = parts[2]; \
gsub(/^[[:space:]]+|[[:space:]]+$$/, "", desc); \
printf " \033[36m%-25s\033[0m %s\n", target, desc; \
blank = 0; \
Comment on lines +157 to +158
Copy link

Copilot AI Mar 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new make help awk parser prints any make rule that matches the target regex, even if it has no ## description. This changes prior behavior (undocumented targets were hidden) and can lead to empty-description entries or noise if other included makefiles contain rules. Consider filtering to only lines containing ## (or skipping when parts[2] is empty) so the help output stays intentional and stable.

Suggested change
printf " \033[36m%-25s\033[0m %s\n", target, desc; \
blank = 0; \
if (desc != "") { \
printf " \033[36m%-25s\033[0m %s\n", target, desc; \
blank = 0; \
} \

Copilot uses AI. Check for mistakes.
}' $(MAKEFILE_LIST)
endif
4 changes: 0 additions & 4 deletions docker/.env
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
STACK_NAME=app-api

#
# Development
#

DEV_PORT=80

#
# Production
#

PROD_HOST=app-api.example.com
PROD_SSH="ssh://docker-web"
Expand Down