-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
62 lines (50 loc) · 2.06 KB
/
Makefile
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
# Directories containing independent Go modules.
MODULE_DIRS = .
GOLANGCI_VERSION=1.61.0
AVRO_CMD_PATH=github.com/hamba/avro/v2/cmd/avrogen@v2.26.0
# Sets up kafka broker using docker compose
.PHONY: setup
setup:
docker compose -f ./example/compose.yaml up -d
# Assumes setup has been executed. Runs go test with coverage
.PHONY: cover
cover:
./coverage.sh
# Runs setup and executes tests with coverage.
.PHONY: test-local
test-local: setup cover
.PHONY: example-producer
example-producer:
go run example/producer/main.go
.PHONY: example-worker
example-worker:
go run example/worker/main.go
.PHONY: example-deadletter-worker
example-deadletter-worker:
go run example/worker-deadletter/main.go
.PHONY: example-delay-worker
example-delay-worker:
go run example/worker-delay/main.go
.PHONY: lint
lint: golangci-lint
.PHONY: golangci-lint
golangci-lint:
@$(foreach mod,$(MODULE_DIRS), \
(cd $(mod) && \
echo "[lint] golangci-lint: $(mod)" && \
go run github.com/golangci/golangci-lint/cmd/golangci-lint@v${GOLANGCI_VERSION} run $(ARGS) --path-prefix $(mod) ./...) &&) true
.PHONY: gen
gen: protoc-exists
cd test/evolution; protoc --proto_path=. --go_out=./ ./schema_1.proto
cd test/evolution; protoc --proto_path=. --go_out=./ ./schema_2.proto
go run ${AVRO_CMD_PATH} -pkg main -o ./example/producer_avro/event_gen.go ./example/producer_avro/event.avsc
go run ${AVRO_CMD_PATH} -pkg main -o ./example/worker_avro/event_gen.go ./example/worker_avro/event.avsc
mkdir -p ./test/evolution/avro1
mkdir -p ./test/evolution/avro2
go run ${AVRO_CMD_PATH} -pkg avro1 -o ./test/evolution/avro1/schema_1_gen.go ./test/evolution/schema_1.avsc
go run ${AVRO_CMD_PATH} -pkg avro2 -o ./test/evolution/avro2/schema_2_gen.go ./test/evolution/schema_2.avsc
go run github.com/heetch/avro/cmd/avrogo@v0.4.5 -p avro1 -d ./test/evolution/avro1x ./test/evolution/schema_1.avsc
# a forced dependency which fails (and prints) if `avro-tools` isn't installed
.PHONY: protoc-exists
protoc-exists:
@which protoc > /dev/null || (echo "protoc is not installed. Install via `brew install protobuf`"; exit 1)