I use this git hook to upload on a folder on our Dev VPS the status of the branch of a specific plugin, so we have an history.
It execute QualityAnalyzer, PHPMetrics and Codeception to generate the relative reports.
pre-push
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# If the branch is not master, execute phpmetrics and upoload everything on the VPS | |
current_branch=$(git symbolic-ref HEAD | sed -e 's,.*/\(.*\),\1,') | |
if [ $current_branch != "master" ]; then | |
sshpass -p your-password ssh user@domain.tld mkdir -p /var/www/your-path/status/master/ | |
sshpass -p your-password rsync --progress -avzP /home/your-user/.cache/QualityAnalyzer/assets -e ssh user@domain.tld:/var/www/your-metrics/status/$current_branch/ > /dev/null | |
sshpass -p your-password rsync --progress -avzP /home/your-user/.cache/QualityAnalyzer/index.html -e ssh user@domain.tld:/var/www/your-metrics/status/$current_branch/ > /dev/null | |
/usr/bin/phpmd /var/www/VVV/www/site/public_html/wp-content/plugins/your-plugin/ xml /CodeatCS/codeat-phpmd.xml --exclude vendor,tests --reportfile /tmp/phpmd-analysis.xml | |
/home/your-user/.cache/QualityAnalyzer/bin/analyze analyze /var/www/VVV/www/site/public_html/wp-content/plugins/your-plugin/ --exclude=vendor,tests --exclude_analyzers=cpd,pdepend,checkstyle --phpmd=/tmp/phpmd-analysis.xml | |
sshpass -p your-password rsync --exclude={.git*} --progress -avzP /home/your-user/.cache/QualityAnalyzer/data -e ssh user@domain.tld:/var/www/your-metrics//status/$current_branch/ > /dev/null | |
codecept run wpunit --coverage --coverage-html > /dev/null | |
sshpass -p your-password rsync --exclude={.git*} --progress -avzP /var/www/VVV/www/site/public_html/wp-content/plugins/your-plugin/tests/_output/coverage/ -e ssh user@domain.tld:/var/www/your-metrics/coverage > /dev/null | |
phpmetrics --report-html="/tmp/your-report" /var/www/VVV/www/your-project/public_html/wp-content/plugins/your-plugin/ --exclude=vendor,tests,languages > /dev/null | |
sshpass -p your-password rsync --exclude={.sass-cache*,*.map,node_modules,.php_cs,.git*,*.lock,*.yml,*lock.json} --progress -avz /tmp/your-report -e ssh user@domain.tld:/var/www/your-metrics/$current_branch/ > /dev/null | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment