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

Update dev tooling #101

Merged
merged 12 commits into from
Jan 2, 2025
6 changes: 0 additions & 6 deletions .github/workflows/static-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,6 @@ jobs:
coverage: none
tools: composer

- name: "Install dependencies with composer"
run: make composer-install

- name: "Check cs"
run: make php-cs-check

Expand Down Expand Up @@ -102,9 +99,6 @@ jobs:
composer-${{ runner.os }}-
composer-

- name: "Install dependencies with composer"
run: make composer-install

- name: Psalm
run: make psalm

Expand Down
3 changes: 0 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,5 @@ jobs:
composer-${{ runner.os }}-
composer-

- name: "Install dependencies with composer"
run: make composer-install

- name: "Run deptrac"
run: make deptrac
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
vendor/*
tools/**/vendor/*
tools/**/bin/*
coverage/*
tools/
.box_dump/
/deptrac.phar
/deptrac.phar.asc
Expand Down
53 changes: 21 additions & 32 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,68 +1,57 @@
BOX_BIN := build/box.phar
COMPOSER_BIN := composer
COMPOSER_DEPENDENCY_ANALYSER_BIN := ./vendor/bin/composer-dependency-analyser
PHP_BIN := php
PHP_CS_FIXER_BIN := ./vendor/bin/php-cs-fixer
PHPSTAN_BIN := ./vendor/bin/phpstan
PSALM_BIN := ./vendor/bin/psalm
PHPUNIT_BIN := ./vendor/bin/phpunit
INFECTION_BIN := ./vendor/bin/roave-infection-static-analysis-plugin

.PHONY: help

COMPOSER_DEPENDENCY_ANALYSER_BIN := ./tools/dependency-analyser/bin/composer-dependency-analyser
PHP_CS_FIXER_BIN := ./tools/php-cs-fixer/bin/php-cs-fixer
PHPSTAN_BIN := ./tools/phpstan/bin/phpstan
PSALM_BIN := ./tools/psalm/bin/psalm
PHPUNIT_BIN := ./tools/phpunit/bin/phpunit
INFECTION_BIN := ./tools/infection/bin/roave-infection-static-analysis-plugin

.PHONY: help build tests deptrac gpg
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}'


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

.PHONY: composer-install
composer-install: ## Installs dependencies
$(COMPOSER_BIN) install --no-interaction --no-progress -a --ansi
install: vendor ## Installs dependencies
vendor: composer.json composer.lock
$(COMPOSER_BIN) install --no-interaction --no-progress --ansi

.PHONY: composer-dependency-analyser
composer-dependency-analyser: ## Performs static code analysis using composer-dependency-analyser
$(COMPOSER_DEPENDENCY_ANALYSER_BIN)

.PHONY: deptrac
deptrac: ## Analyses own architecture using the default config confile
deptrac: vendor ## Analyses own architecture using the default config confile
bin/deptrac analyse -c deptrac.config.php --cache-file=./.cache/deptrac.cache --no-progress --ansi

#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 local key
gpg --detach-sign --armor --local-user ${USER} --output deptrac.phar.asc deptrac.phar
gpg --verify deptrac.phar.asc deptrac.phar

.PHONY: infection
infection: composer-install ## Runs mutation tests
infection: vendor ## 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

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

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

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

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

.PHONY: tests-coverage
tests-coverage: composer-install ## Runs tests and generate an html coverage report
tests-coverage: vendor ## Runs tests and generate an html coverage report
XDEBUG_MODE=coverage $(PHPUNIT_BIN) -c . --coverage-html coverage

.PHONY: tests
tests: composer-install ## Runs tests followed by a very basic e2e-test
tests: vendor ## Runs tests followed by a very basic e2e-test
$(PHPUNIT_BIN) -c .
bin/deptrac analyse --config-file=docs/examples/Fixture.depfile.yaml --no-cache
15 changes: 8 additions & 7 deletions compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,18 @@ services:
build:
dockerfile: docker/php/Dockerfile
context: ./
container_name: deptrac
args:
- "UID=${UID:-1000}"
- "GID=${GID:-1000}"
tty: true
environment:
- PHP_IDE_CONFIG=serverName=deptrac
- COMPOSER_CACHE_DIR=/var/www/deptrac/.composer
userns_mode: keep-id
- COMPOSER_CACHE_DIR=/home/deptrac/.composer
volumes:
- ./:/var/www/deptrac:z
- composer-data:/var/www/deptrac/.composer
- ./:/var/www/deptrac
- user-data:/home/deptrac/
extra_hosts:
- host.docker.internal:${HOST_IP:-172.17.0.1}
- host.docker.internal:${HOST_IP:-host-gateway}

volumes:
composer-data:
user-data:
22 changes: 10 additions & 12 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,9 @@
"symfony/yaml": "^6.0"
},
"require-dev": {
"bamarni/composer-bin-plugin": "^1.8",
"ergebnis/composer-normalize": "^2.45",
"friendsofphp/php-cs-fixer": "^3.4",
"infection/infection": "^0.26.16",
"phpstan/phpstan": "^1.6.8",
"phpstan/phpstan-symfony": "^1.1",
"phpunit/phpunit": "^10.2",
"roave/infection-static-analysis-plugin": "^1.28",
"shipmonk/composer-dependency-analyser": "^1.5",
"symfony/stopwatch": "^6.4",
"vimeo/psalm": "^5.13"
"symfony/stopwatch": "^6.4"
},
"suggest": {
"ext-dom": "For using the JUnit output formatter"
Expand All @@ -65,17 +58,22 @@
"Tests\\Qossmic\\Deptrac\\": "tests/"
}
},
"bin": [
"deptrac"
],
"config": {
"allow-plugins": {
"bamarni/composer-bin-plugin": true,
"ergebnis/composer-normalize": true,
"infection/extension-installer": true
},
"platform": {
"php": "8.1"
},
"sort-packages": true
},
"extra": {
"bamarni-bin": {
"bin-links": false,
"forward-command": true,
"target-directory": "tools"
}
}
}
Loading
Loading