forked from redpanda-data/connect
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
88 lines (68 loc) · 2.99 KB
/
Makefile
File metadata and controls
88 lines (68 loc) · 2.99 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
.PHONY: all deps rpm docker docker-deps docker-zmq docker-push clean docs test test-race test-integration fmt lint install
TAGS =
INSTALL_DIR = $(GOPATH)/bin
DEST_DIR = ./target
PATHINSTBIN = $(DEST_DIR)/bin
PATHINSTDOCKER = $(DEST_DIR)/docker
VERSION := $(shell git describe --tags || echo "v0.0.0")
VER_MAJOR := $(shell echo $(VERSION) | cut -f1 -d.)
VER_MINOR := $(shell echo $(VERSION) | cut -f2 -d.)
VER_PATCH := $(shell echo $(VERSION) | cut -f3 -d.)
DATE := $(shell date +"%Y-%m-%dT%H:%M:%SZ")
VER_FLAGS = -X main.Version=$(VERSION) \
-X main.DateBuilt=$(DATE)
LD_FLAGS =
GO_FLAGS =
APPS = benthos
all: $(APPS)
install: $(APPS)
@cp $(PATHINSTBIN)/* $(INSTALL_DIR)/
$(PATHINSTBIN)/%: $(wildcard lib/*/*.go lib/*/*/*.go lib/*/*/*/*.go cmd/*/*.go)
@mkdir -p $(dir $@)
@go build $(GO_FLAGS) -tags "$(TAGS)" -ldflags "$(LD_FLAGS) $(VER_FLAGS)" -o $@ ./cmd/$*
$(APPS): %: $(PATHINSTBIN)/%
docker:
@docker build -f ./resources/docker/Dockerfile . -t jeffail/benthos:$(VERSION)
@docker tag jeffail/benthos:$(VERSION) jeffail/benthos:$(VER_MAJOR)
@docker tag jeffail/benthos:$(VERSION) jeffail/benthos:$(VER_MAJOR).$(VER_MINOR)
@docker tag jeffail/benthos:$(VERSION) jeffail/benthos:latest
docker-deps:
@docker build -f ./resources/docker/Dockerfile --target deps . -t jeffail/benthos:$(VERSION)-deps
@docker tag jeffail/benthos:$(VERSION)-deps jeffail/benthos:latest-deps
docker-zmq:
@docker build -f ./resources/docker/Dockerfile.zmq . -t jeffail/benthos:$(VERSION)-zmq
@docker tag jeffail/benthos:$(VERSION)-zmq jeffail/benthos:latest-zmq
docker-push:
@docker push jeffail/benthos:$(VERSION)-deps; true
@docker push jeffail/benthos:latest-deps; true
@docker push jeffail/benthos:$(VERSION)-zmq; true
@docker push jeffail/benthos:latest-zmq; true
@docker push jeffail/benthos:$(VERSION); true
@docker push jeffail/benthos:$(VER_MAJOR); true
@docker push jeffail/benthos:$(VER_MAJOR).$(VER_MINOR); true
@docker push jeffail/benthos:latest; true
fmt:
@go list -f {{.Dir}} ./... | xargs -I{} gofmt -w -s {}
lint:
@go vet $(GO_FLAGS) ./...
@golint -min_confidence 0.5 ./cmd/... ./lib/...
test:
@go test $(GO_FLAGS) -short ./...
test-race:
@go test $(GO_FLAGS) -short -race ./...
test-integration:
@go test $(GO_FLAGS) -timeout 600s ./...
clean:
rm -rf $(PATHINSTBIN)
rm -rf $(DEST_DIR)/dist
rm -rf $(PATHINSTDOCKER)
docs: $(APPS)
@$(PATHINSTBIN)/benthos --print-yaml --all > ./config/everything.yaml; true
@$(PATHINSTBIN)/benthos --list-inputs > ./docs/inputs/README.md; true
@$(PATHINSTBIN)/benthos --list-processors > ./docs/processors/README.md; true
@$(PATHINSTBIN)/benthos --list-conditions > ./docs/conditions/README.md; true
@$(PATHINSTBIN)/benthos --list-buffers > ./docs/buffers/README.md; true
@$(PATHINSTBIN)/benthos --list-outputs > ./docs/outputs/README.md; true
@$(PATHINSTBIN)/benthos --list-caches > ./docs/caches/README.md; true
@$(PATHINSTBIN)/benthos --list-rate-limits > ./docs/rate_limits/README.md; true
@go run $(GO_FLAGS) ./cmd/tools/benthos_config_gen/main.go