Skip to content

Instantly share code, notes, and snippets.

@radmiraal
Created March 7, 2013 14:21
Show Gist options
  • Save radmiraal/5108357 to your computer and use it in GitHub Desktop.
Save radmiraal/5108357 to your computer and use it in GitHub Desktop.
#!/bin/bash -e
if [[ "$GERRIT_CHANGE_SUBJECT" =~ ^(\[!!!\])?\[WIP\] ]]; then
echo 'WIP changes should not be merged';
exit 1;
fi
composer install --dev --no-interaction
mkdir -p Build/Reports/
#!/bin/bash
# Lint
find Packages/Beech/*/Classes/* -name '*.php' -exec php -l {} \;
find Packages/Beech/*/Tests/* -name '*.php' -exec php -l {} \;
# Code sniffer
echo "PHPCS"
bin/phpcs --extensions=php --standard=Packages/Libraries/typo3-qa/typo3flow/ruleset.xml Packages/Beech/
bin/phpcs --extensions=php --standard=Packages/Libraries/typo3-qa/typo3flow/ruleset.xml --report-checkstyle --report-file=Build/Reports/checkstyle.xml Packages/Beech/
# Some Flow validations
./flow configuration:validate --type Settings
./flow doctrine:validate
#!/bin/bash
# Mess detection
#echo "PHPMD"
bin/phpmd Packages/Beech xml Build/Beech.Essentials/PhpMd.xml --reportfile Build/Reports/pmd.xml
# Duplicate code
echo "PHPCPD"
bin/phpcpd --log-pmd Build/Reports/pmd-cpd.xml Packages/Beech
# PHP Depend
echo "PDEPEND"
bin/pdepend --jdepend-xml=Build/Reports/jdepend.xml --jdepend-chart=Build/Reports/dependencies.svg --overview-pyramid=Build/Reports/pyramid.svg Packages/Beech
# Unit & Functional tests
bin/phpunit --colors -c Build/PhpUnit/UnitTests.xml --coverage-html Data/Coverage/Unit/ --coverage-clover Data/Logs/unit-clover.xml --log-junit Data/Logs/unit-junit.xml
if [ $? == 0 ]; then
eval "ssh $GERRIT_HOST gerrit review --project $GERRIT_PROJECT --verified +1 --code-review +1 --message $BUILD_URL $GERRIT_PATCHSET_REVISION"
bin/phpunit --colors -c Build/PhpUnit/FunctionalTests.xml
if [ $? == 0 ]; then
eval "ssh $GERRIT_HOST gerrit review --project $GERRIT_PROJECT --verified +2 --code-review +1 --message $BUILD_URL $GERRIT_PATCHSET_REVISION"
else
eval "ssh $GERRIT_HOST gerrit review --project $GERRIT_PROJECT --verified -1 --code-review +1 --message $BUILD_URL $GERRIT_PATCHSET_REVISION"
exit 1;
fi
else
eval "ssh $GERRIT_HOST gerrit review --project $GERRIT_PROJECT --verified -1 --code-review +1 --message $BUILD_URL $GERRIT_PATCHSET_REVISION"
exit 1;
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment