-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
105 lines (81 loc) · 3.55 KB
/
Copy pathMakefile
File metadata and controls
105 lines (81 loc) · 3.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
SHELL := /usr/bin/env bash
BIN := commitbrief
PKG := github.com/CommitBrief/commitbrief
VERSION := $(shell git describe --tags --always --dirty 2>/dev/null || echo dev)
COMMIT := $(shell git rev-parse --short HEAD 2>/dev/null || echo none)
DATE := $(shell date -u +%Y-%m-%dT%H:%M:%SZ)
LDFLAGS := -s -w \
-X $(PKG)/internal/version.Version=$(VERSION) \
-X $(PKG)/internal/version.Commit=$(COMMIT) \
-X $(PKG)/internal/version.Date=$(DATE)
GO ?= go
.PHONY: help build test test-live eval eval-live bench lint fmt tidy clean check release-check license-check i18n-check spdx-check security-check manpage smoke
help: ## Show this help
@awk 'BEGIN {FS = ":.*## "} /^[a-zA-Z_-]+:.*## / {printf " \033[36m%-18s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)
build: ## Compile the commitbrief binary into ./$(BIN)
$(GO) build -ldflags '$(LDFLAGS)' -o $(BIN) ./cmd/commitbrief
test: ## Run unit + integration tests (live provider tests excluded)
$(GO) test ./...
test-live: ## Run live provider tests (real API keys required)
$(GO) test -tags=live ./...
eval: ## Deterministic mock-tier review-quality eval (CI-safe; ADR-0018)
$(GO) test ./internal/eval/ -run TestEvalMockCorpus -v
eval-live: ## Live-provider review-quality eval (uses COMMITBRIEF_EVAL_PROVIDER or ~/.commitbrief/config.yml)
$(GO) test -tags=live -count=1 -timeout=20m ./internal/eval/ -run '^TestEvalLive$$' -v
eval-dump: ## Diagnostic: print every finding a live provider produces per fixture (match/EXTRA)
$(GO) test -tags=live -count=1 -timeout=20m ./internal/eval/ -run '^TestEvalLiveDump$$' -v
bench: ## Run local-pipeline + cache benchmarks (PRD §7.1 targets)
$(GO) test -bench=. -benchmem -run=^$$ ./internal/diff ./internal/cache
lint: ## Run golangci-lint
golangci-lint run
fmt: ## Format source with gofmt (+ goimports if available)
gofmt -s -w .
@if command -v goimports >/dev/null 2>&1; then \
goimports -w -local $(PKG) . ; \
else \
echo "goimports not installed (go install golang.org/x/tools/cmd/goimports@latest)"; \
fi
tidy: ## Sync go.mod / go.sum
$(GO) mod tidy
clean: ## Remove build artifacts
rm -f $(BIN) $(BIN).exe
rm -rf dist/
release-check: ## Run pre-release safety checks (scripts/release-check.sh)
bash scripts/release-check.sh
license-check: ## Audit dependency licenses for GPL-3.0 compatibility
bash scripts/license-check.sh
i18n-check: ## Flag i18n catalog keys with no Go source reference (UC-25)
bash scripts/i18n-deadkey-check.sh
spdx-check: ## Fail if any Go source file is missing the SPDX header (ADR-0012)
bash scripts/spdx-check.sh
security-check: ## Run gosec with the documented exclusion set
bash scripts/security-scan.sh
check: ## Run every guard CI runs (fmt-drift, vet, lint, test, release-check, i18n-check, spdx-check)
@echo "==> gofmt drift"
@drift=$$(gofmt -l -s . | grep -v '^vendor/' || true); \
if [ -n "$$drift" ]; then \
echo "gofmt: needs '-s -w' on:"; echo "$$drift"; exit 1; \
fi
@echo "==> go vet"
@$(GO) vet ./...
@echo "==> golangci-lint"
@$(MAKE) -s lint
@echo "==> go test"
@$(GO) test ./...
@echo "==> release-check"
@$(MAKE) -s release-check
@echo "==> i18n-check"
@$(MAKE) -s i18n-check
@echo "==> spdx-check"
@$(MAKE) -s spdx-check
@echo "==> security-check (gosec)"
@if command -v gosec >/dev/null 2>&1; then \
$(MAKE) -s security-check; \
else \
echo "gosec not installed locally; skipping. brew install gosec to enable."; \
fi
@echo "==> all checks passed"
manpage: ## Regenerate man/commitbrief.1
bash scripts/manpage.sh
smoke: ## Build + walk the pipeline end-to-end without an API call
bash scripts/smoke-test.sh