forked from vladopajic/go-actor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
53 lines (43 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
GO ?= go
GOBIN ?= $$($(GO) env GOPATH)/bin
GOLANGCI_LINT ?= $(GOBIN)/golangci-lint
GOLANGCI_LINT_VERSION ?= v1.64.5 # LINT_VERSION: update version in other places
TEST_COVERAGE ?= $(GOBIN)/go-test-coverage
.PHONY: install-golangcilint
install-golangcilint:
test -f $(GOLANGCI_LINT) || curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $$($(GO) env GOPATH)/bin $(GOLANGCI_LINT_VERSION)
# Runs lint on entire repo
.PHONY: lint
lint: install-golangcilint
$(GOLANGCI_LINT) run ./...
# Runs benchmark on entire repo
.PHONY: benchmark
benchmark:
go version
go test -bench=. github.com/vladopajic/go-actor/actor -run=^# -count 5 -benchmem
# Runs tests on entire repo
.PHONY: test
test:
go test -timeout=10s -race -count=10 -shuffle=on -failfast ./...
# Code tidy
.PHONY: tidy
tidy:
go mod tidy
go fmt ./...
.PHONY: install-go-test-coverage
install-go-test-coverage:
go install github.com/vladopajic/go-test-coverage/v2@latest
# Generates test coverage profile
.PHONY: generate-coverage
generate-coverage:
go test ./... -coverprofile=./cover.out -covermode=atomic -coverpkg=./...
# Runs test coverage check
.PHONY: check-coverage
check-coverage: generate-coverage
check-coverage: install-go-test-coverage
$(TEST_COVERAGE) -config=./.testcoverage.yml
# View coverage profile
.PHONY: view-coverage
view-coverage: generate-coverage
go tool cover -html=cover.out -o=cover.html
xdg-open cover.html