-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
72 lines (53 loc) · 2.3 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
PROJECT_NAME := "etl-bitcoin"
PKG := "github.com/IlliniBlockchain/$(PROJECT_NAME)"
PKG_LIST := $(shell go list ${PKG}/... | grep -v /vendor/ | grep -v mocks)
GO_FILES := $(shell find . -name '*.go' | grep -v /vendor/ | grep -v _test.go)
.PHONY: all dep build clean test coverage coverhtml lint docker.start docker.stop test.unit test.integration test.integration.rpcclient
all: build
docker.start: docker.start.bitcoin-core ## Start docker containers
docker.start.bitcoin-core: ## Start bitcoin-core docker container
@docker run --rm -d \
-p 18443:18443 \
-p 18444:18444 \
ruimarinho/bitcoin-core \
-printtoconsole \
-regtest=1 \
-rpcallowip=172.17.0.0/16 \
-rpcbind=0.0.0.0 \
-rpcuser=test \
-rpcpassword=test > /dev/null
docker.stop: ## Stop docker containers
@docker stop $$(docker ps -q) > /dev/null
lint: ## Lint the files
@golangci-lint run
report: ## Run goreportcard
@goreportcard-cli -v
test: test.unit test.integration ## Run all tests
test.unit: ## Run unit tests
@go test -timeout 120s -short ${PKG_LIST}
test.integration: test.integration.rpcclient ## Run integration tests
test.integration.rpcclient: docker.start.bitcoin-core ## Run rpcclient integration tests
@go test -run RPCClient ${PKG_LIST}; make docker.stop > /dev/null
race: dep ## Run data race detector
@go test -race -short ${PKG_LIST}
msan: dep ## Run memory sanitizer
CC=clang CXX=clang++ CGO_ENABLED=1 go test -msan -short ${PKG_LIST}
coverage: docker.start.bitcoin-core ## Generate global code coverage report
@go test -coverprofile=coverage.cov ${PKG_LIST}; make docker.stop > /dev/null
@go tool cover -func coverage.cov
@rm "coverage.cov"
coverhtml: docker.start.bitcoin-core ## Generate global code coverage report in HTML
@go test -coverprofile=coverage.cov ${PKG_LIST}; make docker.stop > /dev/null
@go tool cover -func coverage.cov
@go tool cover -html=coverage.cov -o coverage.html
@rm "coverage.cov"
dep: ## Get the dependencies
@go get -v -d ./...
@go get -u golang.org/x/tools/cmd/cover
build: dep ## Build the binary file
@go build -o etl_bitcoin.exe -v $(PKG)/cmd
clean: ## Remove previous build
@go clean -cache
@rm -f $(PROJECT_NAME)
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}'