diff --git a/tools/git-hooks/pre-commit b/tools/git-hooks/pre-commit index 5e1207c23c0c3e61a26387211a15678b940465d8..66d2dffd6d3fa1f2e7f5f06ff6cc97a9c4826973 100755 --- a/tools/git-hooks/pre-commit +++ b/tools/git-hooks/pre-commit @@ -4,9 +4,14 @@ REDBOLD='\033[0;31;1m' GREENBOLD='\033[0;32;1m' BOLD='\033[1m' NORMAL='\033[0m' +if [ ! -z "$(which docker-compose)" ]; then + composer="docker-compose -f ../docker-compose.yml exec -T memorekall-member composer" +else + composer=composer +fi echo -e "\n ${BOLD} Starting Unit and Functional Tests...\n ${NORMAL}" -composer tests +$composer tests if [ $? != 0 ]; then echo -e "\n ${REDBOLD} Unit tests failed \n ${NORMAL}" exit 1; @@ -15,7 +20,7 @@ else fi echo -e "\n ${BOLD} Starting PHP_CodeSniffer... \n ${NORMAL}" -composer phpcs +$composer phpcs if [ $? != 0 ]; then echo -e "\n ${REDBOLD} PHPCS verification failed \n ${NORMAL}" exit 1; @@ -24,7 +29,7 @@ else fi echo -e "\n ${BOLD} Starting PHPStan... \n ${NORMAL}" -composer phpstan +$composer phpstan if [ $? != 0 ]; then echo -e "\n ${REDBOLD} PHPStan verification failed \n ${NORMAL}" exit 1;