Created
November 22, 2017 16:31
-
-
Save nfreear/de698530451c248798a7b33617ff582b to your computer and use it in GitHub Desktop.
A Git pre-commit hook, to run lint and tests, for PHP and/or Node.JS projects | © Nick Freear | http://githooks.com
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 | |
# | |
# An example hook script to verify what is about to be committed. | |
# Called by "git commit" with no arguments. The hook should | |
# exit with non-zero status after issuing an appropriate message if | |
# it wants to stop the commit. | |
# | |
# To enable this hook, rename this file to "pre-commit". Copy to "../.git/hooks" | |
# https://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks | |
# http://githooks.com | |
# | |
# © Nick Freear, 22-November-2017. | |
# | |
echo | |
echo Pre-commit hook! | |
echo ' > composer validate' | |
echo ' > composer test' | |
# PHP projects. | |
composer validate | |
composer build | |
composer test | |
# Javascript (Node.JS) projects. | |
npm run build | |
npm test | |
# echo Exit: 1 | |
# exit 1 | |
# End. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment