diff options
| -rwxr-xr-x | .githooks/pre-push | 4 | ||||
| -rw-r--r-- | AGENTS.md | 3 | ||||
| -rw-r--r-- | Makefile | 8 | ||||
| -rwxr-xr-x | scripts/install-hooks.sh | 5 |
4 files changed, 19 insertions, 1 deletions
diff --git a/.githooks/pre-push b/.githooks/pre-push new file mode 100755 index 0000000..4196081 --- /dev/null +++ b/.githooks/pre-push @@ -0,0 +1,4 @@ +#!/bin/sh +set -eu +cd "$(git rev-parse --show-toplevel)" +exec make gate @@ -94,6 +94,9 @@ helpers and `struct app` are in `clients/ui.[ch]`; the scene registry - Sanitizers: `make test-asan` (ASan) and `make test-ubsan` (UBSan) build `test_core` in `build-asan`/`build-ubsan`. Run them after touching allocation or arithmetic paths. +- Before you stop: `make gate` — a clean rebuild with `WERROR=1`, the full + suite and `test-asan`. `sh scripts/install-hooks.sh` points + `core.hooksPath` at `.githooks/` so the pre-push hook runs it automatically. - Never run `bokftui` for tests without `scripts/tui-sandbox.sh`: it isolates `XDG_CONFIG_HOME`/`XDG_CACHE_HOME` so a run cannot overwrite the human's `~/.config/bokf/tui.conf`, `~/.cache/bokf/tui.log` or bw session. @@ -5,6 +5,7 @@ VERSION ?= $(shell git describe --tags --always --dirty 2>/dev/null \ WARN = -Wall -Wextra -Wshadow -Wstrict-prototypes -Wmissing-prototypes \ -Wpointer-arith -Wvla -Wformat=2 +WARN += $(if $(WERROR),-Werror) DEPFLAGS = -MMD -MP CPPFLAGS = -Isrc -Iclients -Ivendor -Ivendor/argon2 DEFS = -D_GNU_SOURCE -DARGON2_NO_THREADS -DBOKF_VERSION=\"$(VERSION)\" @@ -109,6 +110,11 @@ test-asan: test-ubsan: $(MAKE) BUILD=build-ubsan CFLAGS="$(SAN_CFLAGS) -fsanitize=undefined" test-core +gate: + $(MAKE) clean + $(MAKE) WERROR=1 test + $(MAKE) WERROR=1 test-asan + $(BUILD)/vendor/%.o: vendor/%.c @mkdir -p $(dir $@) $(CC) $(CFLAGS) $(DEPFLAGS) $(CPPFLAGS) $(DEFS) -w -c $< -o $@ @@ -140,5 +146,5 @@ install: all clean: rm -rf $(BUILD) build-asan build-ubsan -.PHONY: all backend test test-core test-pty check test-asan test-ubsan \ +.PHONY: all backend test test-core test-pty check test-asan test-ubsan gate \ install clean diff --git a/scripts/install-hooks.sh b/scripts/install-hooks.sh new file mode 100755 index 0000000..02e0cfc --- /dev/null +++ b/scripts/install-hooks.sh @@ -0,0 +1,5 @@ +#!/bin/sh +set -eu +cd "$(dirname "$0")/.." +git config core.hooksPath .githooks +echo "git hooks: core.hooksPath=.githooks (pre-push runs 'make gate')" |
