forked from v3io/frames
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
155 lines (129 loc) · 3.52 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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
FRAMES_TAG ?= latest
FRAMES_REPOSITORY ?= iguazio/
FRAMES_PATH ?= src/github.com/v3io/frames
FRAMES_BUILD_COMMAND ?= GO111MODULE=on go build -o framesd-$(FRAMES_TAG)-$(GOOS)-$(GOARCH) -ldflags "-X main.Version=$(FRAMES_TAG)" ./cmd/framesd
GOPATH ?= ~/go
.PHONY: build
build:
docker build \
--build-arg FRAMES_VERSION=$(FRAMES_TAG) \
--file cmd/framesd/Dockerfile \
--tag $(FRAMES_REPOSITORY)frames:$(FRAMES_TAG) \
.
build-framulate:
docker build \
--build-arg FRAMES_VERSION=$(FRAMES_TAG) \
--file cmd/framulate/Dockerfile \
--tag $(FRAMES_REPOSITORY)framulate:$(FRAMES_TAG) \
.
.PHONY: test
test: test-go test-py
.PHONY: test-go
test-go:
GO111MODULE=on go test -v $(testflags) -timeout 20m ./...
.PHONY: test-py
test-py:
cd clients/py && $(MAKE) test
.PHONY: wheel
wheel:
cd clients/py && python setup.py bdist_wheel
.PHONY: grpc
grpc: grpc-go grpc-py
.PHONY: grpc-go
grpc-go:
protoc frames.proto --go_out=plugins=grpc:pb
.PHONY: grpc-py
grpc-py:
cd clients/py && \
pipenv run python -m grpc_tools.protoc \
-I../.. --python_out=v3io_frames\
--grpc_python_out=v3io_frames \
../../frames.proto
python _scripts/fix_pb_import.py \
clients/py/v3io_frames/frames_pb2_grpc.py
.PHONY: pypi
pypi:
cd clients/py && \
pipenv run make upload
.PHONY: cloc
cloc:
cloc \
--exclude-dir=_t,.ipynb_checkpoints,_examples,_build \
.
.PHONY: update-deps
update-deps: update-go-deps update-py-deps update-tsdb-deps
.PHONY: update-go-deps
update-go-deps:
go mod tidy
git add go.mod go.sum
@echo "Don't forget to test & commit"
.PHONY: update-py-deps
update-py-deps:
cd clients/py && $(MAKE) update-deps
git add clients/py/Pipfile*
@echo "Don't forget to test & commit"
.PHONY: update-tsdb-deps
update-tsdb-deps:
GO111MODULE=on go get github.com/v3io/v3io-tsdb@master
@echo "Done. Don't forget to commit ☺"
.PHONY: python-deps
python-deps:
cd clients/py && $(MAKE) sync-deps
.PHONY: bench
bench:
@echo Go
$(MAKE) bench-go
@echo Python
$(MAKE) bench-py
.PHONY: bench-go
bench-go:
./_scripts/go_benchmark.py
.PHONY: bench-py
bench-py:
./_scripts/py_benchmark.py
.PHONY: frames-bin
frames-bin:
$(FRAMES_BUILD_COMMAND)
.PHONY: frames
frames:
docker run \
--volume $(shell pwd):/go/$(FRAMES_PATH) \
--volume $(shell pwd):/go/bin \
--workdir /go/$(FRAMES_PATH) \
--env GOOS=$(GOOS) \
--env GOARCH=$(GOARCH) \
--env FRAMES_TAG=$(FRAMES_TAG) \
golang:1.12 \
make frames-bin
PHONY: gofmt
gofmt:
ifeq ($(shell gofmt -l .),)
# gofmt OK
else
$(error Please run `go fmt ./...` to format the code)
endif
.PHONY: impi
impi:
@echo Installing impi...
go get -u github.com/pavius/impi/cmd/impi
@echo Verifying imports...
$(GOPATH)/bin/impi \
--local github.com/iguazio/provazio \
--skip pkg/controller/apis \
--skip pkg/controller/client \
--ignore-generated \
--scheme stdLocalThirdParty \
./...
$(GOPATH)/bin/golangci-lint:
@echo Installing golangci-lint...
curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s v1.10.2
cp ./bin/golangci-lint $(GOPATH)/bin/
.PHONY: lint
lint: gofmt impi $(GOPATH)/bin/golangci-lint
@echo Linting...
@$(GOPATH)/bin/golangci-lint run \
--disable-all --enable=deadcode --enable=goconst --enable=golint --enable=ineffassign \
--enable=interfacer --enable=unconvert --enable=varcheck --enable=errcheck --enable=gofmt --enable=misspell \
--enable=staticcheck --enable=gosimple --enable=govet --enable=goconst \
api/... backends/... cmd/... framulate/... grpc/... http/... repeatingtask/... v3ioutils/...
@echo done linting