-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile
55 lines (41 loc) · 1.33 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
DISTDIR = dist
# Utility versions.
GORELEASER_VERSION = "v1.11.5"
GOLANGCI_LINT_VERSION = "v1.50.0"
# Build variables.
GIT_TREE_STATE=$(if $(shell git status --porcelain),dirty,clean)
.PHONY: bootstrap
# Download and install all go dependencies and tools.
bootstrap: $(RESULTSDIR) bootstrap-go install-tools
.PHONY: bootstrap-go
bootstrap-go:
go mod download
.PHONY: install-tools
install-tools: install-goreleaser install-golangci-lint
.PHONY: install-goreleaser
install-goreleaser:
go install github.com/goreleaser/goreleaser@$(GORELEASER_VERSION)
.PHONY: install-golangci-lint
install-golangci-lint:
go install github.com/golangci/golangci-lint/cmd/golangci-lint@$(GOLANGCI_LINT_VERSION)
.PHONY: test
test:
go test -v -race -coverprofile=coverage.txt -covermode=atomic ./...
.PHONY: lint
lint:
golangci-lint run --tests=false --timeout 5m --config .golangci.yaml
.PHONY: build
build: install-goreleaser
GIT_TREE_STATE=$(GIT_TREE_STATE) goreleaser build --rm-dist --single-target
.PHONY: release
release: install-goreleaser
GIT_TREE_STATE=$(GIT_TREE_STATE) goreleaser release --rm-dist
.PHONY: release-snapshot
release-snapshot: install-goreleaser
GIT_TREE_STATE=$(GIT_TREE_STATE) goreleaser release --rm-dist --skip-publish --snapshot
.PHONY: clean-dist
clean-dist:
rm -rf $(DISTDIR)
.PHONY: clean
clean: clean-dist
rm -f coverage.txt