Skip to content

commit

commit #4

Workflow file for this run

name: Protobuf
on: # yamllint disable-line rule:truthy
pull_request:
paths:
# Keep in sync with below
# The protos themselves
- '**.proto'
# Any generated code
- '**.pb.go'
- '**.pb.gw.go'
- 'indexer/packages/v4-protos/**'
# Code that affects generation
- 'v4-proto-py/**'
- 'v4-proto-js/**'
- 'proto/**'
- 'indexer/package.json'
- 'protocol/scripts/protoc**'
push:
branches:
- main
- 'release/protocol/v0.[0-9]+.x' # e.g. release/protocol/v0.1.x
- 'release/protocol/v[0-9]+.x' # e.g. release/protocol/v1.x
paths:
# Keep in sync with above
# The protos themselves
- '**.proto'
# Any generated code
- '**.pb.go'
- '**.pb.gw.go'
- 'indexer/packages/v4-protos/**'
# Code that affects generation
- 'v4-proto-py/**'
- 'v4-proto-js/**'
- 'proto/**'
- 'indexer/package.json'
- 'protocol/scripts/protoc**'
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
format:
runs-on: ubuntu-latest
container:
image: ghcr.io/cosmos/proto-builder:0.14.0
options: --user root
timeout-minutes: 5
steps:
- uses: actions/checkout@v3
- name: format
run: |
git config --global --add safe.directory /__w/v4-chain/v4-chain
find ./ -name "*.proto" -exec clang-format -i {} \;
git diff --exit-code
lint:
runs-on: ubuntu-latest
container:
image: ghcr.io/cosmos/proto-builder:0.14.0
options: --user root
timeout-minutes: 5
steps:
- uses: actions/checkout@v3
- name: lint
run: buf lint --error-format=json
check-bc-breaking:
runs-on: ubuntu-latest
container:
image: ghcr.io/cosmos/proto-builder:0.14.0
options: --user root
timeout-minutes: 5
steps:
- uses: actions/checkout@v3
# For push and PR cases, there's a different way to fetch the branch to compare with
- name: check-bc-breaking
run: |
git config --global --add safe.directory /__w/v4-chain/v4-chain
git fetch origin ${{ github.event.pull_request.base.sha || github.event.before }}
buf breaking --against .git#branch=${{ github.event.pull_request.base.sha || github.event.before }}
protocol-gen:
runs-on: ubuntu-latest
container:
image: ghcr.io/cosmos/proto-builder:0.14.0
options: --user root
steps:
- uses: actions/checkout@v3
- run: git config --global --add safe.directory /__w/v4-chain/v4-chain
- run: sh ./protocol/scripts/protocgen.sh && git diff --exit-code
indexer-gen:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16
- working-directory: ./indexer
run: |
npm install -g pnpm@6.34.0
pnpm install --loglevel warn --frozen-lockfile
cd packages/v4-protos && npm run build:verify-proto
v4-proto-py-gen:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: 3.11
- run: |
BIN="/usr/local/bin" && \
VERSION="1.26.1" && \
curl -sSL "https://github.com/bufbuild/buf/releases/download/v${VERSION}/buf-Linux-x86_64" -o "${BIN}/buf" && \
chmod +x "${BIN}/buf"
- run: pip install -r ./v4-proto-py/requirements.txt
- run: make v4-proto-py-gen
v4-proto-js-gen:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16
- run: |
BIN="/usr/local/bin" && \
VERSION="1.26.1" && \
curl -sSL "https://github.com/bufbuild/buf/releases/download/v${VERSION}/buf-Linux-x86_64" -o "${BIN}/buf" && \
chmod +x "${BIN}/buf"
- working-directory: ./v4-proto-js
run: |
npm install
npm run transpile
npm run build