Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add release action to auto build binaries #1884

Merged
merged 2 commits into from
May 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
on:
release:
types: [ created ]

jobs:
releases-matrix:
name: Release goctl binary
if: startsWith(github.ref, 'refs/tags/tools/goctl/')
runs-on: ubuntu-latest
strategy:
matrix:
# build and publish in parallel: linux/386, linux/amd64, linux/arm64,
# windows/386, windows/amd64, windows/arm64, darwin/amd64, darwin/arm64
goos: [ linux, windows, darwin ]
goarch: [ "386", amd64, arm64 ]
exclude:
- goarch: "386"
goos: darwin
steps:
- uses: actions/checkout@v2
- uses: zeromicro/go-zero-release-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
goos: ${{ matrix.goos }}
goarch: ${{ matrix.goarch }}
goversion: "https://dl.google.com/go/go1.17.5.linux-amd64.tar.gz"
project_path: "tools/goctl"
binary_name: "goctl"
extra_files: tools/goctl/goctl.md
39 changes: 32 additions & 7 deletions core/logx/tracelogger_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@ func TestTraceLog(t *testing.T) {
SetLevel(InfoLevel)
w := new(mockWriter)
old := writer.Swap(w)
defer writer.Store(old)
writer.lock.RLock()
defer func() {
writer.lock.RUnlock()
writer.Store(old)
}()

otp := otel.GetTracerProvider()
tp := sdktrace.NewTracerProvider(sdktrace.WithSampler(sdktrace.AlwaysSample()))
Expand All @@ -35,7 +39,11 @@ func TestTraceLog(t *testing.T) {
func TestTraceError(t *testing.T) {
w := new(mockWriter)
old := writer.Swap(w)
defer writer.Store(old)
writer.lock.RLock()
defer func() {
writer.lock.RUnlock()
writer.Store(old)
}()

otp := otel.GetTracerProvider()
tp := sdktrace.NewTracerProvider(sdktrace.WithSampler(sdktrace.AlwaysSample()))
Expand All @@ -49,7 +57,7 @@ func TestTraceError(t *testing.T) {
l := WithContext(context.Background())
l = l.WithContext(nilCtx)
l = l.WithContext(ctx)
SetLevel(InfoLevel)
SetLevel(ErrorLevel)
l.WithDuration(time.Second).Error(testlog)
validate(t, w.String(), true, true)
w.Reset()
Expand All @@ -61,6 +69,7 @@ func TestTraceError(t *testing.T) {
validate(t, w.String(), true, true)
w.Reset()
l.WithDuration(time.Second).Errorw(testlog, Field("foo", "bar"))
fmt.Println(w.String())
validate(t, w.String(), true, true)
assert.True(t, strings.Contains(w.String(), "foo"), w.String())
assert.True(t, strings.Contains(w.String(), "bar"), w.String())
Expand All @@ -69,7 +78,11 @@ func TestTraceError(t *testing.T) {
func TestTraceInfo(t *testing.T) {
w := new(mockWriter)
old := writer.Swap(w)
defer writer.Store(old)
writer.lock.RLock()
defer func() {
writer.lock.RUnlock()
writer.Store(old)
}()

otp := otel.GetTracerProvider()
tp := sdktrace.NewTracerProvider(sdktrace.WithSampler(sdktrace.AlwaysSample()))
Expand Down Expand Up @@ -102,7 +115,11 @@ func TestTraceInfoConsole(t *testing.T) {

w := new(mockWriter)
o := writer.Swap(w)
defer writer.Store(o)
writer.lock.RLock()
defer func() {
writer.lock.RUnlock()
writer.Store(o)
}()

otp := otel.GetTracerProvider()
tp := sdktrace.NewTracerProvider(sdktrace.WithSampler(sdktrace.AlwaysSample()))
Expand All @@ -127,7 +144,11 @@ func TestTraceInfoConsole(t *testing.T) {
func TestTraceSlow(t *testing.T) {
w := new(mockWriter)
old := writer.Swap(w)
defer writer.Store(old)
writer.lock.RLock()
defer func() {
writer.lock.RUnlock()
writer.Store(old)
}()

otp := otel.GetTracerProvider()
tp := sdktrace.NewTracerProvider(sdktrace.WithSampler(sdktrace.AlwaysSample()))
Expand Down Expand Up @@ -159,7 +180,11 @@ func TestTraceSlow(t *testing.T) {
func TestTraceWithoutContext(t *testing.T) {
w := new(mockWriter)
old := writer.Swap(w)
defer writer.Store(old)
writer.lock.RLock()
defer func() {
writer.lock.RUnlock()
writer.Store(old)
}()

l := WithContext(context.Background())
SetLevel(InfoLevel)
Expand Down