Skip to content

Commit

Permalink
Merge pull request #1176 from dbrumann/cleanup/makefile
Browse files Browse the repository at this point in the history
Sort make targets and introduce help
  • Loading branch information
Denis Brumann authored May 8, 2023
2 parents 5591876 + 798e043 commit 3087cf1
Showing 1 changed file with 38 additions and 24 deletions.
62 changes: 38 additions & 24 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,43 +7,57 @@ PSALM_BIN := ./vendor/bin/psalm
PHPUNIT_BIN := ./vendor/bin/phpunit
INFECTION_BIN := ./vendor/bin/roave-infection-static-analysis-plugin

.PHONY: build composer-install tests tests-coverage gpg php-cs-check php-cs-fix phpstan
.PHONY: help
help: ## Displays list of available targets with their descriptions
@grep -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[32m%-30s\033[0m %s\n", $$1, $$2}'

build: tests

.PHONY: build
build: tests ## Runs tests and creates the phar-binary
$(BOX_BIN) compile

composer-install:
.PHONY: composer-install
composer-install: ## Installs dependencies
$(COMPOSER_BIN) install --no-interaction --no-progress --no-suggest --optimize-autoloader --ansi

tests: composer-install
$(PHPUNIT_BIN) -c .
$(PHP_BIN) deptrac.php analyse --config-file=docs/examples/Fixture.depfile.yaml --no-cache
.PHONY: deptrac
deptrac: ## Analyses own architecture using the default config confile
$(PHP_BIN) deptrac.php --config-file=deptrac.config.php analyse --no-progress --ansi

tests-coverage: composer-install
$(PHPUNIT_BIN) -c . --coverage-html coverage
#generate-changelog: ## Generates a changelog file based on changes compared to remote origin
# gem install github_changelog_generator
# github_changelog_generator -u qossmic -p deptrac --no-issues --future-release <version>

.PHONY: gpg
gpg: ## Signs release with default GPG key "4AB1782E"
gpg --detach-sign --armor --default-key 41DDE07547459FAECFA17813B8F640134AB1782E --output deptrac.phar.asc deptrac.phar
gpg --verify deptrac.phar.asc deptrac.phar

.PHONY: infection
infection: composer-install ## Runs mutation tests
$(INFECTION_BIN) --threads=$(shell nproc || sysctl -n hw.ncpu || 1) --test-framework-options='--testsuite=Tests' --only-covered --min-msi=85 --psalm-config=psalm.xml

php-cs-check: ## run cs fixer (dry-run)
.PHONY: php-cs-check
php-cs-check: ## Checks for code style violation
$(PHP_CS_FIXER_BIN) fix --allow-risky=yes --diff --using-cache=no --verbose --dry-run

php-cs-fix: ## run cs fixer
.PHONY: php-cs-fix
php-cs-fix: ## Fixes any found code style violation
$(PHP_CS_FIXER_BIN) fix --allow-risky=yes

phpstan:
.PHONY: phpstan
phpstan: ## Performs static code analysis using phpstan
$(PHPSTAN_BIN) analyse --memory-limit=256M

deptrac:
$(PHP_BIN) deptrac.php --config-file=deptrac.config.php analyse --no-progress --ansi

psalm:
.PHONY: psalm
psalm: ## Performs static code analysis using psalm
$(PSALM_BIN)

infection: composer-install
$(INFECTION_BIN) --threads=$(shell nproc || sysctl -n hw.ncpu || 1) --test-framework-options='--testsuite=Tests' --only-covered --min-msi=85 --psalm-config=psalm.xml

gpg:
gpg --detach-sign --armor --default-key 41DDE07547459FAECFA17813B8F640134AB1782E --output deptrac.phar.asc deptrac.phar
gpg --verify deptrac.phar.asc deptrac.phar
.PHONY: tests-coverage
tests-coverage: composer-install ## Runs tests and generate an html coverage report
$(PHPUNIT_BIN) -c . --coverage-html coverage

#generate-changelog:
# gem install github_changelog_generator
# github_changelog_generator -u qossmic -p deptrac --no-issues --future-release <version>
.PHONY: tests
tests: composer-install ## Runs tests followed by a very basic e2e-test
$(PHPUNIT_BIN) -c .
$(PHP_BIN) deptrac.php analyse --config-file=docs/examples/Fixture.depfile.yaml --no-cache

0 comments on commit 3087cf1

Please sign in to comment.