-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
101 lines (75 loc) · 2.45 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
PROJECT = obada/fullcore
BRANCH := $(shell git rev-parse --abbrev-ref HEAD)
COMMIT := $(shell git log -1 --format='%H')
ifeq (,$(VERSION))
VERSION := $(shell git describe --exact-match 2>/dev/null)
ifeq (,$(VERSION))
VERSION := $(BRANCH)-$(COMMIT)
endif
endif
BUILD_DIR ?= $(CURDIR)/build
CI_COMMIT_REF_SLUG ?= develop
CONTAINER_IMAGE = $(PROJECT):$(CI_COMMIT_REF_SLUG)
CONTAINER_TESTNET_IMAGE = $(CONTAINER_IMAGE)-testnet
CONTAINER_TAG_IMAGE = $(PROJECT):$(CI_COMMIT_TAG)
COMMIT_HASH = $(CI_COMMIT_SHA)
SHELL := /bin/sh
protoVer = 0.14.0
protoImageName = ghcr.io/cosmos/proto-builder:$(protoVer)
protoImage=docker run --rm -v $(CURDIR):/workspace --workdir /workspace $(protoImageName)
containerProtoGen = cosmos-sdk-proto-gen-$(protoVer)
containerProtoFmt = cosmos-sdk-proto-fmt-$(protoVer)
.DEFAULT_GOAL := help
##################
### Docker ###
##################
docker/build:
docker build -t $(CONTAINER_IMAGE) -f docker/Dockerfile .
docker build -t $(CONTAINER_TESTNET_IMAGE) -f docker/testnet/Dockerfile .
docker/publish:
docker push $(CONTAINER_IMAGE)
docker push $(CONTAINER_TESTNET_IMAGE)
docker: docker/build docker/publish
##################
### CI ###
##################
ci/coverage:
go test $(cd src && go list ./... | grep -v /vendor/) -v -coverprofile .testCoverage.txt
ci/test:
go test -v ./... -cover
ci/lint:
golangci-lint --config .golangci.yml run --print-issued-lines --out-format=github-actions ./...
##################
### Protobuf ###
##################
proto: proto/format proto/lint proto/gen proto/swagger-gen
proto/deps:
go install cosmossdk.io/orm/cmd/protoc-gen-go-cosmos-orm@latest
go install cosmossdk.io/orm/cmd/protoc-gen-go-cosmos-orm-proto@latest
proto/swagger-gen:
@echo "Generating Protobuf Swagger"
@$(protoImage) sh ./scripts/protocgen-docs.sh
proto/gen: proto/deps
@echo "Generating protobuf files..."
@$(protoImage) sh ./scripts/protocgen.sh
@go mod tidy
proto/format:
@$(protoImage) find ./ -name "*.proto" -exec clang-format -i {} \;
proto/lint:
@$(protoImage) buf lint proto/ --error-format=json
.PHONY: proto proto/gen proto/format proto/lint
##################
### Others ###
##################
src/run:
go run ./src/cmd/fullcored/main.go
export GOPRIVATE=github.com/obada-foundation
src/vendor:
go mod tidy && go mod vendor
mockgen:
./scripts/mockgen.sh
clean:
rm -rf $(BUILD_DIR)
bin:
@mkdir -p $(BUILD_DIR)
GOOS=linux GOARCH=amd64 go build -o $(BUILD_DIR) $(CURDIR)/cmd/fullcored