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

Use buf to build #180

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
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
18 changes: 8 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,19 @@ jobs:
name: buf
permissions:
contents: read
pull-requests: read
pull-requests: write
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: go.mod
- uses: bufbuild/buf-setup-action@v1
with:
version: "latest"
- uses: bufbuild/buf-lint-action@v1
- uses: bufbuild/buf-breaking-action@v1

- uses: bufbuild/buf-action@v1
with:
against: "https://github.com/${GITHUB_REPOSITORY}.git#branch=main"
token: ${{ secrets.BUF_TOKEN }}
pr_comment: true
breaking: flase
# breaking_against: "https://github.com/ringsaturn/tzf.git#branch=main"
push: ${{ github.ref == 'refs/heads/main' }}

golangci:
name: golangci-lint
Expand Down
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
tzf-server
*.pb
coverage.*
tmp/
tzf-server
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,15 @@ install: ## Install tools
go install github.com/favadi/protoc-go-inject-tag@latest
go install github.com/ringsaturn/protoc-gen-go-hertz@latest

bump-buf-dep:
buf dep update

.PHONY:pb
pb: ## Generate protobuf
buf build
buf generate
protoc-go-inject-tag -input="tzf/v1/*.pb.go" -remove_tag_comment
go tool protoc-go-inject-tag -input="gen/go/tzf_server/v1/*.pb.go" -remove_tag_comment
cp internal/misc/api_hertz_swagger.go.txt gen/openapi/api_hertz_swagger.go
go fmt ./...

fmt: ## Format code
Expand Down
12 changes: 6 additions & 6 deletions buf.gen.yaml
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
version: v2
plugins:
- remote: buf.build/community/google-gnostic-openapi:v0.7.0
out: tzf/v1
- remote: buf.build/protocolbuffers/go:v1.30.0
out: .
out: gen/go
opt: paths=source_relative
- remote: buf.build/community/google-gnostic-openapi:v0.7.0
out: gen/openapi
- remote: buf.build/grpc/go:v1.3.0
out: .
out: gen/go
opt: paths=source_relative
- local: protoc-gen-go-hertz
out: .
out: gen/go
opt: paths=source_relative
- local: protoc-gen-go-grpc-mock
out: .
out: gen/go
opt: paths=source_relative
4 changes: 2 additions & 2 deletions buf.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ deps:
commit: 087bc8072ce44e339f213209e4d57bf0
digest: b5:c4eebcd04bc2fdd5dd0b8d695eb419682a650b600cdb56ff2ed61208a24603e0eb1b8ae0d467925c69a24bde6d322f3c4112bd2b8efdd682d8c3128384cdac9a
- name: buf.build/googleapis/googleapis
commit: 7a6bc1e3207144b38e9066861e1de0ff
digest: b5:6d05bde5ed4cd22531d7ca6467feb828d2dc45cc9de12ce3345fbddd64ddb1bf0db756558c32ca49e6bc7de4426ada8960d5590e8446854b81f5f36f0916dc48
commit: 546238c53f7340c6a2a6099fb863bc1b
digest: b5:e017bbf31a3f912e2b969c03c3aa711f466cfe104f510865d1a8ede1be490240aabd4cca5865459a0f15222747284395f98afc094b0fd086e8917a5a7bdd9db0
14 changes: 6 additions & 8 deletions buf.yaml
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
# For details on buf.yaml configuration, visit https://buf.build/docs/configuration/v2/buf-yaml
version: v2
deps:
- buf.build/gnostic/gnostic
- buf.build/googleapis/googleapis
lint:
use:
- DEFAULT
except:
- FIELD_NOT_REQUIRED
- PACKAGE_NO_IMPORT_CYCLE
disallow_comment_ignores: true
- STANDARD
breaking:
use:
- FILE
except:
- EXTENSION_NO_DELETE
- FIELD_SAME_DEFAULT

modules:
- path: pb
name: buf.build/ringsaturn/tzf-server
Loading
Loading