Skip to content

Commit 9c2f332

Browse files
authored
Merge pull request #2031 from CosmWasm/co/autofix-protobuf
Add autofix protobuf job
2 parents 1a49630 + 0a8c40d commit 9c2f332

File tree

6 files changed

+80
-9
lines changed

6 files changed

+80
-9
lines changed

.github/workflows/autofix.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: autofix.ci # needed to securely identify the workflow
2+
3+
on:
4+
pull_request:
5+
6+
permissions:
7+
contents: read
8+
9+
jobs:
10+
autofix-protobuf:
11+
runs-on: ubuntu-latest
12+
container:
13+
image: ghcr.io/cosmos/proto-builder:0.14.0
14+
options: --user root # workaround for a problem during actions/checkout, see https://github.com/actions/checkout/issues/1014
15+
steps:
16+
- uses: actions/checkout@v4
17+
- name: Fix permissions # needed because of root user fix above
18+
run: git config --global --add safe.directory "$PWD"
19+
- name: Format protobuf
20+
run: find ./ -name "*.proto" -exec clang-format -i {} \;
21+
- name: Generate protobuf
22+
run: sh ./scripts/protocgen.sh
23+
- name: Format
24+
run: make format
25+
26+
# Get latest version from https://autofix.ci/setup
27+
- uses: autofix-ci/action@dd55f44df8f7cdb7a6bf74c78677eb8acd40cd0a
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: Protobuf Linting
2+
# run buf lint (https://buf.build/)
3+
# This workflow is only run when a .proto file has been changed
4+
on:
5+
pull_request:
6+
paths:
7+
- "proto/**"
8+
9+
permissions:
10+
contents: read
11+
12+
jobs:
13+
buf-lint:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v4
17+
- uses: bufbuild/[email protected]
18+
19+
# lint checks
20+
- uses: bufbuild/buf-lint-action@v1
21+
with:
22+
input: "proto"

Makefile

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ SIMAPP = ./app
1010

1111
# for dockerized protobuf tools
1212
DOCKER := $(shell which docker)
13-
BUF_IMAGE=bufbuild/buf@sha256:3cb1f8a4b48bd5ad8f09168f10f607ddc318af202f5c057d52a45216793d85e5 #v1.4.0
14-
DOCKER_BUF := $(DOCKER) run --rm -v $(CURDIR):/workspace --workdir /workspace $(BUF_IMAGE)
1513
HTTPS_GIT := https://github.com/CosmWasm/wasmd.git
1614

1715
export GO111MODULE = on
@@ -187,10 +185,10 @@ proto-swagger-gen:
187185
@./scripts/protoc-swagger-gen.sh
188186

189187
proto-lint:
190-
@$(DOCKER_BUF) lint --error-format=json
188+
@$(protoImage) buf lint --error-format=json
191189

192190
proto-check-breaking:
193-
@$(DOCKER_BUF) breaking --against $(HTTPS_GIT)#branch=main
191+
@$(protoImage) buf breaking --against $(HTTPS_GIT)#branch=main
194192

195193
.PHONY: all install install-debug \
196194
go-mod-cache draw-deps clean build format \

tests/e2e/ibc_fees_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
"testing"
88
"time"
99

10+
wasmvmtypes "github.com/CosmWasm/wasmvm/v2/types"
1011
ibcfee "github.com/cosmos/ibc-go/v8/modules/apps/29-fee/types"
1112
ibctransfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types"
1213
clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" //nolint:staticcheck
@@ -23,7 +24,6 @@ import (
2324
"github.com/CosmWasm/wasmd/app"
2425
wasmibctesting "github.com/CosmWasm/wasmd/tests/ibctesting"
2526
wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types"
26-
wasmvmtypes "github.com/CosmWasm/wasmvm/v2/types"
2727
)
2828

2929
func TestIBCFeesTransfer(t *testing.T) {

x/wasm/keeper/keeper_test.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1615,12 +1615,14 @@ func TestIterateContractsByCode(t *testing.T) {
16151615

16161616
func TestIterateContractsByCodeWithMigration(t *testing.T) {
16171617
// mock migration so that it does not fail when migrate example1 to example2.codeID
1618-
mockWasmVM := wasmtesting.MockWasmEngine{MigrateFn: func(codeID wasmvm.Checksum, env wasmvmtypes.Env, migrateMsg []byte, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) (*wasmvmtypes.ContractResult, uint64, error) {
1619-
return &wasmvmtypes.ContractResult{Ok: &wasmvmtypes.Response{}}, 1, nil
1620-
},
1618+
mockWasmVM := wasmtesting.MockWasmEngine{
1619+
MigrateFn: func(codeID wasmvm.Checksum, env wasmvmtypes.Env, migrateMsg []byte, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) (*wasmvmtypes.ContractResult, uint64, error) {
1620+
return &wasmvmtypes.ContractResult{Ok: &wasmvmtypes.Response{}}, 1, nil
1621+
},
16211622
MigrateWithInfoFn: func(codeID wasmvm.Checksum, env wasmvmtypes.Env, migrateMsg []byte, migrateInfo wasmvmtypes.MigrateInfo, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) (*wasmvmtypes.ContractResult, uint64, error) {
16221623
return &wasmvmtypes.ContractResult{Ok: &wasmvmtypes.Response{}}, 1, nil
1623-
}}
1624+
},
1625+
}
16241626
wasmtesting.MakeInstantiable(&mockWasmVM)
16251627
ctx, keepers := CreateTestInput(t, false, AvailableCapabilities, WithWasmEngine(&mockWasmVM))
16261628
k, c := keepers.WasmKeeper, keepers.ContractKeeper

x/wasm/types/query.pb.gw.go

Lines changed: 22 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)