47 lines
1.6 KiB
Bash
47 lines
1.6 KiB
Bash
#!/bin/bash
|
|
|
|
# Ensure that phpcs is available on the system.
|
|
|
|
if ! [ -x "$(command -v phpcs)" ]; then
|
|
echo "This script needs phpcs installed to run!"
|
|
exit 1;
|
|
fi
|
|
|
|
# Load environment and load list of relevant instances.
|
|
|
|
SCRIPT_DIR="$( cd "$( dirname "$0" )" && pwd )"
|
|
|
|
# Run PHPCS
|
|
|
|
PHPCS_RESULT=$(phpcs --standard=~/Rules/md_Rules/md_phpcs_rules.xml "$SCRIPT_DIR/../*.php" | grep " | " | wc -l)
|
|
|
|
for i in "$SCRIPT_DIR/../"*; do
|
|
if [ "$(echo $i | grep -v "musdb" | wc -l)" = "0" ]; then
|
|
continue
|
|
fi
|
|
PHPCS_RESULT=$(echo "$(phpcs --standard=~/Rules/md_Rules/md_phpcs_rules.xml $i/*.php | grep " | " | wc -l) + $PHPCS_RESULT" | bc)
|
|
done
|
|
|
|
# PHPCS_RESULT=$(echo "$(phpcs --standard=~/Rules/md_Rules/md_phpcs_rules.xml "$SCRIPT_DIR/../*/*.php" | grep " | " | wc -l) + $PHPCS_RESULT" | bc)
|
|
|
|
echo "phpcs-errors:$PHPCS_RESULT";
|
|
|
|
# Run PHPUnit
|
|
|
|
PHPUNIT_TEST_BASE_DIR="/var/www/vhosts/museum-digital.de/csvxml.imports.museum-digital.org"
|
|
|
|
$(php $PHPUNIT_TEST_BASE_DIR/vendor/bin/phpunit --stderr -c $PHPUNIT_TEST_BASE_DIR/tests/config.xml --testdox $PHPUNIT_TEST_BASE_DIR/tests)
|
|
PHPUNIT_EC=$?
|
|
echo ""
|
|
if [ "$PHPUNIT_EC" = "1" ]; then
|
|
echo "phpunit-status:failing";
|
|
else
|
|
echo "phpunit-status:successful";
|
|
fi
|
|
|
|
PHPSTAN_TEST_BASE_DIR="/var/www/vhosts/museum-digital.de/sandkasten.museum-digital.de"
|
|
PHPSTAN_CONF_BASE_DIR="/var/www/vhosts/museum-digital.de/csvxml.imports.museum-digital.org"
|
|
|
|
PHPSTAN_ERRORS=$(php $PHPSTAN_TEST_BASE_DIR/vendor/bin/phpstan analyze --error-format raw -c $PHPSTAN_CONF_BASE_DIR/phpstan.neon -l 8 | wc -l)
|
|
echo "phpstan-errors:$PHPSTAN_ERRORS"
|