diff --git a/.gitattributes b/.gitattributes index 8a176c8..90d5cba 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,15 +1,10 @@ +/bin export-ignore /tests export-ignore +/tools export-ignore /examples export-ignore /docker export-ignore /vendor-bin export-ignore /.editorconfig export-ignore /.gitattributes export-ignore /.gitignore export-ignore -/.travis.yml export-ignore -/captainhook.json export-ignore -/phpstan.neon export-ignore -/phpstan-baseline.neon export-ignore -/phpunit.xml.dist export-ignore -/psalm.xml export-ignore -/psalm-baseline.xml export-ignore -/ruleset.xml export-ignore \ No newline at end of file +/captainhook.json export-ignore \ No newline at end of file diff --git a/composer.json b/composer.json index 448d21e..b556cbe 100644 --- a/composer.json +++ b/composer.json @@ -25,6 +25,7 @@ }, "require-dev": { "captainhook/captainhook-phar": "^5.0", + "captainhook/hook-installer": "^1.0", "phpunit/phpunit": "^11.0", "mockery/mockery": "^1.0", "squirrelphp/types": "^1.0", @@ -40,7 +41,13 @@ "config": { "sort-packages": false, "allow-plugins": { - "captainhook/captainhook-phar": true + "captainhook/captainhook-phar": true, + "captainhook/hook-installer": true + } + }, + "extra": { + "captainhook": { + "config": "tools/captainhook.json" } }, "autoload": { @@ -54,6 +61,7 @@ } }, "scripts": { + "captainhook_install": "vendor/bin/captainhook install --configuration=tools/captainhook.json --ansi --no-interaction", "phpstan": "vendor-bin/phpstan/vendor/bin/phpstan analyse --configuration=tools/phpstan.neon", "phpstan_full": "rm -Rf tools/cache/phpstan && vendor-bin/phpstan/vendor/bin/phpstan analyse --configuration=tools/phpstan.neon", "phpstan_base": "vendor-bin/phpstan/vendor/bin/phpstan analyse --configuration=tools/phpstan.neon --generate-baseline=tools/phpstan-baseline.php", diff --git a/docker/compose/composer.yml b/docker/compose/composer.yml index ba420c0..3bec369 100644 --- a/docker/compose/composer.yml +++ b/docker/compose/composer.yml @@ -8,6 +8,7 @@ services: driver: "none" volumes: - ./.editorconfig:/usr/src/app/.editorconfig + - ./.git:/usr/src/app/.git - ./bin:/usr/src/app/bin - ./composer.json:/usr/src/app/composer.json - ./composer.lock:/usr/src/app/composer.lock diff --git a/docker/test b/docker/test index ff745b4..225803e 100755 --- a/docker/test +++ b/docker/test @@ -9,4 +9,4 @@ docker compose -f "$DIR/compose/test.yml" --project-directory "$DIR/.." down --v docker compose -f "$DIR/compose/test.yml" --project-directory "$DIR/.." up --build --force-recreate --renew-anon-volumes --remove-orphans --always-recreate-deps --abort-on-container-exit --exit-code-from=test test # Remove all running docker containers -#docker compose -f "$DIR/compose/test.yml" --project-directory "$DIR/.." down --volumes --remove-orphans \ No newline at end of file +docker compose -f "$DIR/compose/test.yml" --project-directory "$DIR/.." down --volumes --remove-orphans \ No newline at end of file diff --git a/tools/captainhook.json b/tools/captainhook.json new file mode 100644 index 0000000..f031e76 --- /dev/null +++ b/tools/captainhook.json @@ -0,0 +1,65 @@ +{ + "commit-msg": { + "enabled": true, + "actions": [ + { + "action": "\\CaptainHook\\App\\Hook\\Message\\Action\\Beams", + "options": { + "subjectLength": 72, + "bodyLineLength": 72 + }, + "conditions": [] + } + ] + }, + "pre-push": { + "enabled": false, + "actions": [] + }, + "pre-commit": { + "enabled": true, + "actions": [ + { + "action": "\\CaptainHook\\App\\Hook\\PHP\\Action\\Linting", + "options": [], + "conditions": [] + }, + { + "action": "docker/composer phpstan", + "options": [], + "conditions": [] + }, + { + "action": "docker/composer psalm", + "options": [], + "conditions": [] + }, + { + "action": "docker/composer phpcs", + "options": [], + "conditions": [] + }, + { + "action": "docker/test", + "options": [], + "conditions": [] + } + ] + }, + "prepare-commit-msg": { + "enabled": false, + "actions": [] + }, + "post-commit": { + "enabled": false, + "actions": [] + }, + "post-merge": { + "enabled": false, + "actions": [] + }, + "post-checkout": { + "enabled": false, + "actions": [] + } +}