Skip to content

Commit

Permalink
Revert "bump cosmos-sdk to v0.47 (#331)" (#334)
Browse files Browse the repository at this point in the history
  • Loading branch information
aofengli authored Feb 13, 2023
1 parent d2e1621 commit 767e76a
Show file tree
Hide file tree
Showing 135 changed files with 5,366 additions and 2,761 deletions.
46 changes: 23 additions & 23 deletions .github/workflows/sims.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,27 +11,27 @@ jobs:
- name: Setup go
uses: actions/setup-go@v3
with:
go-version: '^1.19' # The Go version to download (if necessary) and use.
go-version: '^1.18' # The Go version to download (if necessary) and use.
- run: make test-sim-nondeterminism-fast
# test-sim-import-export:
# name: Test AppImportExport
# runs-on: ubuntu-latest
# steps:
# - name: Checkout source code
# uses: actions/checkout@v3
# - name: Setup go
# uses: actions/setup-go@v3
# with:
# go-version: '^1.19' # The Go version to download (if necessary) and use.
# - run: make test-sim-import-export
# test-sim-after-import:
# name: Test AppSimulationAfterImport
# runs-on: ubuntu-latest
# steps:
# - name: Checkout source code
# uses: actions/checkout@v3
# - name: Setup go
# uses: actions/setup-go@v3
# with:
# go-version: '^1.19' # The Go version to download (if necessary) and use.
# - run: make test-sim-after-import
test-sim-import-export:
name: Test AppImportExport
runs-on: ubuntu-latest
steps:
- name: Checkout source code
uses: actions/checkout@v3
- name: Setup go
uses: actions/setup-go@v3
with:
go-version: '^1.18' # The Go version to download (if necessary) and use.
- run: make test-sim-import-export
test-sim-after-import:
name: Test AppSimulationAfterImport
runs-on: ubuntu-latest
steps:
- name: Checkout source code
uses: actions/checkout@v3
- name: Setup go
uses: actions/setup-go@v3
with:
go-version: '^1.18' # The Go version to download (if necessary) and use.
- run: make test-sim-after-import
23 changes: 15 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -43,25 +43,32 @@ distclean: clean
### Protobuf ###
###############################################################################

protoVer=0.11.2
protoImageName=ghcr.io/cosmos/proto-builder:$(protoVer)
protoImage=$(DOCKER) run --rm -v $(CURDIR):/workspace --workdir /workspace $(protoImageName)
protoVer=v0.7
protoImageName=tendermintdev/sdk-proto-gen:$(protoVer)
containerProtoGen=$(PROJECT_NAME)-proto-gen-$(protoVer)
containerProtoGenAny=$(PROJECT_NAME)-proto-gen-any-$(protoVer)
containerProtoGenSwagger=$(PROJECT_NAME)-proto-gen-swagger-$(protoVer)
containerProtoFmt=$(PROJECT_NAME)-proto-fmt-$(protoVer)

proto-all: proto-format proto-lint proto-gen
proto-all: proto-format proto-gen

proto-gen:
@echo "Generating Protobuf files"
@$(protoImage) sh ./scripts/protocgen.sh
@if docker ps -a --format '{{.Names}}' | grep -Eq "^${containerProtoGen}$$"; then docker start -a $(containerProtoGen); else docker run --name $(containerProtoGen) -v $(CURDIR):/workspace --workdir /workspace $(protoImageName) \
sh ./scripts/protocgen.sh; fi

proto-swagger-gen:
@echo "Generating Protobuf Swagger"
@$(protoImage) sh ./scripts/protoc-swagger-gen.sh
@if docker ps -a --format '{{.Names}}' | grep -Eq "^${containerProtoGenSwagger}$$"; then docker start -a $(containerProtoGenSwagger); else docker run --name $(containerProtoGenSwagger) -v $(CURDIR):/workspace --workdir /workspace $(protoImageName) \
sh ./scripts/protoc-swagger-gen.sh; fi

proto-format:
@$(protoImage) find ./ -name "*.proto" -exec clang-format -i {} \;
@echo "Formatting Protobuf files"
@if docker ps -a --format '{{.Names}}' | grep -Eq "^${containerProtoFmt}$$"; then docker start -a $(containerProtoFmt); else docker run --name $(containerProtoFmt) -v $(CURDIR):/workspace --workdir /workspace tendermintdev/docker-build-proto \
find ./ -not -path "./third_party/*" -name "*.proto" -exec clang-format -i {} \; ; fi

proto-lint:
@$(protoImage) buf lint --error-format=json
@$(DOCKER_BUF) lint --error-format=json

########################################
### Testing
Expand Down
3 changes: 2 additions & 1 deletion buf.work.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@
# previous "buf.yaml" configuration.
version: v1
directories:
- proto
- proto
- third_party/proto
108 changes: 85 additions & 23 deletions contrib/devtools/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,13 @@ ifeq ($(GO),)
$(error could not find go. Is it in PATH? $(GO))
endif

###############################################################################
### Functions ###
###############################################################################
GOPATH ?= $(shell $(GO) env GOPATH)
GITHUBDIR := $(GOPATH)$(FS)src$(FS)github.com
GOLANGCI_LINT_HASHSUM := 8d21cc95da8d3daf8321ac40091456fc26123c964d7c2281d339d431f2f4c840

###
# Functions
###

go_get = $(if $(findstring Windows_NT,$(OS)),\
IF NOT EXIST $(GITHUBDIR)$(FS)$(1)$(FS) ( mkdir $(GITHUBDIR)$(FS)$(1) ) else (cd .) &\
Expand All @@ -31,39 +35,97 @@ cd $(GITHUBDIR)$(FS)$(1)$(FS)$(2) && git fetch origin && git checkout -q $(3)
mkfile_path := $(abspath $(lastword $(MAKEFILE_LIST)))
mkfile_dir := $(shell cd $(shell dirname $(mkfile_path)); pwd)


###############################################################################
### Tools ###
###############################################################################
###
# tools
###

PREFIX ?= /usr/local
BIN ?= $(PREFIX)/bin
UNAME_S ?= $(shell uname -s)
UNAME_M ?= $(shell uname -m)

GOPATH ?= $(shell $(GO) env GOPATH)
GITHUBDIR := $(GOPATH)$(FS)src$(FS)github.com

BUF_VERSION ?= 0.11.0

TOOLS_DESTDIR ?= $(GOPATH)/bin
STATIK = $(TOOLS_DESTDIR)/statik

GOLANGCI_LINT = $(TOOLS_DESTDIR)/golangci-lint
STATIK = $(TOOLS_DESTDIR)/statik
RUNSIM = $(TOOLS_DESTDIR)/runsim

tools: tools-stamp
tools-stamp: statik runsim
# Create dummy file to satisfy dependency and avoid
# rebuilding when this Makefile target is hit twice
# in a row.
touch $@
all: tools

tools: statik golangci-lint proto-tools

golangci-lint: $(GOLANGCI_LINT)
$(GOLANGCI_LINT): $(mkfile_dir)/install-golangci-lint.sh
@echo "Installing golangci-lint..."
@bash $(mkfile_dir)/install-golangci-lint.sh $(TOOLS_DESTDIR) $(GOLANGCI_LINT_HASHSUM)

# Install the runsim binary
statik: $(STATIK)
$(STATIK):
@echo "Installing statik..."
@go install github.com/rakyll/[email protected]
@(cd /tmp && go get github.com/rakyll/[email protected])

PROTOC_VERSION ?= 3.13.0
PROTOC_GRPC_GATEWAY_VERSION = 1.14.7
ifeq ($(UNAME_S),Linux)
PROTOC_ZIP ?= protoc-3.13.0-linux-x86_64.zip
PROTOC_GRPC_GATEWAY_BIN ?= protoc-gen-grpc-gateway-v1.14.7-linux-x86_64
endif
ifeq ($(UNAME_S),Darwin)
PROTOC_ZIP ?= protoc-3.13.0-osx-x86_64.zip
PROTOC_GRPC_GATEWAY_BIN ?= protoc-gen-grpc-gateway-v1.14.7-darwin-x86_64
endif

proto-tools: buf
ifeq (, $(shell which protoc))
@echo "Installing protoc compiler..."
@(cd /tmp; \
curl -OL "https://github.com/protocolbuffers/protobuf/releases/download/v${PROTOC_VERSION}/${PROTOC_ZIP}"; \
unzip -o ${PROTOC_ZIP} -d $(PREFIX) bin/protoc; \
unzip -o ${PROTOC_ZIP} -d $(PREFIX) 'include/*'; \
rm -f ${PROTOC_ZIP})
else
@echo "protoc already installed; skipping..."
endif

ifeq (, $(shell which protoc-gen-gocosmos))
@echo "Installing protoc-gen-gocosmos..."
@go install github.com/regen-network/cosmos-proto/protoc-gen-gocosmos
else
@echo "protoc-gen-gocosmos already installed; skipping..."
endif

ifeq (, $(shell which protoc-gen-grpc-gateway))
@echo "Installing protoc-gen-grpc-gateway..."
@curl -o "${BIN}/protoc-gen-grpc-gateway" -L "https://github.com/grpc-ecosystem/grpc-gateway/releases/download/v${PROTOC_GRPC_GATEWAY_VERSION}/${PROTOC_GRPC_GATEWAY_BIN}"
@chmod +x "${BIN}/protoc-gen-grpc-gateway"
else
@echo "protoc-gen-grpc-gateway already installed; skipping..."
endif

ifeq (, $(shell which protoc-gen-swagger))
@echo "Installing protoc-gen-swagger..."
@go install github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger
@npm install -g swagger-combine
else
@echo "protoc-gen-grpc-gateway already installed; skipping..."
endif

buf: buf-stamp

buf-stamp:
@echo "Installing buf..."
@curl -sSL \
"https://github.com/bufbuild/buf/releases/download/v${BUF_VERSION}/buf-${UNAME_S}-${UNAME_M}" \
-o "${BIN}/buf" && \
chmod +x "${BIN}/buf"

touch $@

# Install the runsim binary
# Install the runsim binary with a temporary workaround of entering an outside
# directory as the "go get" command ignores the -mod option and will polute the
# go.{mod, sum} files.
#
# ref: https://github.com/golang/go/issues/30515
runsim: $(RUNSIM)
$(RUNSIM):
@echo "Installing runsim..."
Expand All @@ -73,4 +135,4 @@ tools-clean:
rm -f $(STATIK) $(GOLANGCI_LINT) $(RUNSIM)
rm -f tools-stamp

.PHONY: tools-clean statik runsim
.PHONY: tools-clean statik runsim
Loading

0 comments on commit 767e76a

Please sign in to comment.