diff --git a/.githooks/pre-push b/.githooks/pre-push new file mode 100755 index 0000000..2233106 --- /dev/null +++ b/.githooks/pre-push @@ -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 diff --git a/build.yaml b/build.yaml index 67e9ff3..dbb232a 100644 --- a/build.yaml +++ b/build.yaml @@ -61,4 +61,5 @@ dockerfile: experimental: createGitHubActionsConfiguration: true + runGitHooksBeforePush: true useNewDatabaseCredentials: true diff --git a/justfile b/justfile index 29db2b8..fa906c5 100644 --- a/justfile +++ b/justfile @@ -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 }}