Skip to content

Commit

Permalink
Making CI for testing generated proto correctness (#1892)
Browse files Browse the repository at this point in the history
(cherry picked from commit 0956d89)

# Conflicts:
#	chain.schema.json
  • Loading branch information
xBalbinus authored and mergify[bot] committed Jul 15, 2022
1 parent b0afc78 commit 051e5f9
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 0 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

0 comments on commit 051e5f9

Please sign in to comment.