-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
64 lines (49 loc) · 2.18 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
PROJECT_NAME := randomtrader
PKG := "github.com/mshogin/$(PROJECT_NAME)"
PKG_LIST := $(go list ${PKG}/... | grep -v /vendor/)
GO_FILES := $(find . -name '*.go' | grep -v /vendor/ | grep -v _test.go)
LINTPKG = github.com/golangci/golangci-lint/cmd/golangci-lint@v1.24.0
ifndef $(GOPATH)
GOPATH=$(shell go env GOPATH)
export GOPATH
endif
LINTBIN = $(GOPATH)/bin/golangci-lint
.PHONY: all dep build clean test coverage coverhtml lint run
all: build
linter:
go get golang.org/x/lint/golint
golint ./...
GO111MODULE=on go get $(LINTPKG)
test -z "$$($(LINTBIN) run --verbose | tee /dev/stderr)"
check: linter test
test: ## Run unittests
go test -coverprofile=coverage.txt -covermode=atomic ./...
testrace: dep ## Run data race detector
go test -race -coverprofile=coverage.txt -covermode=atomic ./...
msan: dep ## Run memory sanitize
go test -msan -short ${PKG_LIST}
coverage: ## Generate global code coverage report
./tools/coverage.sh;
coverhtml: ## Generate global code coverage report in HTML
./tools/coverage.sh html;
dep: ## Get the dependencies
GO111MODULE=on go mod verify
GO111MODULE=on go mod tidy
go get -v -d ./...
go get -u golang.org/x/lint/golint
go get -u golang.org/x/lint/golint
build: ## Build the binary file
go build -tags=prod -o cmd/randomtrader/randomtrader cmd/randomtrader/main.go
go build -tags=prod -buildmode=plugin -o pkg/strategy/randomtrader-archimedes/randomtrader-archimedes.so pkg/strategy/randomtrader-archimedes/archimedes.go
localrun:
go build -tags=prod -o cmd/randomtrader/randomtrader cmd/randomtrader/main.go
go build -tags=prod -buildmode=plugin -o /tmp/randomtrader-archimedes.so pkg/strategy/randomtrader-archimedes/archimedes.go
sudo cp cmd/randomtrader/randomtrader /usr/bin/
sudo cp /tmp/randomtrader-archimedes.so /var/lib/randomtrader/plugins
sudo cp configs/config_example.json /etc/randomtrader/config.json
sudo cp -rf pkg/strategy/randomtrader-archimedes /var/lib/randomtrader/
/usr/bin/randomtrader
clean: ## Remove previous build
rm -f cmd/randomtrader/randomtrader
help: ## Display this help screen
grep -h -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'