summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile24
1 files changed, 23 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index 4719a6d..5fc9b59 100644
--- a/Makefile
+++ b/Makefile
@@ -5,7 +5,7 @@ PREFIX ?= $(HOME)/.local
BINDIR := $(PREFIX)/bin
MANDIR := $(PREFIX)/share/man/man1
-.PHONY: help build build-full install install-full uninstall test vet fmt clean cross check-corpora add-corpus
+.PHONY: help build build-full install install-full uninstall test vet fmt clean cross check-corpora add-corpus ci release install-hooks
help: ## show this help
@grep -hE '^[a-z-]+:.*##' $(MAKEFILE_LIST) | sed -E 's/:.*## /\t/' | sort
build: ## build all three binaries (embeds only the Vulgate)
@@ -40,6 +40,28 @@ vet: ## go vet
go vet ./...
fmt: ## gofmt the tree
gofmt -w .
+ci: ## full pre-push gate: gofmt clean, vet, both tag sets, corpora
+ @u=$$(gofmt -l .); test -z "$$u" || { echo "gofmt needed:"; echo "$$u"; exit 1; }
+ go vet ./...
+ go test ./...
+ $(MAKE) test
+install-hooks: ## install the git pre-push hook (runs make ci)
+ @mkdir -p .git/hooks
+ @cp scripts/hooks/pre-push .git/hooks/pre-push
+ @chmod +x .git/hooks/pre-push
+ @echo "installed .git/hooks/pre-push -> runs 'make ci' (bypass a push with --no-verify)"
+release: ## cut a release: make release VERSION=0.46.0 (add its CHANGELOG line first)
+ @test -n "$(VERSION)" || { echo "set VERSION=X.Y.Z" >&2; exit 2; }
+ @echo "$(VERSION)" | grep -qE '^[0-9]+\.[0-9]+\.[0-9]+$$' || { echo "VERSION must be X.Y.Z" >&2; exit 2; }
+ @test -z "$$(git status --porcelain)" || { echo "working tree not clean; commit or stash first" >&2; exit 2; }
+ @grep -q '## \[$(VERSION)\]' CHANGELOG.md || { echo "add a one-line CHANGELOG.md entry under '## [$(VERSION)]' first" >&2; exit 2; }
+ @sed -i 's/^const Version = ".*"/const Version = "$(VERSION)"/' internal/config/config.go
+ @grep -q 'const Version = "$(VERSION)"' internal/config/config.go || { echo "version bump failed" >&2; exit 2; }
+ $(MAKE) ci
+ git add internal/config/config.go CHANGELOG.md
+ git commit -m "release: v$(VERSION)"
+ git tag -a "v$(VERSION)" -m "lectio $(VERSION)"
+ @echo "tagged v$(VERSION). publish with: git push origin main v$(VERSION)"
clean: ## remove build artifacts
rm -f $(LECTIO) $(LECTIO_UI) $(LECTIO_WEB); rm -rf dist
cross: ## cross-compile into dist/