-
Notifications
You must be signed in to change notification settings - Fork 4
/
Makefile
86 lines (63 loc) · 2.07 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
# Image URL to use all building/pushing image targets
IMG ?= fuseml-core:latest
# Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set)
ifeq (,$(shell go env GOBIN))
GOBIN=$(shell go env GOPATH)/bin
else
GOBIN=$(shell go env GOBIN)
endif
GO_LDFLAGS:=-ldflags '-s -w'
all: fuseml_all
# Run tests
test: generate lint
go test ./... -coverprofile cover.out
# Generate code, run linter and build FuseML binaries
fuseml: generate lint build
fuseml_all: generate lint build_all
build: build_server build_client_local
build_all: build_server build_client-amd64 build_client-windows build_client-darwin-amd64
build_server:
go build ${GO_LDFLAGS} -o bin/fuseml_core ./cmd/fuseml_core
build_client_local:
go build ${GO_LDFLAGS} -o bin/fuseml_core-cli ./cmd/fuseml_core-cli
build_client-amd64:
GOARCH="amd64" GOOS="linux" go build ${GO_LDFLAGS} -o bin/fuseml_core-cli-linux-amd64 ./cmd/fuseml_core-cli
build_client-windows:
GOARCH="amd64" GOOS="windows" go build ${GO_LDFLAGS} -o bin/fuseml_core-cli-windows-amd64 ./cmd/fuseml_core-cli
build_client-darwin-amd64:
GOARCH="amd64" GOOS="darwin" go build ${GO_LDFLAGS} -o bin/fuseml_core-cli-darwin-amd64 ./cmd/fuseml_core-cli
# Run fuseml_core
runcore: generate lint
go run ./cmd/fuseml_core
# Run fuseml_core-cli
runcli: generate lint
go run ./cmd/fuseml_core-cli
# Generate code
generate:
go mod download
go run goa.design/goa/v3/cmd/goa gen github.com/fuseml/fuseml-core/design
# Lint code
lint: fmt vet tidy
golint `go list ./... | grep -v "/design"`
# Run go fmt against code
fmt:
go fmt ./...
# Run go vet against code
vet:
go vet ./...
# Run go mod tidy against code
tidy:
go mod tidy
# Download dependecies needed to generate code by goa
deps:
go get goa.design/goa/v3/cmd/goa@v3.3.1
go get goa.design/goa/v3/http/codegen/openapi/v2@v3.3.1
go get -u google.golang.org/grpc/cmd/protoc-gen-go-grpc
go get -u google.golang.org/protobuf/cmd/protoc-gen-go
go get golang.org/x/lint/golint
# Build the docker image
docker-build: test
docker build . -t ${IMG}
# Push the docker image
docker-push:
docker push ${IMG}