-
Notifications
You must be signed in to change notification settings - Fork 15
/
Makefile
69 lines (52 loc) · 1.42 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
67
68
69
GO_LDFLAGS := -ldflags="-s -w"
BINARY := kubedog
COVER_FILE := coverage.txt
all: check-syntax build
check-syntax: generate check-dirty-repo
generate: download
go generate kubedog.go
build: test
GOOS=linux GOARCH=amd64 go build $(GO_LDFLAGS) -o ${BINARY} ./
test: fmt vet
go test -race -timeout=300s -tags test -coverprofile=${COVER_FILE} ./...
.PHONY: fmt
fmt:
go fmt ./...
.PHONY: vet
vet:
go vet ./...
.PHONY: download
download:
go mod download
.PHONY: lint
lint:
@echo "golangci-lint"
golangci-lint run ./...
.PHONY: cover
cover:
@$(MAKE) test
@go tool cover -html=${COVER_FILE}
.PHONY: check-dirty-repo
check-dirty-repo:
@git diff --quiet HEAD || (\
echo "Untracked files in git repo: " && \
git status --short && \
echo "- If 'docs/syntax.md' is up there, try running 'make generate' and commit the generated documentation" && \
echo "- If 'go.mod' is up there, try running 'go mod tidy' and commit the changes" && \false)
.PHONY: clean
clean:
@rm -f ${BINARY}
@rm -f ${COVER_FILE}
build-examples: build-example-templating-generic build-example-templating-kube build-example-usage check-dirty-repo
.PHONY: build-example-templating-generic
build-example-templating-generic:
cd examples/templating/generic && \
go build
.PHONY: build-example-templating-kube
build-example-templating-kube:
cd examples/templating/kube && \
go test -c
.PHONY: build-example-usage
build-example-usage:
cd examples/usage && \
go test -c