This repository was archived by the owner on Nov 8, 2026. It is now read-only.
Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
75 lines (59 loc) · 2.46 KB
/
Copy pathMakefile
File metadata and controls
75 lines (59 loc) · 2.46 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
.PHONY: proto build test test-unit fmt check-format lint lint-workflows lint-docs quickstart quickstart-down
PROTO_DIR := proto
GEN_DIR := gen
SINK_PROTOCOL_PROTO_DIR = $(shell go list -m -f '{{.Dir}}' github.com/batchstream/sink-protocol)/proto
STATICCHECK_VERSION := v0.8.1
ACTIONLINT_VERSION := v1.7.12
LYCHEE ?= lychee
build:
go build -o bin/sink ./cmd/sink
proto:
@mkdir -p $(GEN_DIR)
protoc \
--proto_path=$(PROTO_DIR) \
--proto_path=$(SINK_PROTOCOL_PROTO_DIR) \
--go_out=$(GEN_DIR) --go_opt=paths=source_relative \
--go-grpc_out=$(GEN_DIR) --go-grpc_opt=paths=source_relative \
--go-vtproto_out=$(GEN_DIR) --go-vtproto_opt=paths=source_relative,features=marshal+unmarshal+size+pool \
$(PROTO_DIR)/forward/forward.proto
@printf '%s\n%s\n' '// Package forward contains the private Gateway-to-Engine protobuf contract.' 'package forward' > $(GEN_DIR)/forward/doc.go
test:
go test ./... -v -count=1
test-unit:
go test ./... -v -count=1
quickstart:
bash examples/quickstart/run.sh
quickstart-down:
docker compose --file examples/quickstart/compose.yaml down
fmt:
gofmt -s -w .
check-format:
@set -e; files="$$(gofmt -l .)"; \
if [ -n "$$files" ]; then \
printf '%s\n' "$$files"; \
printf '%s\n' 'Run make fmt to format these files.'; \
exit 1; \
fi
lint: check-format
python3 scripts/check-test-boundary.py
go vet ./...
go run honnef.co/go/tools/cmd/staticcheck@$(STATICCHECK_VERSION) -checks=all ./...
lint-workflows:
go run github.com/rhysd/actionlint/cmd/actionlint@$(ACTIONLINT_VERSION) -shellcheck=''
lint-docs:
$(LYCHEE) --offline --include-fragments --no-progress '*.md' 'configs/*.md' 'docs/**/*.md' 'examples/**/*.md' '.github/*.md'
# Core-package floors are kept separately from generated code and examples.
.PHONY: test-coverage benchmark-unit fuzz-unit
COVERAGE_DIR ?= .reports/coverage
test-coverage:
@mkdir -p $(COVERAGE_DIR)
go test -mod=readonly -race -covermode=atomic -coverpkg=./... -coverprofile=$(COVERAGE_DIR)/unit.out -count=1 -timeout=10m -json ./... > $(COVERAGE_DIR)/unit.jsonl
python3 -m unittest discover -s scripts -p 'test_coverage.py'
python3 scripts/check-coverage.py --profile $(COVERAGE_DIR)/unit.out --minimums .github/coverage-minimums.json --report $(COVERAGE_DIR)/summary.md
BENCH ?= .
BENCHTIME ?= 1s
FUZZ_TIME ?= 30s
benchmark-unit:
go test -mod=readonly ./internal/... -run '^$$' -bench '$(BENCH)' -benchtime=$(BENCHTIME) -benchmem -count=1 -timeout=10m
fuzz-unit:
FUZZ_TIME=$(FUZZ_TIME) bash scripts/test-fuzz.sh