forked from iost-official/go-iost
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
105 lines (80 loc) · 2.99 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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
GO = go
VERSION = 2.0.0
COMMIT = $(shell git rev-parse --short HEAD)
PROJECT = github.com/iost-official/go-iost
DOCKER_IMAGE = iostio/iost-node:$(VERSION)-$(COMMIT)
DOCKER_DEVIMAGE = iostio/iost-dev:$(VERSION)
TARGET_DIR = target
CLUSTER = devnet
ifeq ($(shell uname),Darwin)
export CGO_LDFLAGS=-L$(shell pwd)/vm/v8vm/v8/libv8/_darwin_amd64
export CGO_CFLAGS=-I$(shell pwd)/vm/v8vm/v8/include/_darwin_amd64
export DYLD_LIBRARY_PATH=$(shell pwd)/vm/v8vm/v8/libv8/_darwin_amd64
endif
ifeq ($(shell uname),Linux)
export CGO_LDFLAGS=-L$(shell pwd)/vm/v8vm/v8/libv8/_linux_amd64
export CGO_CFLAGS=-I$(shell pwd)/vm/v8vm/v8/include/_linux_amd64
export LD_LIBRARY_PATH=$(shell pwd)/vm/v8vm/v8/libv8/_linux_amd64
endif
BUILD_TIME := $(shell date +%Y%m%d_%H%M%S%z)
LD_FLAGS := -X github.com/iost-official/go-iost/core/global.BuildTime=$(BUILD_TIME) -X github.com/iost-official/go-iost/core/global.GitHash=$(shell git rev-parse HEAD)
.PHONY: all build iserver iwallet itest lint test e2e_test k8s_test image push devimage swagger protobuf install clean debug clear_debug_file
all: build
build: iserver iwallet itest
iserver:
$(GO) build -ldflags "$(LD_FLAGS)" -o $(TARGET_DIR)/iserver $(PROJECT)/cmd/iserver
iwallet:
$(GO) build -o $(TARGET_DIR)/iwallet $(PROJECT)/cmd/iwallet
itest:
$(GO) build -o $(TARGET_DIR)/itest $(PROJECT)/cmd/itest
lint:
@gometalinter --config=.gometalinter.json ./...
vmlib:
(cd vm/v8vm/v8/; make clean js_bin vm install deploy; cd ../../..)
vmlib_linux:
docker run --rm -v `pwd`:/gopath/src/github.com/iost-official/go-iost $(DOCKER_DEVIMAGE) bash -c 'cd vm/v8vm/v8/ && make clean js_bin vm install'
test:
ifeq ($(origin VERBOSE),undefined)
go test -race -coverprofile=coverage.txt -covermode=atomic ./...
else
go test -v -race -coverprofile=coverage.txt -covermode=atomic ./...
endif
e2e_test: image
docker rm -f iserver || true
docker run -d --name iserver $(DOCKER_IMAGE)
sleep 20
docker exec -it iserver ./itest run a_case
docker exec -it iserver ./itest run t_case
docker exec -it iserver ./itest run c_case
k8s_test: image push
./build/delete_cluster.sh $(CLUSTER)
./build/create_cluster.sh $(CLUSTER)
sleep 90
kubectl exec -it itest -n $(CLUSTER) -- ./itest run -c /etc/itest/itest.json a_case
kubectl exec -it itest -n $(CLUSTER) -- ./itest run -c /etc/itest/itest.json t_case
kubectl exec -it itest -n $(CLUSTER) -- ./itest run -c /etc/itest/itest.json c_case
image:
docker run --rm -v `pwd`:/gopath/src/github.com/iost-official/go-iost $(DOCKER_DEVIMAGE) make BUILD_TIME=$(BUILD_TIME)
docker build -f Dockerfile.run -t $(DOCKER_IMAGE) .
push:
docker push $(DOCKER_IMAGE)
devimage:
docker build -f Dockerfile.dev -t $(DOCKER_DEVIMAGE) .
devpush:
docker push $(DOCKER_DEVIMAGE)
swagger:
./script/gen_swagger.sh
protobuf:
./script/gen_protobuf.sh
install:
go install ./cmd/iwallet/
go install ./cmd/iserver/
clean:
rm -f ${TARGET_DIR}
debug: build
target/iserver -f config/iserver.yml
clear_debug_file:
rm -rf StatePoolDB/
rm -rf leveldb/
rm priv.key
rm routing.table