summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLukasz Kasprzak <lukas@labunix.xyz>2026-07-27 20:43:54 +0200
committerLukasz Kasprzak <lukas@labunix.xyz>2026-07-27 20:43:54 +0200
commitee5f1e21f306d93b82d657917c92cc379c1df285 (patch)
tree3fa9eb746e08831e790ed0b5efdc2e7ed56d5500
parent588d9fb64e023d08b3e6105b69c08d3f9ddf6083 (diff)
downloadlectio-ee5f1e21f306d93b82d657917c92cc379c1df285.tar.gz
lectio-ee5f1e21f306d93b82d657917c92cc379c1df285.zip
build: corpus-validate script + add-corpus/check-corpora make targets
-rw-r--r--Makefile26
-rwxr-xr-xscripts/corpus-validate.sh6
2 files changed, 30 insertions, 2 deletions
diff --git a/Makefile b/Makefile
index f5018eb..50fcb87 100644
--- a/Makefile
+++ b/Makefile
@@ -4,7 +4,7 @@ LECTIO_WEB := lectio-web
PREFIX ?= $(HOME)/.local
BINDIR := $(PREFIX)/bin
-.PHONY: help build install uninstall test vet fmt clean cross
+.PHONY: help build install uninstall test vet fmt clean cross check-corpora add-corpus
help: ## show this help
@grep -hE '^[a-z-]+:.*##' $(MAKEFILE_LIST) | sed -E 's/:.*## /\t/' | sort
build: ## build ./lectio, ./lectio-ui and ./lectio-web
@@ -19,7 +19,7 @@ install: ## build and install all three to $(BINDIR)
@echo "installed $(BINDIR)/$(LECTIO), $(BINDIR)/$(LECTIO_UI) and $(BINDIR)/$(LECTIO_WEB)"
uninstall: ## remove installed binaries
rm -f $(BINDIR)/$(LECTIO) $(BINDIR)/$(LECTIO_UI) $(BINDIR)/$(LECTIO_WEB)
-test: ## run tests
+test: check-corpora ## run tests
go test ./...
vet: ## go vet
go vet ./...
@@ -36,3 +36,25 @@ cross: ## cross-compile into dist/
GOOS=$$os GOARCH=$$arch go build -o dist/$(LECTIO_UI)-$$os-$$arch$$ext ./cmd/lectio-ui; \
GOOS=$$os GOARCH=$$arch go build -o dist/$(LECTIO_WEB)-$$os-$$arch$$ext ./cmd/lectio-web; \
done
+
+# Validate every embedded corpus (CI gate). grb is EXEMPT: it is a scholarly
+# Septuagint corpus whose Book column intentionally carries Orthodox-canon
+# extras (1-4 Esdras/Maccabees, Odes, Psalms of Solomon) and manuscript variants
+# (…(Theodotion)/(Sinaiticus)/(Vaticanus)) that are not in the 73-key Catholic
+# canon and would collide with canonical keys if renamed. --corpus-check grb
+# correctly reports these; they are by design, not defects to fix here.
+check-corpora: ## validate all embedded bible corpora (skips grb, see comment)
+ @for f in internal/bible/corpora/*.tsv; do \
+ code=$$(basename $$f .tsv); \
+ [ "$$code" = grb ] && { echo "skipping grb (broader LXX canon)"; continue; }; \
+ echo "checking $$code"; \
+ go run ./cmd/lectio --corpus-check $$code || exit 1; \
+ done
+
+# Validate then embed a corpus pair: make add-corpus CORPUS=fr-crampon SRC=/path/to/dir
+add-corpus: ## validate + copy a corpus pair into internal/bible/corpora/, then build
+ @test -n "$(CORPUS)" || { echo "set CORPUS=<code>" >&2; exit 2; }
+ @test -n "$(SRC)" || { echo "set SRC=<dir with $(CORPUS).tsv/.ini>" >&2; exit 2; }
+ go run ./cmd/lectio --corpus-check "$(SRC)/$(CORPUS).tsv"
+ cp "$(SRC)/$(CORPUS).tsv" "$(SRC)/$(CORPUS).ini" internal/bible/corpora/
+ $(MAKE) build
diff --git a/scripts/corpus-validate.sh b/scripts/corpus-validate.sh
new file mode 100755
index 0000000..ba46812
--- /dev/null
+++ b/scripts/corpus-validate.sh
@@ -0,0 +1,6 @@
+#!/bin/sh
+# Validate a bible corpus by code or by .tsv path (see lectio --corpus-check).
+# Usage: scripts/corpus-validate.sh <code|path-to-tsv>
+set -e
+[ -n "$1" ] || { echo "usage: $0 <code|path.tsv>" >&2; exit 2; }
+exec go run ./cmd/lectio --corpus-check "$1"