mirror of
https://github.com/Warky-Devs/vecna.git
synced 2026-05-05 01:26:58 +00:00
64 lines
1.8 KiB
Makefile
64 lines
1.8 KiB
Makefile
BINARY := vecna
|
|
CMD := ./cmd/vecna
|
|
BUILD_DIR := ./bin
|
|
|
|
BUMP ?= patch
|
|
TEST_URL ?=
|
|
TEST_MODEL ?=
|
|
|
|
.PHONY: all build test lint fmt tidy clean release-version test-integration
|
|
|
|
all: tidy fmt lint test build
|
|
|
|
build:
|
|
mkdir -p $(BUILD_DIR)
|
|
go build -o $(BUILD_DIR)/$(BINARY) $(CMD)
|
|
|
|
test:
|
|
go test ./...
|
|
|
|
lint:
|
|
golangci-lint run ./...
|
|
|
|
fmt:
|
|
golangci-lint run --fix ./...
|
|
gofmt -w .
|
|
|
|
tidy:
|
|
go mod tidy
|
|
|
|
clean:
|
|
rm -rf $(BUILD_DIR)
|
|
|
|
# Run dimension integration tests against a live embedding server.
|
|
# Requires VECNA_TEST_URL and VECNA_TEST_MODEL to be set.
|
|
#
|
|
# Examples:
|
|
# make test-integration TEST_URL=http://localhost:11434 TEST_MODEL=nomic-embed-text
|
|
# make test-integration TEST_URL=http://localhost:11434 TEST_MODEL=nomic-embed-text VECNA_TEST_TARGET_DIM=256
|
|
#
|
|
test-integration:
|
|
@if [ -z "$(TEST_URL)" ]; then echo "ERROR: TEST_URL is required"; exit 1; fi
|
|
@if [ -z "$(TEST_MODEL)" ]; then echo "ERROR: TEST_MODEL is required"; exit 1; fi
|
|
VECNA_TEST_URL=$(TEST_URL) \
|
|
VECNA_TEST_MODEL=$(TEST_MODEL) \
|
|
VECNA_TEST_API_TYPE=$(or $(TEST_API_TYPE),openai) \
|
|
VECNA_TEST_API_KEY=$(TEST_API_KEY) \
|
|
go test -v -tags integration -timeout 120s ./tests/integration/
|
|
|
|
release-version:
|
|
@current=$$(git describe --tags --abbrev=0 2>/dev/null || echo "v0.0.0"); \
|
|
major=$$(echo $$current | sed 's/^v//' | cut -d. -f1); \
|
|
minor=$$(echo $$current | sed 's/^v//' | cut -d. -f2); \
|
|
patch=$$(echo $$current | sed 's/^v//' | cut -d. -f3); \
|
|
case "$(BUMP)" in \
|
|
major) major=$$((major+1)); minor=0; patch=0 ;; \
|
|
minor) minor=$$((minor+1)); patch=0 ;; \
|
|
patch) patch=$$((patch+1)) ;; \
|
|
*) echo "Unknown BUMP value '$(BUMP)'. Use: patch (default), minor, major"; exit 1 ;; \
|
|
esac; \
|
|
next="v$${major}.$${minor}.$${patch}"; \
|
|
echo "Tagging $$current → $$next"; \
|
|
git tag -a "$$next" -m "Release $$next"; \
|
|
git push origin "$$next"
|