feat(proto): add Buf Schema Registry support#252
Open
Conversation
Add Buf (https://buf.build) support for managing and publishing myshoes protobuf definitions to Buf Schema Registry (BSR). Changes: - Add api/proto/buf.yaml for Buf configuration with lint rules - Add api/proto/buf.gen.yaml for code generation settings - Add .github/workflows/buf.yaml for CI/CD integration - Update Makefile to use buf for proto code generation - Add .buf/ to .gitignore - Regenerate proto.go files using buf generate This allows other projects (shoes plugins) to depend on myshoes proto definitions via BSR. Manual steps required: 1. Create buf.build account and repository (buf.build/whywaita/myshoes) 2. Add BUF_TOKEN to GitHub Secrets 3. Run: cd api/proto && buf push prompt: Implement the following plan: # myshoes proto を Buf Cloud (BSR) に公開する計画 ---- 計画内容を実装します。まず、タスクを整理してから作業を開始します。 実装が完了しました。以下のファイルを作成・更新しました: ## 作成したファイル 1. **api/proto/buf.yaml** - Buf の設定ファイル(lint と breaking change のルールを定義) 2. **api/proto/buf.gen.yaml** - コード生成の設定ファイル 3. **.github/workflows/buf.yaml** - GitHub Actions ワークフロー ## 更新したファイル 1. **Makefile** - `build-proto` を buf ベースに変更、`lint-proto` ターゲットを追加 2. **.gitignore** - `.buf/` を追加 3. **api/proto.go/myshoes.pb.go** - buf generate で再生成(protoc バージョン表示のみ変更) 4. **api/proto.go/myshoes_grpc.pb.go** - buf generate で再生成(protoc バージョン表示のみ変更) ## 動作確認 - `buf lint` - エラーなし - `buf build` - 成功 - `make build` - 成功 - `make test` - すべてのテストが成功 ## 次のステップ(手動作業が必要) BSR に公開するためには、以下の手順を手動で行う必要があります: 1. **BSR アカウントのセットアップ** - https://buf.build でアカウントを作成 - リポジトリ `buf.build/whywaita/myshoes` を作成 - API トークンを取得 - GitHub の Settings → Secrets and variables → Actions で `BUF_TOKEN` を登録 2. **初回プッシュ** \`\`\`bash cd api/proto && buf push \`\`\` 3. **他のプロジェクトからの利用** 公開後、他のプロジェクトは以下のように依存できます: \`\`\`yaml # 依存先の buf.yaml version: v2 deps: - buf.build/whywaita/myshoes \`\`\`
|
The latest Buf updates on your PR. Results from workflow Buf / buf (pull_request).
|
- Add blank line after package declaration - Add newline at end of file This fixes the buf format CI check.
Add buf installation to fix docker build error. The Makefile now uses 'buf generate' so buf must be available in the build environment.
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.
Summary
Changes
api/proto/buf.yamlfor Buf configuration with lint rulesapi/proto/buf.gen.yamlfor code generation settings using remote plugins.github/workflows/buf.yamlfor CI/CD integration (lint on PR, push on master)Makefile:build-protonow usesbuf generateinstead ofprotocdirectlylint-prototarget forbuf lint.buf/to.gitignorebuf generate(only protoc version comment changed)Test Plan
buf lintpasses without errorsbuf buildsucceedsmake buildsucceedsmake test- all tests passNotes
Manual Steps Required
After merging, the following manual steps are needed to publish to BSR:
BSR Account Setup
buf.build/whywaita/myshoesBUF_TOKENto GitHub Secrets (Settings → Secrets and variables → Actions)Initial Push
Usage from Other Projects
Once published, other projects can depend on myshoes proto:
Then use: