forked from vmware/go-ipfix
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
84 lines (65 loc) · 2.77 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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
GO ?= go
GOPATH ?= $$($(GO) env GOPATH)
BINDIR ?= $(CURDIR)/bin
GOMOCK_VERSION := v1.6.0
PROTOC_GEN_GO_VERSION := v1.28.1
.PHONY: all
all: collector consumer
.mockgen-bin:
GOBIN=$(CURDIR)/$@ $(GO) install github.com/golang/mock/mockgen@$(GOMOCK_VERSION)
.protoc-bin:
GOBIN=$(CURDIR)/$@ $(GO) install google.golang.org/protobuf/cmd/protoc-gen-go@$(PROTOC_GEN_GO_VERSION)
.PHONY: codegen
codegen: .mockgen-bin .protoc-bin
PATH=$(CURDIR)/.mockgen-bin:$$PATH $(GO) generate ./...
# Make sure the IPFIX registries are up-to-date.
# Hitting 304 error when getting IANA registry csv file multiple times, so
# skipping this check temporarily.
# GO111MODULE=on $(GO) run pkg/registry/build_registry/build_registry.go
# Generate protobuf code for flow.proto with protoc.
protoc --go_out=. --plugin=$(CURDIR)/.protoc-bin/protoc-gen-go pkg/kafka/producer/protobuf/*.proto
.coverage:
mkdir -p ./.coverage
.PHONY: test-unit
test-unit: .coverage
$(GO) test -race ./... -covermode=atomic -coverprofile=.coverage/coverage_unit.txt
.PHONY: test-integration
test-integration: .coverage
$(GO) test -race ./pkg/test/... -tags=integration -covermode=atomic -coverprofile=.coverage/coverage_integration.txt -coverpkg github.com/vmware/go-ipfix/pkg/collector,github.com/vmware/go-ipfix/pkg/exporter,github.com/vmware/go-ipfix/pkg/intermediate,github.com/vmware/go-ipfix/pkg/kafka/producer
.golangci-bin:
@echo "===> Installing Golangci-lint <==="
@curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $@ v1.50.1
.PHONY: golangci
golangci:.golangci-bin
@GOOS=linux .golangci-bin/golangci-lint run -c .golangci.yml
.PHONY: golangci-fix
golangci-fix:.golangci-bin
@GOOS=linux .golangci-bin/golangci-lint run -c .golangci.yml --fix
.PHONY: collector
collector:
@mkdir -p $(BINDIR)
GOOS=linux $(GO) build -o $(BINDIR) github.com/vmware/go-ipfix/cmd/collector/
.PHONY: consumer
consumer:
@mkdir -p $(BINDIR)
GOOS=linux $(GO) build -o $(BINDIR) github.com/vmware/go-ipfix/cmd/consumer/
### Docker images ###
.PHONY: docker-collector
docker-collector:
@echo "===> Building antrea/ipfix-collector Docker image <==="
docker build --pull -t antrea/ipfix-collector -f build/images/Dockerfile.build.collector .
.PHONY: docker-consumer
docker-consumer:
@echo "===> Building antrea/kafka-consumer Docker image <==="
docker build --pull -t antrea/kafka-consumer -f build/images/Dockerfile.build.consumer .
.PHONY: manifest
manifest:
@echo "===> Generating dev manifest for Go-ipfix <==="
$(CURDIR)/hack/generate-manifest-collector.sh --mode dev > build/yamls/ipfix-collector.yaml
.PHONY: clean
clean:
@rm -rf $(BINDIR)
@rm -rf .mockgen-bin
@rm -rf .protoc-bin
@rm -rf .golangci-bin
@rm -rf .coverage