forked from 0chain/0chain
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
79 lines (62 loc) · 2.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# Makefile
# Specific features to manage automations in development & build processes.
#
# For usage on Windows see [Chocolatey CLI Documentation](https://docs.chocolatey.org/en-us/choco/setup)
# Then execute `choco install make` command in shell, now you will be able to use `make` on Windows.
ifeq ($(OS),Windows_NT)
detected_OS := Windows
detected_ARCH := x86_64
else
detected_OS := $(shell sh -c 'uname 2>/dev/null || echo Unknown')
detected_ARCH := $(shell sh -c 'uname -m 2>/dev/null || echo Unknown')
endif
make_path := $(abspath $(lastword $(MAKEFILE_LIST)))
root_path := $(patsubst %/, %, $(dir $(make_path)))
GOPATH := $(shell go env GOPATH)
.PHONY: pre-push go-mod check-commit
pre-push: go-mod check-commit
.PHONY: check-commit go-get run-test
check-commit: go-get run-test
.PHONY: install-mockery mockery install-msgp msgp build-mocks swagger
.PHONY: build-benchmark benchmark
go-mod:
@echo "Prepare Go mod files..."
@cd $(root_path)/code/go/0chain.net && go mod tidy -v
@cd $(root_path)/code/go/0chain.net && go mod download -x
@echo "Go mod files completed."
go-get:
@echo "Load dependencies..."
@cd $(root_path)/code/go/0chain.net && go get -d ./...
@echo "Dependencies loaded."
run-test:
@echo "Start testing..."
@cd $(root_path)/code/go/0chain.net && go test -tags bn256 -cover ./...
@echo "Tests completed."
install-mockery:
@([ -d ./tmp/mockery ] || mkdir -p ./tmp/mockery) \
&& echo "[+]download mockery" \
&& ([ -f ./tmp/mockery/mockery.tar.gz ] || curl -L -o ./tmp/mockery/mockery.tar.gz https://github.com/vektra/mockery/releases/download/v2.28.1/mockery_2.28.1_$(detected_OS)_$(detected_ARCH).tar.gz) \
&& echo "[+]install mockery" \
&& tar zxvfC ./tmp/mockery/mockery.tar.gz ./tmp/mockery \
&& cp ./tmp/mockery/mockery $(GOPATH)/bin/ \
&& rm -rf ./tmp
build-mocks:
GOPATH=$(GOPATH) ./generate_mocks.sh
install-msgp:
@echo "Install msgp..."
./docker.local/bin/install.msgp.sh
@echo "Msgp installed."
msgp:
@echo "Run msgp..."
@cd $(root_path)/code/go/0chain.net && go generate -run=msgp ./...
@echo "Run msgp completed."
swagger:
@echo "Run swagger..."
swagger generate spec -w code/go/0chain.net/sharder/sharder -m -o docs/swagger.yaml
swagger generate markdown -f docs/swagger.yaml --output=docs/swagger.md
@echo "swagger documentation generated"
build-benchmark:
./docker.local/bin/build.benchmark.sh
benchmark:
@cd $(root_path)/docker.local/benchmarks \
&& ../bin/start.benchmarks.sh