forked from skycoin/skycoin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
65 lines (51 loc) · 2.35 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
.DEFAULT_GOAL := help
.PHONY: run run-help test lint check cover install-linters format release clean help
# Static files directory
STATIC_DIR = src/gui/static
# Electron files directory
ELECTRON_DIR = electron
# ./src folder does not have code
# ./src/api folder does not have code
# ./src/util folder does not have code
# ./src/ciper/* are libraries manually vendored by cipher that do not need coverage
# ./src/gui/static* are static assets
# */testdata* folders do not have code
# ./src/consensus/example has no buildable code
PACKAGES = $(shell find ./src -type d -not -path '\./src' \
-not -path '\./src/api' \
-not -path '\./src/util' \
-not -path '\./src/consensus/example' \
-not -path '\./src/gui/static*' \
-not -path '\./src/cipher/*' \
-not -path '*/testdata*')
run: ## Run the skycoin node. To add arguments, do 'make ARGS="--foo" run'.
go run cmd/skycoin/skycoin.go --gui-dir="./${STATIC_DIR}" ${ARGS}
run-help: ## Show skycoin node help
@go run cmd/skycoin/skycoin.go --help
test: ## Run tests
go test ./cmd/... -timeout=1m
go test ./src/... -timeout=1m
lint: ## Run linters. Use make install-linters first.
vendorcheck ./...
gometalinter --disable-all -E goimports --tests --vendor ./...
check: lint test ## Run tests and linters
cover: ## Runs tests on ./src/ with HTML code coverage
@echo "mode: count" > coverage-all.out
$(foreach pkg,$(PACKAGES),\
go test -coverprofile=coverage.out $(pkg);\
tail -n +2 coverage.out >> coverage-all.out;)
go tool cover -html=coverage-all.out
install-linters: ## Install linters
go get -u github.com/FiloSottile/vendorcheck
go get -u github.com/alecthomas/gometalinter
gometalinter --vendored-linters --install
format: # Formats the code. Must have goimports installed (use make install-linters).
goimports -w -local github.com/skycoin/skycoin ./cmd
goimports -w -local github.com/skycoin/skycoin ./src
release: ## Build electron apps, the builds are located in electron/release folder.
cd $(ELECTRON_DIR) && ./build.sh
@echo release files are in the folder of electron/release
clean: ## Clean dist files and delete all builds in electron/release
rm $(ELECTRON_DIR)/release/*
help:
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'