Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[1/3] Create a workflow that can automatically upgrade the sdk proto dependency. #15568

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 0 additions & 72 deletions .github/workflows/check-protos.yaml

This file was deleted.

106 changes: 106 additions & 0 deletions .github/workflows/indexer-protos-sdk-update.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
name: Checks the proto changes and release
'on':
pull_request:
types: [labeled, opened, synchronize, reopened, auto_merge_enabled]
branches:
- main
paths:
- protos/proto/aptos/transaction/v1/transaction.proto

jobs:
check-protos:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# Install buf, which we use to generate code from the protos for Rust and TS.
- name: Install buf
uses: bufbuild/[email protected]
with:
version: 1.28.1
- uses: pre-commit/[email protected]
# Install protoc itself.
- name: Install Protoc
uses: arduino/setup-protoc@v2
with:
version: "25.x"
# Set up pnpm.
- uses: pnpm/action-setup@v4
# Set up Poetry.
- name: Install Python deps for generating code from protos
uses: ./.github/actions/python-setup
with:
pyproject_directory: ./protos/python
# Install the Rust, TS, and Python codegen deps.
- name: Install deps for generating code from protos
run: cd protos && ./scripts/install_deps.sh
# Finally, generate code based on the protos.
- name: Generate code
run: cd protos && ./scripts/build_protos.sh

- name: Confirm that nothing has changed
run: git diff --exit-code
update-sdk:
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
if: | # Only run on each PR once an appropriate event occurs
(
github.event_name == 'push' ||
contains(github.event.pull_request.labels.*.name, 'indexer-sdk-update')
)
steps:
- name: Checkout code
uses: actions/checkout@v4

# Install buf, which we use to generate code from the protos for Rust and TS.
- name: Install buf
uses: bufbuild/[email protected]
with:
version: 1.28.1

- name: Check the format of the proto files
run: |
set -e
buf format -d aptos/transaction/v1/transaction.proto --exit-code
working-directory: protos/proto
- name: Capture the commit hash
id: commit_hash
run: |
# Echo the commit hash to the output
echo "::set-output name=commit_hash::$(echo $GITHUB_SHA)"
# Echo the PR branch name to the output
echo "::set-output name=branch_name::${{ github.head_ref }}"

- name: Google Cloud Auth
id: auth
uses: "google-github-actions/auth@v2"
with:
workload_identity_provider: ${{ secrets.GCP_WORKLOAD_IDENTITY_PROVIDER }}
service_account: ${{ secrets.GCP_SERVICE_ACCOUNT_EMAIL }}
- name: Get Secret Manager Secrets
id: secrets
uses: 'google-github-actions/get-secretmanager-secrets@v2'
with:
secrets: |-
token:aptos-ci/github-actions-repository-dispatch

- name: Dispatch Event to SDK Repo
uses: peter-evans/[email protected]
with:
token: ${{ steps.secrets.outputs.token }}
repository: 'aptos-labs/aptos-indexer-processor-sdk'
event-type: 'proto-dependency-update'
client-payload: '{"commit_hash": "${{ github.sha }}", "branch_name": "${{ steps.commit_hash.outputs.branch_name }}"}'
# TOOD: enable this once the forge test is stable.
# - name: Run Forge Tests
# uses: ./.github/workflows/workflow-run-forge
# with:
# GIT_SHA: ${{ github.sha }}
# FORGE_TEST_SUITE: sdk_update
# IMAGE_TAG: ${{ github.sha }}
# FORGE_RUNNER_DURATION_SECS: 3600
# COMMENT_HEADER: forge-sdk-update
# FORGE_NAMESPACE: forge-sdk-update-namespace
# SKIP_JOB: ${{ !contains(github.event.pull_request.labels.*.name, 'CICD:run-sdk-update-test') }}
# SEND_RESULTS_TO_TRUNK: true
Loading