-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
54 lines (43 loc) · 884 Bytes
/
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
TAG?=""
.DEFAULT_GOAL := test
# Run all tests
.PHONY: test
test: fmt vet test-unit tidy
# Run unit tests
.PHONY: test-unit
test-unit:
go test -count 1 -v -race ./...
# Clean go.mod
.PHONY: tidy
tidy:
go mod tidy
git diff --exit-code go.sum
# Check formatting
.PHONY: fmt
fmt:
test -z "$(shell gofmt -l .)"
# Run vet
.PHONY: vet
vet:
go vet ./...
# Run a test release with goreleaser
.PHONY: test-release
test-release:
goreleaser release --snapshot --skip=publish --clean
# Clean up any cruft left over from old builds
.PHONY: clean
clean:
rm -rf goverseer dist/
# Build the application
.PHONY: build
build: clean
CGO_ENABLED=0 go build ./cmd/goverseer
# Create a git tag
.PHONY: tag
tag:
git tag -a $(TAG) -m "Release $(TAG)"
git push origin $(TAG)
# Requires GITHUB_TOKEN environment variable to be set
.PHONY: release
release: clean
goreleaser release --clean