Skip to content

Add proto-validation CI for Go, Rust, Swift, Kotlin, Python#28

Open
pacu wants to merge 3 commits into
mainfrom
feature/add-integration-tests
Open

Add proto-validation CI for Go, Rust, Swift, Kotlin, Python#28
pacu wants to merge 3 commits into
mainfrom
feature/add-integration-tests

Conversation

@pacu

@pacu pacu commented Apr 28, 2026

Copy link
Copy Markdown
Collaborator

Closes #27.

Summary

  • Adds buf.yaml (v2): BASIC lint with PACKAGE_DIRECTORY_MATCH excepted; WIRE_JSON breaking rules.
  • Adds .github/workflows/proto-validation.yml: 6 parallel jobs that run on PRs touching walletrpc/**, on main, and on v* tags.
    • buf job: buf lint plus buf breaking against the latest v* 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 uses tonic-build driven from a scaffolded build.rs; Swift uses Mint on macos-latest to install pinned protoc-gen-swift and protoc-gen-grpc-swift.
  • All toolchain versions pinned in the workflow's env: block. Path filters + concurrency group keep wall-clock low.

Design notes

  • Codegen-only, not downstream compile. Enough to catch reserved-word collisions, plugin failures, and module-import errors per language, without paying for cargo check/go build/Gradle on every PR. Easy to tighten later.
  • Breaking baseline = latest v* tag. Matches how this repo is consumed (subtree pulls at tagged versions). PRs to main between releases stay unblocked, but a tag can never silently break the previous tag's wire/JSON contract.
  • PACKAGE_DIRECTORY_MATCH excepted because walletrpc/ doesn't match cash/z/wallet/sdk/rpc/. Renaming would break every downstream git subtree --prefix=lightwallet-protocol/ consumer; out of scope here.

Test plan

  • On first push, confirm the buf job runs lint successfully and the breaking-change check resolves v0.4.1 as baseline.
  • Confirm all 5 codegen jobs pass on the unmodified protos.
  • (Optional) Push a deliberate breaking change (e.g., renumber a field in service.proto) on a throwaway branch and verify the buf job fails.
  • (Optional) Push a deliberate plugin-breaking change (e.g., rename a field to a reserved keyword in one language) and verify the relevant codegen job fails.
  • Bump any pinned version that 404s on first run; the most likely candidates are BUF_VERSION, GRPCIO_TOOLS_VERSION, GRPC_SWIFT_VERSION.

🤖 Generated with Claude Code

pacu added 3 commits April 28, 2026 09:33
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add CI: validate protos generate code for Go, Rust, Swift, Kotlin, Python

1 participant