-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathMakefile
145 lines (120 loc) · 3.06 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
# Copyright 2018 Iguazio
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
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: flake8
flake8:
cd clients/py && make flake8
.PHONY: test
test: test-go test-py
.PHONY: test-go
test-go:
GO111MODULE=on go test -v -timeout 20m ./...
.PHONY: test-py
test-py:
cd clients/py && $(MAKE) test
.PHONY: wheel
wheel:
cd clients/py && python setup.py bdist_wheel
.PHONY: python-dist
python-dist: python-deps
cd clients/py && $(MAKE) dist
.PHONY: set-version
set-version:
cd clients/py && $(MAKE) set-version
.PHONY: grpc
grpc: grpc-go grpc-py
.PHONY: grpc-go
grpc-go:
protoc frames.proto --go_out=pb --go-grpc_out=pb --go-grpc_opt=require_unimplemented_servers=false
.PHONY: grpc-py
grpc-py:
cd clients/py && \
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 && 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: 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) \
--platform=linux/amd64
golang:1.23-alpine \
make frames-bin
PHONY: gofmt
gofmt:
ifeq ($(shell gofmt -l .),)
# gofmt OK
else
$(error Please run `go fmt ./...` to format the code)
endif
.PHONY: lint
lint: gofmt