diff options
| author | Lukasz Kasprzak <lukas@labunix.xyz> | 2026-07-29 21:46:26 +0200 |
|---|---|---|
| committer | Lukasz Kasprzak <lukas@labunix.xyz> | 2026-07-29 21:46:26 +0200 |
| commit | ddaf8f63bc0e77930da4762fc31afa1c9d439b05 (patch) | |
| tree | 223790651e9bda8d97861f4c646f6a636e977cca /Makefile | |
| parent | fdaacff5f797a46300c34a0eb7a14f3ba7835786 (diff) | |
| download | lectio-ddaf8f63bc0e77930da4762fc31afa1c9d439b05.tar.gz lectio-ddaf8f63bc0e77930da4762fc31afa1c9d439b05.zip | |
build: add ci + release targets, a pre-push hook, and a CHANGELOG
Process hygiene so the version never silently drifts again and the two
build-tag test sets stay green.
- `make ci`: gofmt-clean + go vet + `go test ./...` (default tags) AND
`make test` (-tags fullbible + corpus checks). The default-tag suite is
easy to forget (only fullbible embeds the corpora), so ci runs both.
- scripts/hooks/pre-push + `make install-hooks`: run `make ci` before any
push (bypass with --no-verify).
- `make release VERSION=x.y.z`: refuse a dirty tree or a missing CHANGELOG
entry, bump const Version, run ci, commit, and tag vX.Y.Z (prints the
push command -- publishing stays a manual choice).
- CHANGELOG.md: terse, one line per release, starting at the first tags.
Diffstat (limited to 'Makefile')
| -rw-r--r-- | Makefile | 24 |
1 files changed, 23 insertions, 1 deletions
@@ -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/ |
