-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
66 lines (53 loc) · 1.06 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
SOURCE=./...
VERSION="0.0.2"
.DEFAULT_GOAL := build
vet:
go vet $(SOURCE)
.PHONY: vet
fmt:
go fmt $(SOURCE)
.PHONY: fmt
test-fmt:
test -z $(shell go fmt $(SOURCE))
.PHONY: test-fmt
test: vet test-fmt
go test -race -cover $(SOURCE) -count=1
.PHONY: test
benchmark:
go test -bench=.
.PHONY: benchmark
tools:
echo "Installing tools from tools.go"
cat tools.go | grep _ | awk -F'"' '{print $$2}' | xargs -tI % go install %
.PHONY: tools
build: tools
goreleaser release \
--snapshot \
--skip-publish \
--rm-dist
.PHONY: build
release: tools
goreleaser release \
--rm-dist
.PHONY: release
check-tag:
./scripts/ensure-unique-version.sh "$(VERSION)"
.PHONY: check-tag
tag:
if git rev-parse $(VERSION) >/dev/null 2>&1; then \
echo "found existing $(VERSION) git tag"; \
exit 1; \
else \
echo "creating git tag $(VERSION)"; \
git tag $(VERSION); \
git push origin $(VERSION); \
fi
.PHONY: tag
delete-tag:
git tag -d $(VERSION)
git push --delete origin $(VERSION)
.PHONY: delete-tag
clean:
rm -rf dist || exit 0
rm -rf data || exit 0
.PHONY: clean