generated from layer5io/layer5-repo-template
-
Notifications
You must be signed in to change notification settings - Fork 46
/
Makefile
85 lines (73 loc) · 2.48 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
# Copyright Meshery 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
#
# 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.
# Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set)
include install/Makefile.core.mk
include install/Makefile.show-help.mk
ifeq (,$(shell go env GOBIN))
GOBIN=$(shell go env GOPATH)/bin
else
GOBIN=$(shell go env GOBIN)
endif
#-----------------------------------------------------------------------------
# Docker-based Builds
#-----------------------------------------------------------------------------
.PHONY: docker-check
## Build Meshsync's docker image
docker: check
docker build -t layer5/meshery-meshsync .
.PHONY: docker-run
## Runs Meshsync in docker
docker-run:
(docker rm -f meshery-meshsync) || true
docker run --name meshery-meshsync -d \
-p 10007:10007 \
-e DEBUG=true \
layer5/meshery-meshsync
PHONY: nats
## Runs a local instance of NATS server in detached mode
nats:
(docker rm -f nats) || true
docker run --name nats --rm -p 4222:4222 -p 8222:8222 -d nats --http_port 8222
#-----------------------------------------------------------------------------
# Local Builds
#-----------------------------------------------------------------------------
.PHONY: build
## Build Meshsync binary to ./bin folder
build:
go build -o bin/meshsync main.go
.PHONY: run-check
## Runs local instance of Meshsync: can be used during local development
run: nats
go$(v) mod tidy; \
DEBUG=true GOPROXY=direct GOSUMDB=off go run main.go
.PHONY: check
## Lint check Meshsync.
check:
$(GOBIN)/golangci-lint run ./...
.PHONY: go-mod-tidy
## Run go mod tidy for dependency management
go-mod-tidy:
go mod tidy
#-----------------------------------------------------------------------------
# Tests
#-----------------------------------------------------------------------------
# Test covergae
.PHONY: coverage
## Runs coverage tests for Meshsync
coverage:
go test -v ./... -coverprofile cover.out
go tool cover -html=cover.out -o cover.html
## Runs unit tests
test: check
go test -failfast --short ./... -race