-
Notifications
You must be signed in to change notification settings - Fork 82
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add workflow to check protobuf compatibility. * add workflow to check protobuf compatibility. * test.
- Loading branch information
1 parent
ef28f51
commit 31d9564
Showing
3 changed files
with
125 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
name: "Protobuf compatibility check" | ||
description: | | ||
"Runs a compatibility check for protobuf files." | ||
inputs: | ||
upstream_commit_version: | ||
description: "Commit version of aptos-core that upstream is using" | ||
required: true | ||
default: "main" | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- name: Install the buf CLI | ||
shell: bash | ||
run: | | ||
BIN="/usr/local/bin" && \ | ||
VERSION="1.30.0" && \ | ||
curl -sSL \ | ||
"https://github.com/bufbuild/buf/releases/download/v${VERSION}/buf-$(uname -s)-$(uname -m)" \ | ||
-o "${BIN}/buf" && \ | ||
chmod +x "${BIN}/buf" | ||
# Checkout current repo with current commit | ||
- name: Checkout current repo | ||
uses: actions/checkout@v4 | ||
with: | ||
path: "aptos-indexer-processors" | ||
|
||
- name: Parse the toml in this repo | ||
id: get_tag_output | ||
shell: bash | ||
run: | | ||
set -ex | ||
curl -sSLf "$(curl -sSLf https://api.github.com/repos/tomwright/dasel/releases/latest | grep browser_download_url | grep linux_amd64 | grep -v .gz | cut -d\" -f 4)" -L -o dasel && chmod +x dasel | ||
mv ./dasel /usr/local/bin/dasel | ||
cd aptos-indexer-processors | ||
tag_output=$(dasel -r toml -f rust/Cargo.toml workspace.dependencies.aptos-protos.tag -w - ) | ||
echo "::set-output name=tag_output::$tag_output" | ||
- name: Checkout aptos-core | ||
uses: actions/checkout@v4 | ||
with: | ||
repository: "aptos-labs/aptos-core" | ||
path: "aptos-core" | ||
ref: ${{ steps.get_tag_output.outputs.tag_output }} | ||
|
||
- name: Check compatibility | ||
shell: bash | ||
run: | | ||
set -ex | ||
cd aptos-core/protos/proto | ||
repo_url="https://github.com/aptos-labs/aptos-core.git#tag=${{ inputs.upstream_commit_version }},subdir=protos/proto" | ||
if buf breaking --against "$repo_url" --verbose; then | ||
echo "No breaking changes found" | ||
else | ||
echo "Breaking changes found" | ||
echo "Did new oneof/enum fields get added?" | ||
exit 1 | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
name: "Check Protobuf Compatibility" | ||
on: | ||
workflow_dispatch: | ||
inputs: | ||
upstream_commit_version: | ||
description: 'The commit version to check compatibility against' | ||
required: false | ||
default: 'main' | ||
pull_request: | ||
|
||
# cancel redundant builds | ||
concurrency: | ||
# for push and workflow_dispatch events we use `github.sha` in the concurrency group and don't really cancel each other out/limit concurrency | ||
# for pull_request events newer jobs cancel earlier jobs to save on CI etc. | ||
group: ${{ github.workflow }}-${{ github.event_name }}-${{ (github.event_name == 'push' || github.event_name == 'workflow_dispatch') && github.sha || github.head_ref || github.ref }} | ||
cancel-in-progress: true | ||
|
||
|
||
jobs: | ||
CheckProtobufCompatibilityAgainstCurrentPR: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: ./.github/actions/protobuf-compatibility-check/ | ||
with: | ||
# Either current PR or the latest commit on the branch | ||
upstream_commit_version: ${{ github.event.inputs.upstream_commit_version || 'main' }} |
39 changes: 39 additions & 0 deletions
39
.github/workflows/nightly-check-protobuf-compatibility.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
name: "Nightly Check Protobuf Compatibility" | ||
on: | ||
workflow_dispatch: | ||
schedule: | ||
- cron: "0 9 * * *" | ||
|
||
# cancel redundant builds | ||
concurrency: | ||
# for push and workflow_dispatch events we use `github.sha` in the concurrency group and don't really cancel each other out/limit concurrency | ||
# for pull_request events newer jobs cancel earlier jobs to save on CI etc. | ||
group: ${{ github.workflow }}-${{ github.event_name }}-${{ (github.event_name == 'push' || github.event_name == 'workflow_dispatch') && github.sha || github.head_ref || github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
CheckProtobufCompatibilityAgainstTestnet: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Get current version | ||
id: get_upstream_commit_version | ||
run: | | ||
echo "::set-output name=upstream_commit_version::$(curl -s https://api.testnet.aptoslabs.com/v1 | jq -r .git_hash)" | ||
- uses: actions/checkout@v4 | ||
- uses: ./.github/actions/protobuf-compatibility-check/ | ||
with: | ||
upstream_commit_version: ${{ steps.get_upstream_commit_version.outputs.upstream_commit_version }} | ||
|
||
CheckProtobufCompatibilityAgainstMainnet: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Get current version | ||
id: get_upstream_commit_version | ||
run: | | ||
echo "::set-output name=upstream_commit_version::$(curl -s https://api.mainnet.aptoslabs.com/v1 | jq -r .git_hash)" | ||
- uses: actions/checkout@v4 | ||
- uses: ./.github/actions/protobuf-compatibility-check/ | ||
with: | ||
upstream_commit_version: ${{ steps.get_upstream_commit_version.outputs.upstream_commit_version }} |