Add scripts-to-rule-them-all scaffold (refs #1)
Some checks failed
check / check (push) Failing after 28s
Some checks failed
check / check (push) Failing after 28s
Add the standard STRTA scaffold, mirroring the conformant Go repos: - script/ POSIX-sh entrypoints (bootstrap, setup, projectname, test, lint, fmt, fmt-check, check, docker, cibuild, precommit, install-precommit). - Makefile rewritten as thin shims: .PHONY plus the nine standard targets each delegating to script/NAME; repo-specific build, clean, and try targets retained. - .golangci.yml matching the org-standard Go lint config. - Dockerfile whose build runs make check then make build, so the image fails on any check failure. - .gitea/workflows/check.yml running script/cibuild. make fmt-check and make test are green. make check is not yet green because of pre-existing lint findings in the application code, which are out of scope for this scaffold change; hence refs (not closes).
This commit is contained in:
21
script/precommit
Executable file
21
script/precommit
Executable file
@@ -0,0 +1,21 @@
|
||||
#!/bin/sh
|
||||
# script/precommit: run by the git pre-commit hook; fails the commit if
|
||||
# checks fail. Our own extension to scripts-to-rule-them-all. Go extra:
|
||||
# go mod tidy must be a no-op before the checks run.
|
||||
set -eu
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd -P)"
|
||||
ROOT="$(cd "$SCRIPT_DIR/.." && pwd -P)"
|
||||
|
||||
main() {
|
||||
cd "$ROOT"
|
||||
go mod tidy
|
||||
if ! git diff --exit-code -- go.mod go.sum; then
|
||||
echo "precommit: go mod tidy changed go.mod/go.sum;" \
|
||||
"stage the changes and retry" >&2
|
||||
exit 1
|
||||
fi
|
||||
"$SCRIPT_DIR/check"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
Reference in New Issue
Block a user