-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
58 lines (43 loc) · 1.53 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
OWNER := dnitsch
NAME := configmanager
GIT_TAG := "1.18.0"
VERSION := "v$(GIT_TAG)"
REVISION := "aaaabbbbb1234"
LDFLAGS := -ldflags="-s -w -X \"github.com/$(OWNER)/$(NAME)/cmd/configmanager.Version=$(VERSION)\" -X \"github.com/$(OWNER)/$(NAME)/cmd/configmanager.Revision=$(REVISION)\" -extldflags -static"
.PHONY: test test_ci tidy install cross-build
test: test_prereq
go test ./... -v -buildvcs=false -mod=readonly -coverprofile=.coverage/out > .coverage/unit ; \
cat .coverage/unit | go-junit-report > .coverage/report-junit.xml && \
gocov convert .coverage/out | gocov-xml > .coverage/report-cobertura.xml
test_ci:
go test ./... -mod=readonly
test_prereq:
mkdir -p .coverage
go install github.com/jstemmer/go-junit-report/v2@latest && \
go install github.com/axw/gocov/gocov@latest && \
go install github.com/AlekSi/gocov-xml@latest
tidy:
go mod tidy
install: tidy
go mod vendor
.PHONY: clean
clean:
rm -rf bin/*
rm -rf dist/*
rm -rf vendor/*
cross-build:
for os in darwin linux windows; do \
GOOS=$$os CGO_ENABLED=0 go build -mod=readonly -buildvcs=false $(LDFLAGS) -o dist/$(NAME)-$$os ./cmd; \
done
build-mac:
for os in darwin; do \
GOOS=$$os CGO_ENABLED=0 go build -mod=readonly -buildvcs=false $(LDFLAGS) -o dist/$(NAME)-$$os ./cmd; \
done
release:
OWNER=$(OWNER) NAME=$(NAME) PAT=$(PAT) VERSION=$(VERSION) . hack/release.sh
tag:
git tag -a $(VERSION) -m "ci tag release uistrategy" $(REVISION)
git push origin $(VERSION)
tagbuildrelease: tag cross-build release
show_coverage: test
go tool cover -html=.coverage/out