Add proto-validation CI for Go, Rust, Swift, Kotlin, Python#28
Open
pacu wants to merge 3 commits into
Open
Conversation
Introduces the first GitHub Actions workflow for this repo. Every PR touching walletrpc/** now runs: - buf lint (BASIC, with PACKAGE_DIRECTORY_MATCH excepted to preserve the walletrpc/ layout that downstream subtree consumers depend on). - buf breaking (WIRE_JSON) against the latest v* git tag, so PRs are checked against what consumers actually pulled in via git subtree. - Codegen-only validation in parallel for Go, Rust (tonic-build), Python, Swift (swift-protobuf + grpc-swift via Mint on macOS), and Kotlin. Codegen is enough to catch reserved-word collisions and plugin-level errors without paying for full downstream compilation. All toolchain versions are pinned in a single env: block at the top of the workflow for easy bumping. Path filters and a concurrency group keep wall-clock time down. Refs #27.
- buf: except FIELD_LOWER_SNAKE_CASE and ENUM_VALUE_UPPER_SNAKE_CASE so the existing camelCase fields and lowercase enum values pass lint without churn (renaming would be JSON-name-breaking). - Python: drop `cache: pip`. setup-python requires a requirements.txt or pyproject.toml to hash; we have neither, and one dep installs in ~2s anyway. - Kotlin: Maven Central only ships the plugin as a JAR (no .sh wrapper exists, contrary to the original assumption); download the JAR and wrap it in a `java -jar` shim. Bump to 1.4.3 (latest in the 1.4.x series). - Rust: bump RUST_TOOLCHAIN to 1.85.0. tonic-build 0.12.3 transitively pulls indexmap 2.14, which requires the edition2024 Cargo feature stabilized in Rust 1.85. Refs #27.
Tags older than this PR (e.g. v0.4.1) have no buf.yaml at the repo root, so buf cannot infer that walletrpc/ is the module path. That caused the breaking-change check to fail with "import \"compact_formats.proto\": file does not exist". Setting `subdir=walletrpc` on the --against input makes buf treat walletrpc/ as the module root in the baseline, which is what the in-PR buf.yaml already does for the current tree. Refs #27.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #27.
Summary
buf.yaml(v2):BASIClint withPACKAGE_DIRECTORY_MATCHexcepted;WIRE_JSONbreaking rules..github/workflows/proto-validation.yml: 6 parallel jobs that run on PRs touchingwalletrpc/**, onmain, and onv*tags.bufjob:buf lintplusbuf breakingagainst the latestv*tag (skipped if no tag exists).codegen-{go,rust,python,swift,kotlin}: each generates stubs with the standard plugin for that language and verifies output exists. Rust usestonic-builddriven from a scaffoldedbuild.rs; Swift uses Mint onmacos-latestto install pinnedprotoc-gen-swiftandprotoc-gen-grpc-swift.env:block. Path filters + concurrency group keep wall-clock low.Design notes
cargo check/go build/Gradle on every PR. Easy to tighten later.v*tag. Matches how this repo is consumed (subtree pulls at tagged versions). PRs tomainbetween releases stay unblocked, but a tag can never silently break the previous tag's wire/JSON contract.PACKAGE_DIRECTORY_MATCHexcepted becausewalletrpc/doesn't matchcash/z/wallet/sdk/rpc/. Renaming would break every downstreamgit subtree --prefix=lightwallet-protocol/consumer; out of scope here.Test plan
bufjob runs lint successfully and the breaking-change check resolvesv0.4.1as baseline.service.proto) on a throwaway branch and verify thebufjob fails.BUF_VERSION,GRPCIO_TOOLS_VERSION,GRPC_SWIFT_VERSION.🤖 Generated with Claude Code