-
Notifications
You must be signed in to change notification settings - Fork 136
/
Makefile
72 lines (55 loc) · 1.86 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
70
71
72
SHELL = /bin/bash -o pipefail
ENV_TYPE ?= desktop
# Code style formatting
fmt:
go fmt ./...
# Quality assurance
qa: lint test-cover
# Getting deps with required to build the tests for the specified packages
test-deps:
@echo "Getting deps with required to build the tests for the specified packages"
go get -t -d ./...
# Testing with check cover
test-cover: test-deps
@echo "Testing with check cover"
bash script/go-test.sh -v -covermode count -coverprofile=profile-$(ENV_TYPE).cov ./...
# Testing with check race
test-race: test-deps
go test -v -race ./...
# Store current bechmarck
bench-store:
bash script/go-test.sh -benchmem -benchtime=2s -bench=. -run='^$$' ./... | tee testdata/current.bench.txt
# Take current bechmarck
bench-now:
bash script/go-test.sh -benchmem -benchtime=2s -bench=. -run='^$$' ./... | tee testdata/new.bench.txt
# Make compares benchmarks
bench: bench-now
@echo "Make compares benchmarks"
$(shell go env GOPATH)/bin/benchstat testdata/current.bench.txt testdata/new.bench.txt
# Linting and code analyzes
lint: lint-go
say:
@echo "$(ENV_TYPE)-$(shell go env GOOS)"
# Linting only go files
lint-go:
ifeq ("$(ENV_TYPE)", "destop")
@echo "Checking for analyzes to identify unnecessary type conversions"
$(shell go env GOPATH)/bin/unconvert -v ./...
endif
# Linting only shell scripts
lint-shell:
@echo "Checking shell scripts for analyzes to identify unnecessary type conversions"
shellcheck script/*
# Send cover report to coveralls.io
coveralls: profile-$(ENV_TYPE).cov
GO111MODULE=off go get -v github.com/mattn/goveralls
@echo "Sending cover report to coveralls.io"
$(shell go env GOPATH)/bin/goveralls -coverprofile=profile-$(ENV_TYPE).cov -service=github
# Verify demo, tutorial, etc
verify: verify-demo verify-tutorial
# Verify demos
verify-demo:
bash script/verify-demo.sh
# Verify tutorials
verify-tutorial:
bash script/verify-tutorial.sh