Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
67 lines (65 loc) · 3.9 KB
/
Copy pathMakefile
File metadata and controls
67 lines (65 loc) · 3.9 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
# Exported because docker-compose.yaml reads it for the image tag.
export PHP_VERSION ?= 8.1
include .env
PROJECT ?= Aws
ROOT=/usr/src/myapp/src
DC_RUN = ${DOCKER_COMPOSE} run --rm
DC_RUN_PHP = $(DC_RUN) -w ${ROOT}/${PROJECT} php
# .github/ci runs on the PHP version its composer.json requires, whatever PHP_VERSION is.
DC_RUN_CI = PHP_VERSION=8.5 $(DC_RUN) -T -w /usr/src/myapp php env XDEBUG_MODE=off sh -c 'composer install --quiet --working-dir=.github/ci && $$0 "$$@"'
.DEFAULT_GOAL : help
help: ## Show this help
@echo "example: PROJECT=Aws PHP_VERSION=8.1 make <command>"
@printf "\033[33m%s:\033[0m\n" 'Available commands'
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z0-9_-]+:.*?## / {printf " \033[32m%-18s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)
projects: ## List PROJECT values
@$(DC_RUN_CI) php .github/ci/matrix.php --projects
services: ## Start the services PROJECT's tests need
@services=$$($(DC_RUN_CI) php .github/ci/matrix.php --services ${PROJECT}) || exit 1; \
if [ -n "$$services" ]; then $(DOCKER_COMPOSE) up -d --wait $$services; else echo "${PROJECT} needs no services"; fi
ci-test: ## Test the CI matrix script
$(DC_RUN_CI) .github/ci/vendor/bin/phpunit -c .github/ci/phpunit.xml.dist
ci-cells: ## List the CI cells for PROJECT
@$(DC_RUN_CI) php .github/ci/matrix.php --project ${PROJECT}
ci-generate: ## Write each project's CI workflow
$(DC_RUN_CI) php .github/ci/matrix.php --generate
ci-check: ## Check the repository as CI does
$(DC_RUN_CI) php .github/ci/matrix.php --check
all-checks: style validate phan psalm phpstan test ## All checks + tests
all: update all-checks ## Everything
all-lowest: update-lowest all-checks ## Everything, with lowest supported versions
build: ## Build image
$(DOCKER_COMPOSE) build --build-arg PHP_VERSION=${PHP_VERSION} php
install: ## Install dependencies
$(DC_RUN_PHP) env XDEBUG_MODE=off sh -c 'composer config --no-interaction --global policy.advisories.block false && composer install'
update: ## Update dependencies
$(DC_RUN_PHP) env XDEBUG_MODE=off sh -c 'composer config --no-interaction --global policy.advisories.block false && composer update --no-interaction'
update-lowest: ## Update dependencies to lowest supported versions
$(DC_RUN_PHP) env XDEBUG_MODE=off sh -c 'composer config --no-interaction --global policy.advisories.block false && composer update --no-interaction --prefer-lowest'
test: ## Run all tests
$(DC_RUN_PHP) env XDEBUG_MODE=off vendor/bin/phpunit --testdox --colors=always
test-unit: ## Run unit tests
$(DC_RUN_PHP) env XDEBUG_MODE=coverage vendor/bin/phpunit --testsuite unit --colors=always --coverage-text --testdox --coverage-clover coverage.clover --coverage-html=tests/coverage/html
test-integration: ## Run integration tests
$(DC_RUN_PHP) env XDEBUG_MODE=off vendor/bin/phpunit --testsuite integration --testdox --colors=always
test-coverage: ## Run unit tests and generate coverage
$(DC_RUN_PHP) env XDEBUG_MODE=coverage vendor/bin/phpunit --coverage-html=tests/coverage/html
phan: ## Run phan
$(DC_RUN_PHP) env XDEBUG_MODE=off env PHAN_DISABLE_XDEBUG_WARN=1 vendor/bin/phan
psalm: ## Run psalm
$(DC_RUN_PHP) env XDEBUG_MODE=off vendor/bin/psalm --threads=1 --no-cache --php-version=${PHP_VERSION}
psalm-info: ## Run psalm with info
$(DC_RUN_PHP) env XDEBUG_MODE=off vendor/bin/psalm --show-info=true --threads=1
phpstan: ## Run phpstan
$(DC_RUN_PHP) env XDEBUG_MODE=off vendor/bin/phpstan analyse --memory-limit=256M
validate: ## Validate composer file
$(DC_RUN_PHP) env XDEBUG_MODE=off composer validate --no-plugins
packages-composer: ## Validate all composer packages
$(DC_RUN) php env XDEBUG_MODE=off vendor/bin/otel packages:composer:validate
bash: ## Bash shell
$(DC_RUN_PHP) bash
style: ## Run php-cs-fixer
$(DC_RUN_PHP) env XDEBUG_MODE=off PHP_CS_FIXER_IGNORE_ENV=1 vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.php --using-cache=no -vvv
split: ## git-split dry run
${DOCKER_COMPOSE} -f docker/gitsplit/docker-compose.yaml --env-file ./.env up
FORCE: