Skip to content

Commit

Permalink
Merge pull request #18 from mchmarny/master
Browse files Browse the repository at this point in the history
Custom go SDK (aka bespoke client proposal)
  • Loading branch information
mchmarny authored Jun 24, 2020
2 parents cb34403 + 3349abc commit ee8d678
Show file tree
Hide file tree
Showing 37 changed files with 3,514 additions and 1,336 deletions.
40 changes: 0 additions & 40 deletions .github/ISSUE_TEMPLATE/bug_report.md

This file was deleted.

8 changes: 0 additions & 8 deletions .github/ISSUE_TEMPLATE/discussion.md

This file was deleted.

9 changes: 0 additions & 9 deletions .github/ISSUE_TEMPLATE/feature_request.md

This file was deleted.

9 changes: 0 additions & 9 deletions .github/ISSUE_TEMPLATE/proposal.md

This file was deleted.

20 changes: 0 additions & 20 deletions .github/ISSUE_TEMPLATE/question.md

This file was deleted.

21 changes: 0 additions & 21 deletions .github/pull_request_template.md

This file was deleted.

47 changes: 47 additions & 0 deletions .github/workflows/release-on-tag.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Release

on:
push:
tags:
- 'v*' # v0.8.1

jobs:

build:
name: Create Release
runs-on: ubuntu-latest
steps:

- name: Setup
id: go
uses: actions/setup-go@v2
with:
go-version: ^1.14

- name: Checkout
id: setup
uses: actions/checkout@v2

- name: Tidy
run: |
go mod tidy
go mod vendor
- name: Test
run: go test -v -count=1 -race ./...

- name: Version
id: get_version
run: echo ::set-env name=RELEASE_VERSION::$(echo ${GITHUB_REF:10})

- name: Release
id: release-step
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
body: Automatic go Dapr client release
draft: false
prerelease: false
31 changes: 31 additions & 0 deletions .github/workflows/test-on-push.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Test

on:
push:

jobs:

build:
name: Test Push
runs-on: ubuntu-latest
steps:

- name: Setup
id: go
uses: actions/setup-go@v2
with:
go-version: ^1.14

- name: Checkout
id: setup
uses: actions/checkout@v2

- name: Tidy
run: |
go mod tidy
go mod vendor
- name: Test
run: go test -v -count=1 -race ./...


7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,10 @@

# Output of the go coverage tool, specifically when used with LiteIDE
*.out
.DS_Store

# vendor
vendor

# docs
golang.org
9 changes: 2 additions & 7 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Contribution Guidelines

Thank you for your interest in Dapr!
Thank you for your interest in Dapr go SDK!

This project welcomes contributions and suggestions. Most contributions require you to
agree to a Contributor License Agreement (CLA) declaring that you have the right to,
Expand Down Expand Up @@ -37,18 +37,13 @@ There are 4 types of issues:

Before you file an issue, make sure you've checked the following:

