This repository has been archived by the owner on Mar 27, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 34
/
Copy pathMakefile
89 lines (66 loc) · 1.9 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
PACKAGE := github.com/aspenmesh/istio-vet
GOOS = $(shell go env GOOS)
GOARCH = $(shell go env GOARCH)
GOBIN = $(GOPATH)/bin/$(GOOS)-$(GOARCH)
GO_BUILD_FLAGS=-v
ALL_PKGS := ./cmd/... ./pkg/...
GENERATED_GO = pkg/generated/api/v1/note.pb.go
#
# Normal build for developers. Just builds source.
#
all: go-build test
image:
docker build -t istio-vet .
precommit: go-build image fmt
#
# Debug build, with all verification
#
debug: GO_BUILD_FLAGS=-v -race -gcflags '-N -l'
debug: go-build
#
# Remove all build artifacts
#
clean:
rm -rf _build
rm -rf pkg/generated
info:
@echo "ALL_PKGS: $(ALL_PKGS)"
############################################################################
# NOTE:
# The following targets are supporting targets for the publicly maintained
# targets above. Publicly maintained targets above are always provided.
############################################################################
go-build: $(GENERATED_GO)
go mod download
GO111MODULE=on go install $(GO_BUILD_FLAGS) $(ALL_PKGS)
fmt:
@if git diff --exit-code; then true; \
else echo "Can't format code with local changes";false; fi
@echo "Files that need formating:"
@go fmt $(ALL_PKGS)
@git diff --exit-code
test: go-test
go-test: _build/coverage.out
_build/coverage.out:
GO111MODULE=on go install github.com/wadey/gocovmerge
GO111MODULE=on go install github.com/onsi/ginkgo/ginkgo
@mkdir -p $(@D)
GO111MODULE=on ginkgo -r \
--randomizeAllSpecs \
--randomizeSuites \
--failOnPending \
--cover \
--trace \
--race \
--progress \
--outputdir $(CURDIR)/_build/
gocovmerge $(@D)/*.coverprofile > $@
# Generated go
pkg/generated/api/v1/note.pb.go: api/v1/note.proto
@mkdir -p $(@D)
protoc -I/usr/local/include -I. \
--go_out=module=github.com/aspenmesh/istio-vet:. \
$<
.PHONY: all test image precommit debug clean info fmt go-build go-test
# Disable builtin implicit rules
.SUFFIXES: