xref: /web-php/Makefile (revision c632d199)
1.EXPORT_ALL_VARIABLES:
2
3HTTP_HOST:=localhost:8080
4CORES?=$(shell (nproc  || sysctl -n hw.ncpu) 2> /dev/null)
5
6.PHONY: it
7it: coding-standards tests ## Runs all the targets
8
9.PHONY: code-coverage
10code-coverage: vendor ## Collects code coverage from running unit tests with phpunit/phpunit
11	vendor/bin/phpunit --configuration=tests/phpunit.xml --coverage-text --testsuite=unit
12
13.PHONY: coding-standards
14coding-standards: vendor ## Fixes code style issues with friendsofphp/php-cs-fixer
15	vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.php --diff --show-progress=dots --verbose
16
17.PHONY: help
18help: ## Displays this list of targets with descriptions
19	@grep -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[32m%-30s\033[0m %s\n", $$1, $$2}'
20
21.PHONY: tests
22tests: vendor ## Runs unit and end-to-end tests with phpunit/phpunit
23	vendor/bin/phpunit --configuration=tests/phpunit.xml --testsuite=unit
24	rm -rf tests/server.log
25	tests/server start;
26	vendor/bin/phpunit --configuration=tests/phpunit.xml --testsuite=end-to-end;
27	tests/server stop
28
29tests_visual:
30	tests/server start;
31	npx playwright test --workers=$(CORES)
32	tests/server stop
33
34tests_update_snapshots:
35	tests/server start;
36	npx playwright test --update-snapshots
37	tests/server stop
38
39vendor: composer.json composer.lock
40	composer validate --strict
41	composer install --no-interaction --no-progress
42