-
Notifications
You must be signed in to change notification settings - Fork 117
/
Makefile
67 lines (53 loc) · 1.7 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
VERSION=$(shell git describe --tags --dirty)
SINKER_LDFLAGS += -X "main.version=$(VERSION)"
SINKER_LDFLAGS += -X "main.date=$(shell date --iso-8601=s)"
SINKER_LDFLAGS += -X "main.commit=$(shell git rev-parse HEAD)"
SINKER_LDFLAGS += -X "main.builtBy=$(shell echo `whoami`@`hostname`)"
DEFAULT_CFG_PATH = /etc/clickhouse_sinker.hjson
IMG_TAGGED = hub.eoitek.net/aimeter/clickhouse_sinker:${VERSION}
IMG_LATEST = hub.eoitek.net/aimeter/clickhouse_sinker:latest
export GOPROXY=https://goproxy.cn,direct
GO := CGO_ENABLED=0 go
GOBUILD := $(GO) build $(BUILD_FLAG)
.PHONY: pre
pre:
go mod tidy
.PHONY: build
build: pre
$(GOBUILD) -ldflags '$(SINKER_LDFLAGS)' -o bin/ ./...
.PHONY: debug
debug: pre
$(GOBUILD) -ldflags '$(SINKER_LDFLAGS)' -gcflags "all=-N -l" -o bin/ ./...
.PHONY: benchtest
benchtest: pre
go test -bench=. ./...
.PHONY: systest
systest: build
bash go.test.sh
bash go.metrictest.sh
.PHONY: gotest
gotest: pre
go test -v ./... -coverprofile=coverage.out -covermode count
go tool cover -func coverage.out
.PHONY: lint
lint:
golangci-lint run -D errcheck,govet,gosimple
.PHONY: run
run: pre
go run cmd/clickhouse_sinker/main.go --local-cfg-file docker/test_dynamic_schema.hjson
.PHONY: release
release:
goreleaser release --skip-publish --clean
.PHONY: docker-build
docker-build: release
docker build . -t clickhouse_sinker:${VERSION} -f Dockerfile_goreleaser
docker tag clickhouse_sinker:${VERSION} ${IMG_TAGGED}
docker tag clickhouse_sinker:${VERSION} ${IMG_LATEST}
docker rmi clickhouse_sinker:${VERSION}
.PHONY: docker-push
docker-push:
docker push ${IMG_TAGGED}
docker push ${IMG_LATEST}
.PHONY: docker-run
docker-run:
docker run -d -v ${DEFAULT_CFG_PATH}:${DEFAULT_CFG_PATH} ${IMG_LATEST}