Skip to content

Commit

Permalink
Merge pull request apache#1 from dubbogo/develop
Browse files Browse the repository at this point in the history
Marge new request to my branch
  • Loading branch information
xianlezheng authored Oct 16, 2020
2 parents 41d3232 + 40c919d commit ea5ebf5
Show file tree
Hide file tree
Showing 21 changed files with 845 additions and 132 deletions.
182 changes: 89 additions & 93 deletions .github/workflows/github-actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@ name: CI

on:
push:
branches: [master, develop]
branches: [ master, develop ]
pull_request:
branches: "*"
pull_request_target:
branches: "*"

jobs:

Expand All @@ -26,97 +28,91 @@ jobs:

steps:

- name: Set up Go 1.x
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go_version }}
id: go

- name: Check out code into the Go module directory
uses: actions/checkout@v2

- name: Cache dependencies
uses: actions/cache@v2
with:
# Cache
path: ~/go/pkg/mod
# Cache key
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
# An ordered list of keys to use for restoring the cache if no cache hit occurred for key
restore-keys: |
${{ runner.os }}-go-
- name: Get dependencies
run: |
if [ -f Gopkg.toml ]; then
curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
dep ensure
else
go get -v -t -d ./...
fi
- name: Go Fmt
run: go fmt ./... && [[ -z `git status -s` ]]

- name: License Check
run: |
go fmt ./... && [[ -z `git status -s` ]]
sh before_validate_license.sh
chmod u+x /tmp/tools/license/license-header-checker
/tmp/tools/license/license-header-checker -v -a -r -i vendor /tmp/tools/license/license.txt . go && [[ -z `git status -s` ]]
- name: Go Test
run: GO111MODULE=on && go mod vendor && go test ./... -bench . -race -v -coverprofile=coverage.txt

# - name: Test
# run: |
# chmod u+x before_ut.sh && ./before_ut.sh
# go mod vendor && go test ./... -coverprofile=coverage.txt -covermode=atomic
# chmod +x integrate_test.sh && ./integrate_test.sh

