build-configs: enable pre-push Git hook

This commit is contained in:
Oliver Davies 2023-04-24 23:08:33 +01:00
parent 4b42420696
commit 722b7710b4
3 changed files with 32 additions and 0 deletions

7
.githooks/pre-push Executable file
View file

@ -0,0 +1,7 @@
#!/usr/bin/env bash
# Do not edit this file. It is automatically generated by https://www.oliverdavies.uk/build-configs.
set -euo pipefail
just test-commit

View file

@ -61,4 +61,5 @@ dockerfile:
experimental:
createGitHubActionsConfiguration: true
runGitHooksBeforePush: true
useNewDatabaseCredentials: true

View file

@ -29,6 +29,30 @@ install *args:
# Enable or disable Git hooks
git-hooks command:
#!/usr/bin/env bash
set -euo pipefail
case "{{ command }}" in
"on")
echo "Enabling Git hooks..."
git config core.hooksPath .githooks
;;
"off")
echo "Disabling Git hooks..."
git config --unset core.hooksPath
;;
*)
echo "Error: Invalid argument. Must be either 'on' or 'off'"
;;
esac
test-commit:
just _run php phpcs
just _run php phpstan analyze --no-progress --memory-limit=512M
just test --testdox --testsuite unit
just test --testdox --testsuite kernel
_exec +args:
docker compose exec {{ args }}