Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Makefile with help target that show descriptions for each target #133

Merged
merged 1 commit into from
Jul 12, 2024
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
28 changes: 25 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,53 +1,75 @@
.PHONY: setup sh usage
.PHONY: help
help:
@printf "%-40s %s\n" "Target" "Description"
@printf "%-40s %s\n" "------" "-----------"
@make -pqR : 2>/dev/null \
| awk -v RS= -F: '/^# File/,/^# Finished Make data base/ {if ($$1 !~ "^[#.]") {print $$1}}' \
| sort \
| egrep -v -e '^[^[:alnum:]]' -e '^$@$$' \
| xargs -I _ sh -c 'printf "%-40s " _; make _ -nB | (grep -i "^# Help:" || echo "") | tail -1 | sed "s/^# Help: //g"'

usage:
@echo "select target"

.PHONY: run run-php7.4 run-php8.0 run-php8.1 run-php8.2
run-php7.4:
@# Help: It creates and runs a docker image with PHP 7.4
docker-compose run --rm php74 bash -c "rm composer.lock || true; composer install --no-interaction; bash"
run-php8.0:
@# Help: It creates and runs a docker image with PHP 8.0
docker-compose run --rm php80 bash -c "rm composer.lock || true; composer install --no-interaction; bash"
run-php8.1:
@# Help: It creates and runs a docker image with PHP 8.1
docker-compose run --rm php81 bash -c "rm composer.lock || true; composer install --no-interaction; bash"
run-php8.2:
@# Help: It creates and runs a docker image with PHP 8.2
docker-compose run --rm php82 bash -c "rm composer.lock || true; composer install --no-interaction; bash"
run: run-php7.4
@# Help: It creates and runs a docker image with the lowest supported PHP version

.PHONY: psalm psalm-update-baseline
psalm:
@# Help: It runs Psalm
./vendor/bin/psalm --no-cache

psalm-update-baseline:
@# Help: It updates the Psalm baseline
./vendor/bin/psalm --update-baseline


.PHONY: phpstan phpstan-update-baseline
phpstan:
@# Help: It runs PHPStan
./vendor/bin/phpstan analyse src tests

phpstan-update-baseline:
@# Help: It updates the PHPStan baseline
./vendor/bin/phpstan analyse src tests --generate-baseline


.PHONY: type-assertions test
type-assertions:
@# Help: It runs tests on Psalm types
./vendor/bin/psalm tests/type-assertions --no-cache

test:
@# Help: It runs PHPUnit tests
XDEBUG_MODE=coverage ./vendor/bin/phpunit

.PHONY: ci ci-check cs-check cs-fix
cs-fix:
@# Help: It runs the code style fix
./vendor/bin/php-cs-fixer fix --ansi --verbose

cs-check:
@# Help: It runs the code style check
./vendor/bin/php-cs-fixer fix --ansi --verbose --dry-run

ci: test phpstan psalm type-assertions cs-fix
@# Help: It runs all tests and code style fix

ci-check: test phpstan psalm type-assertions cs-check
@# Help: It runs all tests and code style check

.PHONY: rector
rector:
@# Help: It runs rector
./vendor/bin/rector
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public function test(): void

/** @psalm-suppress UndefinedFunction */
$this
->limitTo(1000)
->limitTo(1_000)
->forAll(
Generators::date(),
Generators::elements([
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/Internal/Useful/StringMatchingRegexDecoderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public function testDecode(): void
->forAll(
Generators::map(
fn(int $x): string => (string) $x,
Generators::choose(10, 99999)
Generators::choose(10, 99_999)
)
)
->then(function (string $in): void {
Expand All @@ -42,7 +42,7 @@ public function testDecode(): void
$this
->forAll(
Generators::tuple(
Generators::choose(10, 99999),
Generators::choose(10, 99_999),
Generators::elements(['a', 'b', 'c', 'd', 'e', 'f', 'g'])
)
)
Expand Down
Loading