1. Is it the right repository?
- The Dapr project is distributed across multiple repositories. Check the list of [repositories](https://github.com/dapr) if you aren't sure which repo is the correct one.
1. Check for existing issues
- Before you create a new issue, please do a search in [open issues](https://github.com/dapr/go-sdk/issues) to see if the issue or feature request has already been filed.
- If you find your issue already exists, make relevant comments and add your [reaction](https://github.com/blog/2119-add-reaction-to-pull-requests-issues-and-comments). Use a reaction:
- 👍 up-vote
- 👎 down-vote
1. For bugs
- Check it's not an environment issue. For example, if running on Kubernetes, make sure prerequisites are in place. (state stores, bindings, etc.)
- You have as much data as possible. This usually comes in the form of logs and/or stacktrace. If running on Kubernetes or other environment, look at the logs of the Dapr services (runtime, operator, placement service). More details on how to get logs can be found [here](https://github.com/dapr/docs/tree/master/best-practices/troubleshooting/logs.md).
1. For proposals
- Many changes to the Dapr runtime may require changes to the API. In that case, the best place to discuss the potential feature is the main [Dapr repo](https://github.com/dapr/dapr).
- Some changes to the Dapr go SDK may require changes to the API. In that case, the best place to discuss the potential feature is the main [Dapr repo](https://github.com/dapr/dapr).
- Other examples could include bindings, state stores or entirely new components.

## Contributing to Dapr
Expand Down
74 changes: 74 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
RELEASE_VERSION =v0.8.0
GDOC_PORT =8888
PROTO_ROOT =https://raw.githubusercontent.com/dapr/dapr/master/dapr/proto/

.PHONY: mod test service client lint protps tag lint docs clean protos help
all: test

mod: ## Updates the go modules
go mod tidy

test: mod ## Tests the entire project
go test -v -count=1 -race ./...
# go test -v -count=1 -run NameOfSingleTest ./...

service: mod ## Runs the uncompiled example service code
dapr run --app-id serving \
--protocol grpc \
--app-port 50001 \
go run example/serving/main.go

client: mod ## Runs the uncompiled example client code
dapr run --app-id caller \
--components-path example/client/comp \
go run example/client/main.go

lint: ## Lints the entire project
golangci-lint run --timeout=3m

docs: ## Runs godoc (in container due to mod support)
docker run \
--rm \
-e "GOPATH=/tmp/go" \
-p 127.0.0.1:$(GDOC_PORT):$(GDOC_PORT) \
-v $(PWD):/tmp/go/src/ \
--name godoc golang \
bash -c "go get golang.org/x/tools/cmd/godoc && echo http://localhost:$(GDOC_PORT)/pkg/ && /tmp/go/bin/godoc -http=:$(GDOC_PORT)"
open http://localhost:8888/pkg/client/

tag: ## Creates release tag
git tag $(RELEASE_VERSION)
git push origin $(RELEASE_VERSION)

clean: ## Cleans go and generated files in ./dapr/proto/
go clean
rm -fr ./dapr/proto/common/v1/*
rm -fr ./dapr/proto/runtime/v1/*

protos: ## Downloads proto files from dapr/dapr and generats gRPC proto clients
go install github.com/gogo/protobuf/gogoreplace

wget -q $(PROTO_ROOT)/common/v1/common.proto -O ./dapr/proto/common/v1/common.proto
gogoreplace 'option go_package = "github.com/dapr/dapr/pkg/proto/common/v1;common";' \
'option go_package = "github.com/dapr/go-sdk/dapr/proto/common/v1;common";' \
./dapr/proto/common/v1/common.proto

wget -q $(PROTO_ROOT)/runtime/v1/appcallback.proto -O ./dapr/proto/runtime/v1/appcallback.proto
gogoreplace 'option go_package = "github.com/dapr/dapr/pkg/proto/runtime/v1;runtime";' \
'option go_package = "github.com/dapr/go-sdk/dapr/proto/runtime/v1;runtime";' \
./dapr/proto/runtime/v1/appcallback.proto

wget -q $(PROTO_ROOT)/runtime/v1/dapr.proto -O ./dapr/proto/runtime/v1/dapr.proto
gogoreplace 'option go_package = "github.com/dapr/dapr/pkg/proto/runtime/v1;runtime";' \
'option go_package = "github.com/dapr/go-sdk/dapr/proto/runtime/v1;runtime";' \
./dapr/proto/runtime/v1/dapr.proto

protoc -I . --go_out=plugins=grpc:. --go_opt=paths=source_relative ./dapr/proto/common/v1/*.proto
protoc -I . --go_out=plugins=grpc:. --go_opt=paths=source_relative ./dapr/proto/runtime/v1/*.proto

rm -f ./dapr/proto/common/v1/*.proto
rm -f ./dapr/proto/runtime/v1/*.proto

help: ## Display available commands
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk \
'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
Loading

0 comments on commit ee8d678

Please sign in to comment.