Skip to content

Commit

Permalink
Migrate service proxy and interceptor from SDK (#100)
Browse files Browse the repository at this point in the history
  • Loading branch information
robholland authored Jan 5, 2023
1 parent 8a0bd67 commit 59b240f
Show file tree
Hide file tree
Showing 12 changed files with 4,673 additions and 4 deletions.
19 changes: 19 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Continuous Integration
on:
pull_request:
push:
branches:
- master

jobs:
build-and-test:
runs-on: ubuntu-latest
steps:
- name: Print build information
run: "echo head_ref: ${{ github.head_ref }}, ref: ${{ github.ref }}"
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
go-version: "1.17"
- name: Check
run: make check test
2 changes: 1 addition & 1 deletion .github/workflows/update-proto.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:

- name: Re-build proto
run: |
make install update-proto
make install update-proto test
- name: Commit update
env:
GIT_AUTHOR_NAME: ${{ github.event.inputs.commit_author }}
Expand Down
22 changes: 20 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ $(VERBOSE).SILENT:
install: grpc-install mockgen-install goimports-install update-proto

# Compile proto files.
proto: grpc goimports grpc-mock copyright
proto: grpc goimports proxy grpc-mock copyright

# Update submodule and compile proto files.
update-proto: update-proto-submodule proto update-dependencies gomodtidy
Expand Down Expand Up @@ -60,6 +60,11 @@ grpc-mock:
printf $(COLOR) "Generate gRPC mocks..."
$(foreach PROTO_GRPC_SERVICE,$(PROTO_GRPC_SERVICES),cd $(PROTO_OUT) && mockgen -package $(call service_name,$(PROTO_GRPC_SERVICE))mock -source $(PROTO_GRPC_SERVICE) -destination $(call mock_file_name,$(PROTO_GRPC_SERVICE))$(NEWLINE) )

.PHONY: proxy
proxy:
printf $(COLOR) "Generate proxy code..."
(cd ./cmd/proxygenerator && go run ./)

goimports:
printf $(COLOR) "Run goimports..."
goimports -w $(PROTO_OUT)
Expand Down Expand Up @@ -98,8 +103,21 @@ gomodtidy:
printf $(COLOR) "go mod tidy..."
go mod tidy

##### Test #####

test:
go test ./proxy ./serviceerror

##### Check #####

generatorcheck:
printf $(COLOR) "Check generated code is not stale..."
(cd ./cmd/proxygenerator && go run ./ -verifyOnly)

check: generatorcheck

##### Clean #####
clean:
printf $(COLOR) "Deleting generated go files..."
# Delete all directories with *.pb.go and *.mock.go files from $(PROTO_OUT)
find $(PROTO_OUT) \( -name "*.pb.go" -o -name "*.mock.go" \) | xargs -I{} dirname {} | sort -u | xargs rm -rf
find $(PROTO_OUT) \( -name "*.pb.go" -o -name "*.mock.go" \) | xargs -I{} dirname {} | sort -u | xargs rm -rf
22 changes: 22 additions & 0 deletions cmd/proxygenerator/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
module go.temporal.io/api/cmd/proxygenerator

go 1.18

require (
go.temporal.io/api v1.13.0
golang.org/x/tools v0.3.0
)

replace go.temporal.io/api => ../../

require (
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/protobuf v1.5.2 // indirect
golang.org/x/mod v0.7.0 // indirect
golang.org/x/net v0.4.0 // indirect
golang.org/x/sys v0.3.0 // indirect
golang.org/x/text v0.5.0 // indirect
google.golang.org/genproto v0.0.0-20221207170731-23e4bf6bdc37 // indirect
google.golang.org/grpc v1.51.0 // indirect
google.golang.org/protobuf v1.28.1 // indirect
)
1,071 changes: 1,071 additions & 0 deletions cmd/proxygenerator/go.sum

Large diffs are not rendered by default.

Loading

0 comments on commit 59b240f

Please sign in to comment.