Skip to content

Commit

Permalink
add-docker-setup
Browse files Browse the repository at this point in the history
  • Loading branch information
gennadigennadigennadi committed May 17, 2023
1 parent a446b66 commit 92b5648
Show file tree
Hide file tree
Showing 9 changed files with 41 additions and 8 deletions.
4 changes: 1 addition & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,9 @@ phpunit.xml
box.json
deptrac.version
junit-report.xml
.php-cs-fixer.cache
.php-cs-fixer.php
.deptrac.cache
.phpunit.result.cache
infection.log
.cache/

# downgrade with Rector
/rector-local
1 change: 1 addition & 0 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

return (new PhpCsFixer\Config())
->setRiskyAllowed(true)
->setCacheFile('./.cache/php-cs-fixer.cache')
->setRules([
'@Symfony' => true,
'array_syntax' => ['syntax' => 'short'],
Expand Down
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ build: tests ## Runs tests and creates the phar-binary

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

.PHONY: deptrac
deptrac: ## Analyses own architecture using the default config confile
$(PHP_BIN) deptrac.php --config-file=deptrac.config.php analyse --no-progress --ansi
$(PHP_BIN) deptrac.php --config-file=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
Expand All @@ -35,7 +35,7 @@ gpg: ## Signs release with default GPG key "4AB1782E"

.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
$(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
Expand All @@ -55,7 +55,7 @@ psalm: ## Performs static code analysis using psalm

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

.PHONY: tests
tests: composer-install ## Runs tests followed by a very basic e2e-test
Expand Down
4 changes: 4 additions & 0 deletions deptrac.baseline.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
deptrac:
skip_violations:
ClassA:
- ClassB
16 changes: 16 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
version: '3.8'

services:
deptrac:
build:
dockerfile: docker/php/Dockerfile
context: ./
container_name: deptrac
tty: true
user: "${USER_ID:-1000}:${GROUP_ID:-1000}"
working_dir: /var/www/deptrac
volumes:
- ./:/var/www/deptrac
extra_hosts:
- host.docker.internal:${HOST_IP:-172.17.0.1}

9 changes: 9 additions & 0 deletions docker/php/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
FROM php:8.1-cli
RUN apt-get update && apt-get install -y git zip && apt-get clean
RUN pecl install xdebug \
&& docker-php-ext-enable xdebug \
&& pecl clear-cache \

WORKDIR /var/www/deptrac
COPY --from=composer /usr/bin/composer /usr/bin/composer

1 change: 1 addition & 0 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ parameters:
checkMissingCallableSignature: true
level: max
paths: [src]
tmpDir: ./.cache/phpstan
stubFiles:
- internal/stubs/Function_.php
- internal/stubs/ClassLike.php
Expand Down
5 changes: 4 additions & 1 deletion phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,16 @@
colors="true"
executionOrder="random"
resolveDependencies="true"
cacheResultFile=".cache/phpunit/phpunit.result.cache"
>
<testsuites>
<testsuite name="Tests">
<directory suffix="Test.php">./tests/</directory>
</testsuite>
</testsuites>
<coverage>
<coverage
cacheDirectory="./.cache/phpunit"
>
<include>
<directory>./src</directory>
</include>
Expand Down
1 change: 1 addition & 0 deletions psalm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
xmlns="https://getpsalm.org/schema/config"
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
errorBaseline="baseline.xml"
cacheDirectory="./.cache/psalm"
>
<projectFiles>
<directory name="src" />
Expand Down

0 comments on commit 92b5648

Please sign in to comment.