Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
94 lines (74 loc) · 2.12 KB
/
Copy pathMakefile
File metadata and controls
94 lines (74 loc) · 2.12 KB
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
SHELL := /bin/bash
.PHONY:all
all: test
.PHONY:generate
generate:
go generate
.PHONY:clean
clean:
rm memprofile.out cpuprofile.out localtimezone.test c.out || true
.PHONY:install-test-deps
install-test-deps:
curl -sSfL https://golangci-lint.run/install.sh | sh -s -- -b $(shell go env GOPATH)/bin v2.15.0
go install golang.org/x/vuln/cmd/govulncheck@latest
.PHONY:test
test: install-test-deps lint unit gomodtidy govulncheck
.PHONY:gomodtidy
gomodtidy:
go mod tidy
cd tzshapefilegen && go mod tidy
cd tzmap && go mod tidy
.PHONY:govulncheck
govulncheck:
govulncheck ./...
cd tzshapefilegen && govulncheck ./...
cd tzmap && govulncheck ./...
.PHONY:lint
lint: govet golangci-lint
gofmt -e -l -d -s .
.PHONY:govet
govet:
go vet ./...
cd tzshapefilegen && go vet ./...
cd tzmap && go vet ./...
.PHONY:golangci-lint
golangci-lint run ./...
cd tzshapefilegen && golangci-lint run ./...
cd tzmap && golangci-lint run ./...
.PHONY:unit
unit:
go test -coverprofile=c.out -covermode=atomic ./...
cd tzshapefilegen && go test -coverprofile=c.out -covermode=atomic ./...
cd tzmap && go test -coverprofile=c.out -covermode=atomic ./...
.PHONY:cover
cover: test
go tool cover -func=c.out
sed -i 's/github.com\/albertyw\/localtimezone\/v4\///g' c.out
cd tzshapefilegen && go tool cover -func=c.out
cd tzmap && go tool cover -func=c.out
.PHONY:race
race:
go test -race ./...
cd tzshapefilegen && go test -race ./...
cd tzmap && go test -race ./...
.PHONY:benchmark
benchmark:
go test -bench=. -benchmem
.PHONY:benchmark-getzone
benchmark-getzone:
go test -bench=BenchmarkGetZone -benchtime 30s -benchmem -cpuprofile cpuprofile.out -memprofile memprofile.out
.PHONY:benchmark-clientinit
benchmark-clientinit:
go test -bench=BenchmarkClientInit -benchmem -cpuprofile cpuprofile.out -memprofile memprofile.out
.PHONY:map
map:
cd tzmap && go run . -out map.html -image map.png
.PHONY:benchmark-memory
benchmark-memory:
go test -bench=BenchmarkClientMemory -benchmem -memprofile memprofile.out
.PHONY:cpuprof
cpuprof:
go tool pprof -top cpuprofile.out | head -n 20
.PHONY:memprof
memprof:
go tool pprof -top memprofile.out | head -n 20