-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
35 lines (25 loc) · 910 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
TESTRESULTSDIR=$(CURDIR)/test-results/cors
COVERDIR=$(CURDIR)/.cover
COVERAGEFILE=$(COVERDIR)/cover.out
COVERAGEREPORT=$(COVERDIR)/report.html
vet:
@go vet ./...
fmt:
@go fmt ./...
test:
@go test ./...
bench:
@mkdir -p ./bench-results
@go test -benchmem -bench=. -cpuprofile ./bench-results/cpu.prof -memprofile ./bench-results/mem.prof
plot-cpu:
@go tool pprof -http :8080 ./bench-results/cpu.prof
plot-mem:
@go tool pprof -alloc_space -http :8080 ./bench-results/mem.prof
coverage-ci:
@mkdir -p $(COVERDIR) $(TESTRESULTSDIR)
@go test -v -covermode=count -coverprofile=$(COVERAGEFILE) 2>&1 | go run github.com/jstemmer/go-junit-report > $(TESTRESULTSDIR)/report.xml
coverage: coverage-ci
@cp "${COVERAGEFILE}" coverage.txt
coverage-html: coverage
@go tool cover -html="$(COVERAGEFILE)"
.PHONY: run build fmt vet test test-watch coverage coverage-ci coverage-html bench plot-cpu plot-mem