- name: Coverage
run: bash <(curl -s https://codecov.io/bash)

- name: Hello world
run: echo Hello world ${{ secrets.PROXY_DING_TOKEN }} ${{ secrets.PROXY_DING_SIGN }}

# Because the contexts of push and PR are different, there are two Notify.
# Notifications are triggered only in the dubbogo/dubbo-go-proxy repository.
- name: DingTalk Message Notify only Push
uses: zcong1993/[email protected]
# Whether job is successful or not, always () is always true.
if: |
always() &&
github.event_name == 'push' &&
github.repository == 'dubbogo/dubbo-go-proxy'
with:
# DingDing bot token
dingToken: ${{ env.DING_TOKEN }}
secret: ${{ env.DING_SIGN }}
# Post Body to send
body: |
{
"msgtype": "markdown",
"markdown": {
"title": "Github Actions",
"text": "## Github Actions \n - name: CI \n - repository: ${{ github.repository }} \n - trigger: ${{ github.actor }} \n - event: ${{ github.event_name }} \n - ref: ${{ github.ref }} \n - status: [${{ job.status }}](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}) \n - environment: ${{ runner.os }} \n - SHA: [${{ github.sha }}](${{ github.event.compare }})"
- name: Set up Go 1.x
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go_version }}
id: go

- name: Check out code into the Go module directory
uses: actions/checkout@v2

- name: Cache dependencies
uses: actions/cache@v2
with:
# Cache
path: ~/go/pkg/mod
# Cache key
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
# An ordered list of keys to use for restoring the cache if no cache hit occurred for key
restore-keys: |
${{ runner.os }}-go-
- name: Get dependencies
run: |
if [ -f Gopkg.toml ]; then
curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
dep ensure
else
go get -v -t -d ./...
fi
- name: Go Fmt
run: go fmt ./... && [[ -z `git status -s` ]]

- name: License Check
run: |
go fmt ./... && [[ -z `git status -s` ]]
sh before_validate_license.sh
chmod u+x /tmp/tools/license/license-header-checker
/tmp/tools/license/license-header-checker -v -a -r -i vendor /tmp/tools/license/license.txt . go && [[ -z `git status -s` ]]
- name: Go Test
run: GO111MODULE=on && go mod vendor && go test ./... -bench . -race -v -coverprofile=coverage.txt

- name: Coverage
run: bash <(curl -s https://codecov.io/bash)

- name: Hello world
run: echo Hello world ${{ secrets.PROXY_DING_TOKEN }} ${{ secrets.PROXY_DING_SIGN }}

# Because the contexts of push and PR are different, there are two Notify.
# Notifications are triggered only in the dubbogo/dubbo-go-proxy repository.
- name: DingTalk Message Notify only Push
uses: zcong1993/[email protected]
# Whether job is successful or not, always () is always true.
if: |
always() &&
github.event_name == 'push' &&
github.repository == 'dubbogo/dubbo-go-proxy'
with:
# DingDing bot token
dingToken: ${{ env.DING_TOKEN }}
secret: ${{ env.DING_SIGN }}
# Post Body to send
body: |
{
"msgtype": "markdown",
"markdown": {
"title": "Github Actions",
"text": "## Github Actions \n - name: CI \n - repository: ${{ github.repository }} \n - trigger: ${{ github.actor }} \n - event: ${{ github.event_name }} \n - ref: ${{ github.ref }} \n - status: [${{ job.status }}](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}) \n - environment: ${{ runner.os }} \n - SHA: [${{ github.sha }}](${{ github.event.compare }})"
}
}
}
- name: DingTalk Message Notify only PR
uses: zcong1993/[email protected]
if: |
always() &&
github.event_name == 'pull_request' &&
github.repository == 'dubbogo/dubbo-go-proxy'
with:
dingToken: ${{ env.DING_TOKEN }}
secret: ${{ env.DING_SIGN }}
body: |
{
"msgtype": "markdown",
"markdown": {
"title": "Github Actions",
"text": "## Github Actions \n - name: CI \n - repository: ${{ github.repository }} \n - pr_title: ${{ github.event.pull_request.title }} \n - trigger: ${{ github.actor }} \n - event: ${{ github.event_name }} \n - ref: [${{ github.ref }}](${{ github.event.pull_request._links.html.href }}) \n - status: [${{ job.status }}](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}) \n - environment: ${{ runner.os }} \n > SHA: [${{ github.sha }}](${{ github.event.pull_request._links.html.href }})"
- name: DingTalk Message Notify only PR
uses: zcong1993/[email protected]
if: |
always() &&
github.event_name == 'pull_request_target' &&
github.repository == 'dubbogo/dubbo-go-proxy'
with:
dingToken: ${{ env.DING_TOKEN }}
secret: ${{ env.DING_SIGN }}
body: |
{
"msgtype": "markdown",
"markdown": {
"title": "Github Actions",
"text": "## Github Actions \n - name: CI \n - repository: ${{ github.repository }} \n - pr_title: ${{ github.event.pull_request.title }} \n - trigger: ${{ github.actor }} \n - event: ${{ github.event_name }} \n - ref: [${{ github.ref }}](${{ github.event.pull_request._links.html.href }}) \n - status: [${{ job.status }}](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}) \n - environment: ${{ runner.os }} \n > SHA: [${{ github.sha }}](${{ github.event.pull_request._links.html.href }})"
}
}
}
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
./dubbo-go-proxy
/logs
/.idea
/.idea
/.vscode
2 changes: 0 additions & 2 deletions .idea/.gitignore

This file was deleted.

9 changes: 0 additions & 9 deletions .idea/dubbo-go-proxy.iml

This file was deleted.

6 changes: 0 additions & 6 deletions .idea/misc.xml

This file was deleted.

8 changes: 0 additions & 8 deletions .idea/modules.xml

This file was deleted.

6 changes: 0 additions & 6 deletions .idea/vcs.xml

This file was deleted.

61 changes: 56 additions & 5 deletions configs/api_config.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,56 @@
- name: "test-dubbo/user"
target: "queryUser"
method: "POST"
types:
- "com.ikurento.user.User"
name: api name
description: api description
resources:
- path: '/'
type: restful
description: resource documentation
filters:
- filter0
methods:
- httpVerb: GET
filters:
- filterA
- filterB
onAir: true
inboundRequest:
requestType: http
headers:
- name: auth
required: true
queryStrings:
- name: id
required: false
- name: type
required: false
requestBody:
- definitionName: modelDefinition
integrationRequest:
requestType: dubbo
mappingParams:
- name: queryStrings.id
mapTo: 1
applicationName: BDTService
group: test
version: 1.0.0
interface: com.ikurento.user.UserProvider
Method: GetUser
paramTypes:
- java.lang.String
ClusterName: test_dubbo
definitions:
- name: modelDefinition
schema: >-
{
"type" : "object",
"properties" : {
"id" : {
"type" : "integer"
},
"type" : {
"type" : "string"
},
"price" : {
"type" : "number"
}
}
}
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ go 1.14

require (
github.com/apache/dubbo-go v1.5.1
github.com/emirpasic/gods v1.12.0
github.com/ghodss/yaml v1.0.1-0.20190212211648-25d852aebe32
github.com/goinggo/mapstructure v0.0.0-20140717182941-194205d9b4a9
github.com/pkg/errors v0.9.1
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,8 @@ github.com/elazarl/go-bindata-assetfs v1.0.0/go.mod h1:v+YaWX3bdea5J/mo8dSETolEo
github.com/elazarl/goproxy v0.0.0-20170405201442-c4fc26588b6e/go.mod h1:/Zj4wYkgs4iZTTu3o/KG3Itv/qCCa8VVMlb3i9OVuzc=
github.com/emicklei/go-restful v0.0.0-20170410110728-ff4f55a20633/go.mod h1:otzb+WCGbkyDHkqmQmT5YD2WR4BBwUdeQoFo8l/7tVs=
github.com/emicklei/go-restful/v3 v3.0.0/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc=
github.com/emirpasic/gods v1.12.0 h1:QAUIPSaCu4G+POclxeqb3F+WPpdKqFGlw36+yOzGlrg=
github.com/emirpasic/gods v1.12.0/go.mod h1:YfzfFFoVP/catgzJb4IKIqXjX78Ha8FMSDh3ymbK86o=
github.com/envoyproxy/go-control-plane v0.8.0/go.mod h1:GSSbY9P1neVhdY7G4wu+IK1rk/dqhiCC/4ExuWJZVuk=
github.com/envoyproxy/protoc-gen-validate v0.0.14/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
github.com/evanphx/json-patch v4.2.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk=
Expand Down
2 changes: 1 addition & 1 deletion pkg/client/dubbo/dubbo_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ type DubboMetadata struct {
Version string `yaml:"version" json:"version" mapstructure:"version"`
Interface string `yaml:"interface" json:"interface" mapstructure:"interface"`
Method string `yaml:"method" json:"method" mapstructure:"method"`
Types []string `yaml:"type" json:"types" mapstructure:"types"`
Types []string `yaml:"types" json:"types" mapstructure:"types"`
Retries string `yaml:"retries" json:"retries,omitempty" property:"retries"`
ClusterName string `yaml:"cluster_name" json:"cluster_name,omitempty" property:"cluster_name"`
ProtocolTypeStr string `yaml:"protocol_type" json:"protocol_type,omitempty" property:"protocol_type"`
Expand Down
3 changes: 3 additions & 0 deletions pkg/common/constant/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ const (
HeaderValueJsonUtf8 = "application/json;charset=UTF-8"
HeaderValueTextPlain = "text/plain"
HeaderValueAll = "*"

PathSlash = "/"
PathParamIdentifier = ":"
)

const (
Expand Down
7 changes: 7 additions & 0 deletions pkg/common/yaml/testdata/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@

intTest: 11
booleanTest: false
strTest: "strTest"

child:
strTest: "childStrTest"
Loading

0 comments on commit ea5ebf5

Please sign in to comment.