forked from cloudwego/kitex
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request cloudwego#1638 from cloudwego/release-v0.12.0
chore: release v0.12.0
- Loading branch information
Showing
241 changed files
with
15,245 additions
and
2,544 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,9 +4,9 @@ on: [ pull_request ] | |
|
||
jobs: | ||
compliant: | ||
runs-on: [ self-hosted, X64 ] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Check License Header | ||
uses: apache/skywalking-eyes/[email protected] | ||
|
@@ -16,32 +16,7 @@ jobs: | |
- name: Check Spell | ||
uses: crate-ci/[email protected] | ||
|
||
staticcheck: | ||
runs-on: [ self-hosted, X64 ] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up Go | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version: stable | ||
# For self-hosted, the cache path is shared across projects | ||
# and it works well without the cache of github actions | ||
# Enable it if we're going to use Github only | ||
cache: false | ||
|
||
- uses: reviewdog/action-staticcheck@v1 | ||
with: | ||
github_token: ${{ secrets.github_token }} | ||
# Change reviewdog reporter if you need [github-pr-check,github-check,github-pr-review]. | ||
reporter: github-pr-review | ||
# Report all results. | ||
filter_mode: nofilter | ||
# Exit with 1 when it finds at least one finding. | ||
fail_on_error: true | ||
# Set staticcheck flags | ||
staticcheck_flags: -checks=inherit,-SA1029 | ||
|
||
lint: | ||
golangci-lint: | ||
runs-on: [ self-hosted, X64 ] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,13 +4,14 @@ on: [ push, pull_request ] | |
|
||
jobs: | ||
unit-scenario-test: | ||
runs-on: ubuntu-latest | ||
runs-on: [ self-hosted, X64 ] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up Go | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version: '1.21' | ||
go-version: stable | ||
cache: false | ||
- name: Scenario Tests | ||
run: | | ||
cd .. | ||
|
@@ -47,7 +48,7 @@ jobs: | |
go-version: ${{ matrix.go }} | ||
cache: false # don't use cache for self-hosted runners | ||
- name: Unit Test | ||
run: go test -race -covermode=atomic ./... | ||
run: go test -race ./... | ||
|
||
codegen-test: | ||
runs-on: ubuntu-latest | ||
|
@@ -63,11 +64,12 @@ jobs: | |
go install ./tool/cmd/kitex | ||
LOCAL_REPO=$(pwd) | ||
cd .. | ||
git clone https://github.com/cloudwego/kitex-tests.git | ||
git clone https://github.com/cloudwego/kitex-tests.git | ||
cd kitex-tests/codegen | ||
go mod init codegen-test | ||
go mod edit -replace=github.com/apache/thrift=github.com/apache/[email protected] | ||
go mod edit -replace github.com/cloudwego/kitex=${LOCAL_REPO} | ||
go mod edit -replace github.com/cloudwego/kitex/pkg/protocol/bthrift=${LOCAL_REPO}/pkg/protocol/bthrift | ||
go mod tidy | ||
bash -version | ||
bash ./codegen_install_check.sh | ||
|
@@ -79,6 +81,9 @@ jobs: | |
windows-test: | ||
runs-on: windows-latest | ||
env: # Fixes https://github.com/actions/setup-go/issues/240 | ||
GOMODCACHE: 'D:\go\pkg\mod' | ||
GOCACHE: 'D:\go\go-build' | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up Go | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
/* | ||
* Copyright 2024 CloudWeGo Authors | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package client | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/cloudwego/kitex/client/streamxclient/streamxcallopt" | ||
istreamxclient "github.com/cloudwego/kitex/internal/streamx/streamxclient" | ||
"github.com/cloudwego/kitex/pkg/rpcinfo" | ||
"github.com/cloudwego/kitex/pkg/streamx" | ||
) | ||
|
||
// NewStream create stream for streamx mode | ||
func (kc *kClient) NewStream(ctx context.Context, method string, streamArgs streamx.StreamArgs, callOptions ...streamxcallopt.CallOption) (context.Context, streamx.ClientStream, error) { | ||
if !kc.inited { | ||
panic("client not initialized") | ||
} | ||
if kc.closed { | ||
panic("client is already closed") | ||
} | ||
if ctx == nil { | ||
panic("ctx is nil") | ||
} | ||
var ri rpcinfo.RPCInfo | ||
ctx, ri, _ = kc.initRPCInfo(ctx, method, 0, nil) | ||
|
||
err := rpcinfo.AsMutableRPCConfig(ri.Config()).SetInteractionMode(rpcinfo.Streaming) | ||
if err != nil { | ||
return nil, nil, err | ||
} | ||
ctx = rpcinfo.NewCtxWithRPCInfo(ctx, ri) | ||
|
||
// tracing | ||
ctx = kc.opt.TracerCtl.DoStart(ctx, ri) | ||
ctx, copts := istreamxclient.NewCtxWithCallOptions(ctx) | ||
callOptions = append(callOptions, istreamxclient.WithStreamCloseCallback(func(nErr error) { | ||
kc.opt.TracerCtl.DoFinish(ctx, ri, nErr) | ||
})) | ||
copts.Apply(callOptions) | ||
|
||
if msargs := streamx.AsMutableStreamArgs(streamArgs); msargs != nil { | ||
msargs.SetStreamMiddleware(kc.sxStreamMW) | ||
|
||
eventHandler := kc.opt.TracerCtl.GetStreamEventHandler() | ||
if eventHandler == nil { | ||
msargs.SetStreamRecvMiddleware(kc.sxStreamRecvMW) | ||
msargs.SetStreamSendMiddleware(kc.sxStreamSendMW) | ||
} else { | ||
traceRecvMW := streamx.NewStreamRecvStatMiddleware(ctx, eventHandler) | ||
traceSendMW := streamx.NewStreamSendStatMiddleware(ctx, eventHandler) | ||
if kc.sxStreamRecvMW == nil { | ||
msargs.SetStreamRecvMiddleware(traceRecvMW) | ||
} else { | ||
msargs.SetStreamRecvMiddleware(streamx.StreamRecvMiddlewareChain(traceRecvMW, kc.sxStreamRecvMW)) | ||
} | ||
if kc.sxStreamSendMW == nil { | ||
msargs.SetStreamSendMiddleware(traceSendMW) | ||
} else { | ||
msargs.SetStreamSendMiddleware(streamx.StreamSendMiddlewareChain(traceSendMW, kc.sxStreamSendMW)) | ||
} | ||
} | ||
} | ||
// with streamx mode, req is nil and resp is streamArgs | ||
// it's an ugly trick but if we don't want to refactor too much, | ||
// this is the only way to compatible with current endpoint API. | ||
err = kc.sEps(ctx, nil, streamArgs) | ||
if err != nil { | ||
return nil, nil, err | ||
} | ||
return ctx, streamArgs.Stream().(streamx.ClientStream), nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.