This repository was archived by the owner on Apr 16, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
85 lines (63 loc) · 2.71 KB
/
Copy pathMakefile
File metadata and controls
85 lines (63 loc) · 2.71 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
GO ?= go
MIN_COVERAGE ?= 75
STATICCHECK_VERSION ?= v0.6.1
STATICCHECK_BIN := $(shell $(GO) env GOPATH)/bin/staticcheck
GOLANGCI_LINT_VERSION ?= v2.11.3
GOLANGCI_LINT_BIN := $(shell $(GO) env GOPATH)/bin/golangci-lint
.PHONY: ci-local test race vet lint lint-install staticcheck staticcheck-install coverage openapi proto proto-lint config-lint chart-assert helm-lint helm-template onboard onboard-smoke setup-hooks install-hooks proto-check
ci-local: vet test race lint staticcheck coverage openapi proto-lint config-lint chart-assert helm-lint helm-template
test:
$(GO) test ./...
race:
$(GO) test -race ./...
vet:
$(GO) vet ./...
lint-install:
GOTOOLCHAIN=go1.26.2 $(GO) install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@$(GOLANGCI_LINT_VERSION)
lint: lint-install
GOTOOLCHAIN=go1.26.2 $(GOLANGCI_LINT_BIN) run ./...
staticcheck-install:
GOTOOLCHAIN=go1.26.2 $(GO) install honnef.co/go/tools/cmd/staticcheck@$(STATICCHECK_VERSION)
staticcheck: staticcheck-install
GOTOOLCHAIN=go1.26.2 $(STATICCHECK_BIN) ./...
coverage:
$(GO) test ./... -coverprofile=/tmp/siphon.coverage.out
@{ \
head -n 1 /tmp/siphon.coverage.out; \
tail -n +2 /tmp/siphon.coverage.out | grep -Ev '(^|/).*(\.pb|\.connect)\.go:'; \
} >/tmp/siphon.coverage.filtered.out
$(GO) tool cover -func=/tmp/siphon.coverage.filtered.out
@total="$$( $(GO) tool cover -func=/tmp/siphon.coverage.filtered.out | awk '/^total:/ {gsub(/%/, "", $$3); print $$3}' )"; \
echo "Total coverage: $${total}% (minimum: $(MIN_COVERAGE)%)"; \
awk -v got="$$total" -v min="$(MIN_COVERAGE)" 'BEGIN { if (got + 0 < min + 0) { printf("coverage %.1f%% is below minimum %.1f%%\n", got, min); exit 1 } }'
openapi:
$(GO) test ./cmd/tap -run TestAdminOpenAPIContractMatchesRuntime -count=1
proto:
buf generate
proto-lint:
buf lint
proto-check: proto
@if git diff --quiet -- 'proto/**/*.pb.go' 'proto/**/*connect.go'; then \
echo "ok: generated proto code is up to date"; \
else \
echo "error: proto generated code is stale — run 'make proto' and commit"; \
git diff --stat -- 'proto/**/*.pb.go' 'proto/**/*connect.go'; \
exit 1; \
fi
setup-hooks:
git config core.hooksPath scripts
@echo "ok: git hooks configured to use scripts/"
install-hooks: setup-hooks
config-lint:
./scripts/lint-config.sh
chart-assert:
./scripts/assert-chart-render.sh
helm-lint:
helm lint charts/siphon
helm-template:
helm template siphon charts/siphon >/dev/null
onboard:
./scripts/bootstrap.sh
onboard-smoke:
@if [ -z "$(ONBOARD_SECRET)" ]; then echo "ONBOARD_SECRET is required"; exit 1; fi
./scripts/smoke-onboarding.sh --provider $(or $(ONBOARD_PROVIDER),generic) --release $(or $(ONBOARD_RELEASE),siphon) --namespace $(or $(ONBOARD_NAMESPACE),siphon) --secret "$(ONBOARD_SECRET)"