-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
59 lines (47 loc) · 945 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
55
56
57
58
59
TAG?=""
.DEFAULT_GOAL := test
# Run all tests
.PHONY: test
test: fmt lint vet test-unit go-mod-tidy
# Run unit tests
.PHONY: test-unit
test-unit:
go test -v -race ./...
# Clean go.mod
.PHONY: go-mod-tidy
go-mod-tidy:
go mod tidy
git diff --exit-code go.sum
# Check formatting
.PHONY: fmt
fmt:
test -z "$(shell gofmt -l .)"
# Run linter
.PHONY: lint
lint:
golint -set_exit_status ./...
# Run vet
.PHONY: vet
vet:
go vet ./...
# Run a test release with goreleaser
.PHONY: test-release
test-release:
goreleaser --snapshot --skip-publish --rm-dist
# Clean up any cruft left over from old builds
.PHONY: clean
clean:
rm -rf anemometer dist/
# Build the application
.PHONY: build
build: clean
CGO_ENABLED=0 go build ./cmd/anemometer
# 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