diff --git a/Makefile b/Makefile index ee76992f86..da27cb8f10 100644 --- a/Makefile +++ b/Makefile @@ -24,8 +24,14 @@ psql-shell: .PHONY database-force-schema-update: docker exec -it $(strip $(DIR))_php_1 sh -c "/var/www/social/bin/console doctrine:schema:update --dump-sql --force" -test: .PHONY - cd docker/testing && docker-compose run php; docker-compose down +tooling-docker: .PHONY + @cd docker/tooling && docker-compose up -d > /dev/null 2>&1 -stop-test: .PHONY - cd docker/testing && docker-compose down +test: tooling-docker + docker exec tooling_php_1 /var/tooling/coverage.sh + +phpstan: tooling-docker + docker exec tooling_php_1 /var/tooling/phpstan.sh + +stop-tooling: .PHONY + cd docker/tooling && docker-compose down diff --git a/bin/pre-commit b/bin/pre-commit index 11e40cc920..79824bb81e 100755 --- a/bin/pre-commit +++ b/bin/pre-commit @@ -9,11 +9,9 @@ if (! (: "${SKIP_ALL?}") 2>/dev/null) && (! (: "${SKIP_CS_FIX?}") 2>/dev/null); echo "Running php-cs-fixer on edited files" for staged in ${staged_files}; do # work only with existing files - if [ -f "${staged}" ] && expr "${staged}" : '^.*\.php$' - then + if [ -f "${staged}" ] && expr "${staged}" : '^.*\.php$' > /dev/null; then # use php-cs-fixer and get flag of correction - if "${root}/bin/php-cs-fixer" -q fix "${staged}" - then + if "${root}/bin/php-cs-fixer" -q fix "${staged}"; then git add "${staged}" # execute git add directly fi fi @@ -29,7 +27,7 @@ fi if (! (: "${SKIP_ALL?}") 2>/dev/null) && (! (: "${SKIP_PHPSTAN?}") 2>/dev/null); then echo "Running phpstan" - "${root}/vendor/bin/phpstan" --memory-limit=2G analyse src tests components plugins + make phpstan fi # Only commit if there wasn't an error diff --git a/docker-compose.yaml.default b/docker-compose.yaml.default index 425435d41c..527d6a4ea3 100644 --- a/docker-compose.yaml.default +++ b/docker-compose.yaml.default @@ -55,6 +55,7 @@ services: - ./docker/social/install.sh:/var/entrypoint.d/social_install.sh # Main files - .:/var/www/social + - /var/www/social/docker env_file: - ./docker/social/social.env - ./docker/db/db.env diff --git a/docker/php/docker-compose.fragment.sh b/docker/php/docker-compose.fragment.sh index 415b646381..77f4f48073 100644 --- a/docker/php/docker-compose.fragment.sh +++ b/docker/php/docker-compose.fragment.sh @@ -32,6 +32,7 @@ cat <