forked from Sifchain/sifnode
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
124 lines (91 loc) · 3.34 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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
CHAINNET?=betanet
BINARY?=sifnoded
GOPATH?=$(shell go env GOPATH)
GOBIN?=$(GOPATH)/bin
NOW=$(shell date +'%Y-%m-%d_%T')
COMMIT:=$(shell git log -1 --format='%H')
VERSION:=$(shell cat version)
IMAGE_TAG?=latest
HTTPS_GIT := https://github.com/sifchain/sifnode.git
DOCKER ?= docker
DOCKER_BUF := $(DOCKER) run --rm -v $(CURDIR):/workspace --workdir /workspace bufbuild/buf
GOFLAGS:=""
GOTAGS:=ledger
ldflags = -X github.com/cosmos/cosmos-sdk/version.Name=sifchain \
-X github.com/cosmos/cosmos-sdk/version.ServerName=sifnoded \
-X github.com/cosmos/cosmos-sdk/version.ClientName=sifnoded \
-X github.com/cosmos/cosmos-sdk/version.Version=$(VERSION) \
-X github.com/cosmos/cosmos-sdk/version.Commit=$(COMMIT)
BUILD_FLAGS := -ldflags '$(ldflags)' -tags '$(GOTAGS)'
BINARIES=./cmd/sifnoded ./cmd/sifgen ./cmd/ebrelayer ./cmd/siftest
all: lint install
build-config:
echo $(CHAINNET)
echo $(BUILD_FLAGS)
init:
./scripts/init.sh
start:
sifnoded start
lint-pre:
@test -z $(gofmt -l .)
@GOFLAGS=$(GOFLAGS) go mod verify
lint: lint-pre
@golangci-lint run
lint-verbose: lint-pre
@golangci-lint run -v --timeout=5m
install: go.sum
GOFLAGS=$(GOFLAGS) go install $(BUILD_FLAGS) $(BINARIES)
build-sifd: go.sum
GOFLAGS=$(GOFLAGS) go build $(BUILD_FLAGS) ./cmd/sifnoded
clean:
@rm -rf $(GOBIN)/sif*
coverage:
@GOFLAGS=$(GOFLAGS) go test -v ./... -coverprofile=coverage.txt -covermode=atomic
tests:
@GOFLAGS=$(GOFLAGS) go test -v -coverprofile .testCoverage.txt ./...
feature-tests:
@GOFLAGS=$(GOFLAGS) go test -v ./test/bdd --godog.format=pretty --godog.random -race -coverprofile=.coverage.txt
run:
GOFLAGS=$(GOFLAGS) go run ./cmd/sifnoded start
build-image:
docker build -t sifchain/$(BINARY):$(IMAGE_TAG) -f ./cmd/$(BINARY)/Dockerfile .
run-image: build-image
docker run sifchain/$(BINARY):$(IMAGE_TAG)
sh-image: build-image
docker run -it sifchain/$(BINARY):$(IMAGE_TAG) sh
init-run:
./scripts/init.sh && ./scripts/run.sh
init-run-noInstall:
./scripts/init-noInstall.sh && ./scripts/run.sh
rollback:
./scripts/rollback.sh
###############################################################################
### Protobuf ###
###############################################################################
protoVer=v0.3
protoImageName=tendermintdev/sdk-proto-gen:$(protoVer)
proto-all: proto-format proto-lint proto-gen
proto-gen:
@echo "Generating Protobuf files"
$(DOCKER) run --rm -v $(CURDIR):/workspace --workdir /workspace $(protoImageName) sh ./scripts/protocgen.sh
.PHONY: proto-gen
proto-format:
@echo "Formatting Protobuf files"
$(DOCKER) run --rm -v $(CURDIR):/workspace \
--workdir /workspace $(protoImageName) \
find ./ -not -path "./third_party/*" -name *.proto -exec clang-format -i {} \;
.PHONY: proto-format
# This generates the SDK's custom wrapper for google.protobuf.Any. It should only be run manually when needed
proto-gen-any:
$(DOCKER) run --rm -v $(CURDIR):/workspace --workdir /workspace $(protoImageName) sh ./scripts/protocgen-any.sh
.PHONY: proto-gen-any
proto-swagger-gen:
@./scripts/protoc-swagger-gen.sh
.PHONY: proto-swagger-gen
proto-lint:
$(DOCKER_BUF) lint --error-format=json
.PHONY: proto-lint
proto-check-breaking:
# we should turn this back on after our first release
# $(DOCKER_BUF) breaking --against $(HTTPS_GIT)#branch=master
.PHONY: proto-check-breaking