Skip to content

Commit

Permalink
feat(composer): generate pb.go using generate step
Browse files Browse the repository at this point in the history
  • Loading branch information
qlonik committed Feb 26, 2024
1 parent db19894 commit 96b2b70
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 8 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/ensure-committed-go-generate.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Ensure all `go generate` files are committed

on:
pull_request:

jobs:
generated-committed:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: 'privacy-profile-composer/go.mod'
- uses: arduino/setup-protoc@v3
with:
version: "25.x"
repo-token: ${{ secrets.GITHUB_TOKEN }}
- run: |
go mod download
go install google.golang.org/protobuf/cmd/protoc-gen-go
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc
go generate ./...
working-directory: ./privacy-profile-composer
- run: |
git update-index --really-refresh
git diff-index --quiet HEAD
10 changes: 2 additions & 8 deletions privacy-profile-composer/Makefile
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
build-envoy-filter: proto
build-envoy-filter:
go build -o dist/simple.so -buildmode=c-shared ./cmd/envoy-filter

run-server: proto
run-server:
go run ./cmd/opa-composer-server --policy_file ./pkg/opa/policy-and-logic/policy.rego

proto:
protoc \
--go_out=. --go_opt=module=privacy-profile-composer \
--go-grpc_out=. --go-grpc_opt=module=privacy-profile-composer \
./pkg/proto/privacy_profiles.proto
6 changes: 6 additions & 0 deletions privacy-profile-composer/pkg/proto/generator.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
//go:build generate
// +build generate

package proto

//go:generate protoc --go_out=. --go_opt=paths=source_relative --go-grpc_out=. --go-grpc_opt=paths=source_relative ./privacy_profiles.proto

0 comments on commit 96b2b70

Please sign in to comment.