Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
126 lines (96 loc) · 4.09 KB
/
Copy pathMakefile
File metadata and controls
126 lines (96 loc) · 4.09 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
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
#
# Copyright 2019 The Feast Authors
#
# 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
#
# https://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.
#
ROOT_DIR := $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
PROTO_TYPE_SUBDIRS = core serving types storage
PROTO_SERVICE_SUBDIRS = core serving
# General
format: format-python lint-go lint-java
lint: lint-python lint-go lint-java
test: test-python test-java
protos: compile-protos-go compile-protos-python compile-protos-docs
build: protos build-java build-docker build-html
# Java
format-java:
mvn spotless:apply
lint-java:
mvn spotless:check
test-java:
mvn test
build-java:
mvn clean verify
# Python SDK
install-python-ci-dependencies:
pip install -r sdk/python/requirements-ci.txt
compile-protos-python: install-python-ci-dependencies
@$(foreach dir,$(PROTO_TYPE_SUBDIRS),cd ${ROOT_DIR}/protos; python -m grpc_tools.protoc -I. --python_out=../sdk/python/ --mypy_out=../sdk/python/ feast/$(dir)/*.proto;)
@$(foreach dir,$(PROTO_SERVICE_SUBDIRS),cd ${ROOT_DIR}/protos; python -m grpc_tools.protoc -I. --grpc_python_out=../sdk/python/ feast/$(dir)/*.proto;)
cd ${ROOT_DIR}/protos; python -m grpc_tools.protoc -I. --python_out=../sdk/python/ --mypy_out=../sdk/python/ tensorflow_metadata/proto/v0/*.proto
test-python:
pytest --verbose --color=yes sdk/python/tests
format-python:
cd ${ROOT_DIR}/sdk/python; isort -rc feast tests
cd ${ROOT_DIR}/sdk/python; black --target-version py37 feast tests
lint-python:
# TODO: This mypy test needs to be re-enabled and all failures fixed
#cd ${ROOT_DIR}/sdk/python; mypy feast/ tests/
cd ${ROOT_DIR}/sdk/python; flake8 feast/ tests/
cd ${ROOT_DIR}/sdk/python; black --check feast tests
cd ${ROOT_DIR}/sdk/python; isort -rc feast tests --check-only
# Go SDK
compile-protos-go:
@$(foreach dir,$(PROTO_TYPE_SUBDIRS), cd ${ROOT_DIR}/protos; protoc -I/usr/local/include -I. --go_out=plugins=grpc,paths=source_relative:../sdk/go/protos/ feast/$(dir)/*.proto;)
format-go:
cd ${ROOT_DIR}/sdk/go; gofmt -s -w *.go
lint-go:
cd ${ROOT_DIR}/sdk/go; go vet; golint *.go
# Docker
build-docker:
docker build -t $(REGISTRY)/feast-core:$(VERSION) -f infra/docker/core/Dockerfile .
docker build -t $(REGISTRY)/feast-serving:$(VERSION) -f infra/docker/serving/Dockerfile .
build-push-docker:
@$(MAKE) build-docker registry=$(REGISTRY) version=$(VERSION)
docker push $(REGISTRY)/feast-core:$(VERSION)
docker push $(REGISTRY)/feast-serving:$(VERSION)
# Documentation
install-dependencies-proto-docs:
# Use the following command to compile dependencies if installing using the below method.
# cd ${ROOT_DIR}/protos; PATH=$$HOME/bin:$$PATH protoc -I $$HOME/include/ \
# -I . --docs_out=../dist/grpc feast/*/*.proto
cd ${ROOT_DIR}/protos;
mkdir -p $$HOME/bin
mkdir -p $$HOME/include
go get github.com/golang/protobuf/proto && \
go get github.com/russross/blackfriday/v2 && \
cd $$(mktemp -d) && \
git clone https://github.com/istio/tools/ && \
cd tools/cmd/protoc-gen-docs && \
go build && \
cp protoc-gen-docs $$HOME/bin && \
cd $$HOME && curl -OL https://github.com/protocolbuffers/protobuf/releases/download/v3.11.2/protoc-3.11.2-linux-x86_64.zip && \
unzip protoc-3.11.2-linux-x86_64.zip -d protoc3 && \
mv protoc3/bin/* $$HOME/bin/ && \
chmod +x $$HOME/bin/protoc && \
mv protoc3/include/* $$HOME/include
compile-protos-docs:
cd ${ROOT_DIR}/protos; protoc --docs_out=../dist/grpc feast/*/*.proto
clean-html:
rm -rf $(ROOT_DIR)/dist
build-html: clean-html
mkdir -p $(ROOT_DIR)/dist/python
mkdir -p $(ROOT_DIR)/dist/grpc
cd $(ROOT_DIR)/protos && $(MAKE) gen-docs
cd $(ROOT_DIR)/sdk/python/docs && $(MAKE) html
cp -r $(ROOT_DIR)/sdk/python/docs/html/* $(ROOT_DIR)/dist/python