forked from ozontech/file.d
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
63 lines (51 loc) · 2.1 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
VERSION ?= $(shell git describe --abbrev=4 --dirty --always --tags)
TIME := $(shell date '+%Y-%m-%d_%H:%M:%S')
UPSTREAM_BRANCH ?= origin/master
.PHONY: build
build:
echo "Building for amd64..."
GOOS=linux GOARCH=amd64 go build -trimpath -ldflags "-X github.com/ozontech/file.d/buildinfo.Version=${VERSION} -X github.com/ozontech/file.d/buildinfo.BuildTime=${TIME}" -o file.d ./cmd/file.d
.PHONY: build-for-current-system
build-for-current-system:
echo "Building for current architecture..."
go build -ldflags "-X github.com/ozontech/file.d/buildinfo.Version=${VERSION} -X github.com/ozontech/file.d/buildinfo.BuildTime=${TIME}" -v -o file.d ./cmd/file.d
.PHONY: cover
cover:
go test -short -coverprofile=coverage.out ./...
go tool cover -html=coverage.out
rm coverage.out
.PHONY: test-short
test-short:
go test ./fd/ -v -count 1 -short
go test ./pipeline/ -v -count 1 -short
go test ./plugin/... -v -count 1 -short
.PHONY: test
test:
go test ./fd/ -v -count 1
go test ./pipeline/ -v -count 1
go test ./plugin/... -v -count 1
.PHONY: test-e2e
test-e2e:
go test ./cmd/ -v -count 1
go test ./e2e/... -v -count 1
.PHONY: bench-file
bench-file:
go test -bench LightJsonReadPar ./plugin/input/file -v -count 1 -run -benchmem -benchtime 1x
.PHONY: gen-doc
gen-doc:
go run github.com/vitkovskii/[email protected]
.PHONY: profile-file
profile-file:
go test -bench LightJsonReadPar ./plugin/input/file -v -count 1 -run -benchmem -benchtime 1x -cpuprofile cpu.pprof -memprofile mem.pprof -mutexprofile mutex.pprof
.PHONY: lint
lint:
# installation: https://golangci-lint.run/usage/install/#local-installation
golangci-lint run
.PHONY: mock
mock:
go run github.com/golang/mock/[email protected] -source=plugin/output/s3/s3.go -destination=plugin/output/s3/mock/s3.go
go run github.com/golang/mock/[email protected] -source=plugin/output/postgres/postgres.go -destination=plugin/output/postgres/mock/postgres.go
go run github.com/golang/mock/[email protected] -source=plugin/output/clickhouse/clickhouse.go -destination=plugin/output/clickhouse/mock/clickhouse.go Clickhouse
.PHONY: generate
generate: gen-doc mock
go generate ./...