Skip to content

Commit

Permalink
Making CI for testing generated proto correctness (backport #1892) (#…
Browse files Browse the repository at this point in the history
…2074)

* Making CI for testing generated proto correctness (#1892)

(cherry picked from commit 0956d89)

# Conflicts:
#	chain.schema.json

* Fix proto

Co-authored-by: Xiangan He <[email protected]>
Co-authored-by: Dev Ojha <[email protected]>
  • Loading branch information
3 people authored Jul 15, 2022
1 parent b0afc78 commit 27b8a8e
Show file tree
Hide file tree
Showing 45 changed files with 1,477 additions and 1,277 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/check-generated.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Verify that generated code is up-to-date.
#
# Note that we run these checks regardless whether the input files have
# changed, because generated code can change in response to toolchain updates
# even if no files in the repository are modified.
name: Check generated code
on:
workflow_dispatch:
pull_request:
branches:
- '*'

permissions:
contents: read

jobs:
check-proto:
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v3
with:
go-version: '1.18'

- uses: actions/checkout@v3
with:
fetch-depth: 1 # we need a .git directory to run git diff

- name: "Check protobuf generated code"
run: contrib/scripts/check-generated.sh
12 changes: 12 additions & 0 deletions chain.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"codebase":{
"git_repo": "https://github.com/osmosis-labs/osmosis",
"recommended_version": "v10.0.1",
"compatible_versions": ["v10.0.0", "v10.0.1"],
"binaries": {
"linux/amd64": "https://github.com/osmosis-labs/osmosis/releases/download/v10.0.0/osmosis-10.0.0-linux-amd64",
"linux/arm64": "https://github.com/osmosis-labs/osmosis/releases/download/v10.0.0/osmosis-10.0.0-linux-arm64"
}
}
}
15 changes: 15 additions & 0 deletions contrib/scripts/check-generated.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/bin/env bash

set -euo pipefail

make proto-gen

#Specificially ignore all differences in go.mod / go.sum.
if ! git diff --stat --exit-code . ':(exclude)*.mod' ':(exclude)*.sum'; then
echo ">> ERROR:"
echo ">>"
echo ">> Protobuf generated code requires update (either tools or .proto files may have changed)."
echo ">> Ensure your tools are up-to-date, re-run 'make proto-all' and update this PR."
echo ">>"
exit 1
fi
3 changes: 1 addition & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ go 1.18

require (
github.com/CosmWasm/wasmd v0.24.0
github.com/cosmos/cosmos-sdk v0.45.5
github.com/cosmos/cosmos-sdk v0.45.6
github.com/cosmos/go-bip39 v1.0.0
github.com/cosmos/iavl v0.17.3
github.com/cosmos/ibc-go/v3 v3.0.0
Expand Down Expand Up @@ -251,7 +251,6 @@ require (
golang.org/x/exp/typeparams v0.0.0-20220218215828-6cf2b201936e // indirect
golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3 // indirect
golang.org/x/net v0.0.0-20220520000938-2e3eb7b945c2 // indirect
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c // indirect
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a // indirect
golang.org/x/term v0.0.0-20220411215600-e5f449aeb171 // indirect
golang.org/x/text v0.3.7 // indirect
Expand Down
143 changes: 143 additions & 0 deletions go.sum

Large diffs are not rendered by default.

56 changes: 28 additions & 28 deletions x/epochs/types/genesis.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

44 changes: 22 additions & 22 deletions x/epochs/types/query.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 27b8a8e

Please sign in to comment.