forked from GNUsocial/gnu-social
[TOOLS][PHPStan][TESTS][Docker] Rework testing Docker container into a more generic tooling container. Keep services up and run coverage and phpstan as commands, for performance and ease of use
This commit is contained in:
parent
9742a07bae
commit
9d7f43cd28
14
Makefile
14
Makefile
@ -24,8 +24,14 @@ psql-shell: .PHONY
|
|||||||
database-force-schema-update:
|
database-force-schema-update:
|
||||||
docker exec -it $(strip $(DIR))_php_1 sh -c "/var/www/social/bin/console doctrine:schema:update --dump-sql --force"
|
docker exec -it $(strip $(DIR))_php_1 sh -c "/var/www/social/bin/console doctrine:schema:update --dump-sql --force"
|
||||||
|
|
||||||
test: .PHONY
|
tooling-docker: .PHONY
|
||||||
cd docker/testing && docker-compose run php; docker-compose down
|
@cd docker/tooling && docker-compose up -d > /dev/null 2>&1
|
||||||
|
|
||||||
stop-test: .PHONY
|
test: tooling-docker
|
||||||
cd docker/testing && docker-compose down
|
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
|
||||||
|
@ -9,11 +9,9 @@ if (! (: "${SKIP_ALL?}") 2>/dev/null) && (! (: "${SKIP_CS_FIX?}") 2>/dev/null);
|
|||||||
echo "Running php-cs-fixer on edited files"
|
echo "Running php-cs-fixer on edited files"
|
||||||
for staged in ${staged_files}; do
|
for staged in ${staged_files}; do
|
||||||
# work only with existing files
|
# work only with existing files
|
||||||
if [ -f "${staged}" ] && expr "${staged}" : '^.*\.php$'
|
if [ -f "${staged}" ] && expr "${staged}" : '^.*\.php$' > /dev/null; then
|
||||||
then
|
|
||||||
# use php-cs-fixer and get flag of correction
|
# use php-cs-fixer and get flag of correction
|
||||||
if "${root}/bin/php-cs-fixer" -q fix "${staged}"
|
if "${root}/bin/php-cs-fixer" -q fix "${staged}"; then
|
||||||
then
|
|
||||||
git add "${staged}" # execute git add directly
|
git add "${staged}" # execute git add directly
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
@ -29,7 +27,7 @@ fi
|
|||||||
|
|
||||||
if (! (: "${SKIP_ALL?}") 2>/dev/null) && (! (: "${SKIP_PHPSTAN?}") 2>/dev/null); then
|
if (! (: "${SKIP_ALL?}") 2>/dev/null) && (! (: "${SKIP_PHPSTAN?}") 2>/dev/null); then
|
||||||
echo "Running phpstan"
|
echo "Running phpstan"
|
||||||
"${root}/vendor/bin/phpstan" --memory-limit=2G analyse src tests components plugins
|
make phpstan
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Only commit if there wasn't an error
|
# Only commit if there wasn't an error
|
||||||
|
@ -55,6 +55,7 @@ services:
|
|||||||
- ./docker/social/install.sh:/var/entrypoint.d/social_install.sh
|
- ./docker/social/install.sh:/var/entrypoint.d/social_install.sh
|
||||||
# Main files
|
# Main files
|
||||||
- .:/var/www/social
|
- .:/var/www/social
|
||||||
|
- /var/www/social/docker
|
||||||
env_file:
|
env_file:
|
||||||
- ./docker/social/social.env
|
- ./docker/social/social.env
|
||||||
- ./docker/db/db.env
|
- ./docker/db/db.env
|
||||||
|
@ -32,6 +32,7 @@ cat <<EOF
|
|||||||
- ./docker/social/install.sh:/var/entrypoint.d/social_install.sh
|
- ./docker/social/install.sh:/var/entrypoint.d/social_install.sh
|
||||||
# Main files
|
# Main files
|
||||||
- .:/var/www/social
|
- .:/var/www/social
|
||||||
|
- /var/www/social/docker # exclude docker folder
|
||||||
env_file:
|
env_file:
|
||||||
- ./docker/social/social.env
|
- ./docker/social/social.env
|
||||||
- ./docker/db/db.env
|
- ./docker/db/db.env
|
||||||
|
@ -1,11 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
cd /var/www/social || exit 65
|
|
||||||
|
|
||||||
yes yes | php bin/console doctrine:fixtures:load || exit 65
|
|
||||||
|
|
||||||
if runuser -u www-data -- vendor/bin/simple-phpunit -vvv --coverage-html .test_coverage_report; then
|
|
||||||
exit 64
|
|
||||||
else
|
|
||||||
exit 65
|
|
||||||
fi
|
|
7
docker/tooling/coverage.sh
Executable file
7
docker/tooling/coverage.sh
Executable file
@ -0,0 +1,7 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
cd /var/www/social || exit 1
|
||||||
|
|
||||||
|
yes yes | php bin/console doctrine:fixtures:load || exit 1
|
||||||
|
|
||||||
|
runuser -u www-data -- vendor/bin/simple-phpunit -vvv --coverage-html .test_coverage_report
|
@ -11,9 +11,11 @@ services:
|
|||||||
- ../php/entrypoint.sh:/entrypoint.sh
|
- ../php/entrypoint.sh:/entrypoint.sh
|
||||||
- ../db/wait_for_db.sh:/wait_for_db.sh
|
- ../db/wait_for_db.sh:/wait_for_db.sh
|
||||||
- ../social/install.sh:/var/entrypoint.d/0_social_install.sh
|
- ../social/install.sh:/var/entrypoint.d/0_social_install.sh
|
||||||
- ./coverage.sh:/var/entrypoint.d/8_coverage.sh
|
- ./coverage.sh:/var/tooling/coverage.sh
|
||||||
|
- ./phpstan.sh:/var/tooling/phpstan.sh
|
||||||
# Main files
|
# Main files
|
||||||
- ../../:/var/www/social
|
- ../../:/var/www/social
|
||||||
|
- /var/www/social/docker # exclude docker folder
|
||||||
- ./xdebug.ini:/usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini
|
- ./xdebug.ini:/usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini
|
||||||
env_file:
|
env_file:
|
||||||
- social.env
|
- social.env
|
5
docker/tooling/phpstan.sh
Executable file
5
docker/tooling/phpstan.sh
Executable file
@ -0,0 +1,5 @@
|
|||||||
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
|
cd /var/www/social || exit 1
|
||||||
|
|
||||||
|
vendor/bin/phpstan --ansi --no-interaction --memory-limit=2G analyse src tests components plugins
|
Loading…
Reference in New Issue
Block a user