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

feat: change streams.Task interface and update to v7 #111

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
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
53 changes: 36 additions & 17 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,46 @@ name: Test

on: push

env:
GO111MODULE: on

jobs:
test:
build:
name: Test
runs-on: ubuntu-latest
strategy:
matrix:
go-version: [ '1.17','1.18','1.19','1.20','1.21', '1.21.x' ]

steps:
- name: Checkout the repository
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Checkout actions repository
uses: actions/checkout@v2
with:
repository: msales/github-actions
ref: master
token: ${{ secrets.GH_TOKEN }}
path: .github/actions/external

- name: Run the tests
id: test
uses: ./.github/actions/external/go-test
- name: Setup Go ${{ matrix.go-version }}
uses: actions/setup-go@v3
with:
org_token: ${{ secrets.GH_TOKEN }}
test: true
vet: true
race: false
go-version: ${{ matrix.go-version }}

- name: Display Go version
run: go version

- name: Install cover
run: go get -u golang.org/x/tools/cmd/cover

- name: Install vet
run: go get -u github.com/mattn/goveralls

- name: Install goveralls
run: go get -u github.com/mattn/goveralls

- name: Vet
run: go vet ./...

- name: Test
run: go test -race -bench=. -covermode=atomic -coverprofile=profile_full.cov -coverpkg=github.com/msales/streams/... ./...

- name: Goveralls
run: |
cat profile_full.cov | grep -v .pb.go | grep -v mock | grep -v test > profile.cov;
goveralls -coverprofile=profile.cov -service=github || true;

55 changes: 0 additions & 55 deletions cache/sink.go

This file was deleted.

116 changes: 0 additions & 116 deletions cache/sink_test.go

This file was deleted.

2 changes: 1 addition & 1 deletion channel/sink.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package channel

import "github.com/msales/streams/v6"
import "github.com/msales/streams/v7"

// Sink represents a channel sink.
type Sink struct {
Expand Down
6 changes: 3 additions & 3 deletions channel/sink_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ package channel_test
import (
"testing"

"github.com/msales/streams/v6"
"github.com/msales/streams/v6/channel"
"github.com/msales/streams/v6/mocks"
"github.com/msales/streams/v7"
"github.com/msales/streams/v7/channel"
"github.com/msales/streams/v7/mocks"
"github.com/stretchr/testify/assert"
)

Expand Down
2 changes: 1 addition & 1 deletion channel/source.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package channel
import (
"time"

"github.com/msales/streams/v6"
"github.com/msales/streams/v7"
)

// Compile-time interface check.
Expand Down
4 changes: 2 additions & 2 deletions channel/source_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package channel_test
import (
"testing"

"github.com/msales/streams/v6"
"github.com/msales/streams/v6/channel"
"github.com/msales/streams/v7"
"github.com/msales/streams/v7/channel"
"github.com/stretchr/testify/assert"
)

Expand Down
5 changes: 3 additions & 2 deletions example/benchmark/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"os/signal"
"syscall"

"github.com/msales/streams/v6"
"github.com/msales/streams/v7"
)

// BatchSize is the size of commit batches.
Expand Down Expand Up @@ -44,8 +44,9 @@ func task(_ context.Context) (streams.Task, error) {

tp, _ := builder.Build()
task := streams.NewTask(tp, streams.WithMode(Mode))
task.OnError(func(err error) {
task.OnError(func(err error) error {
log.Fatal(err.Error())
return err
})

return task, nil
Expand Down
5 changes: 3 additions & 2 deletions example/branch/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"os/signal"
"syscall"

"github.com/msales/streams/v6"
"github.com/msales/streams/v7"
)

func main() {
Expand All @@ -33,8 +33,9 @@ func main() {

tp, _ := builder.Build()
task := streams.NewTask(tp)
task.OnError(func(err error) {
task.OnError(func(err error) error {
log.Fatal(err.Error())
return err
})
task.Start(ctx)
defer task.Close()
Expand Down
12 changes: 7 additions & 5 deletions example/kafka/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ import (
"strconv"
"syscall"

"github.com/Shopify/sarama"
"github.com/IBM/sarama"

"github.com/msales/streams/v6"
"github.com/msales/streams/v6/kafka"
"github.com/msales/streams/v7"
"github.com/msales/streams/v7/kafka"
)

// BatchSize is the size of commit batches.
Expand Down Expand Up @@ -68,8 +68,9 @@ func producerTask(brokers []string, c *sarama.Config) (streams.Task, error) {

tp, _ := builder.Build()
task := streams.NewTask(tp, streams.WithMode(Mode))
task.OnError(func(err error) {
task.OnError(func(err error) error {
log.Fatal(err.Error())
return err
})

return task, nil
Expand Down Expand Up @@ -97,8 +98,9 @@ func consumerTask(brokers []string, c *sarama.Config) (streams.Task, error) {

tp, _ := builder.Build()
task := streams.NewTask(tp, streams.WithMode(Mode))
task.OnError(func(err error) {
task.OnError(func(err error) error {
log.Fatal(err.Error())
return err
})

return task, nil
Expand Down
5 changes: 3 additions & 2 deletions example/merge/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"os/signal"
"syscall"

"github.com/msales/streams/v6"
"github.com/msales/streams/v7"
)

func main() {
Expand All @@ -25,8 +25,9 @@ func main() {

tp, _ := builder.Build()
task := streams.NewTask(tp)
task.OnError(func(err error) {
task.OnError(func(err error) error {
log.Fatal(err.Error())
return err
})
task.Start(context.Background())
defer task.Close()
Expand Down
5 changes: 3 additions & 2 deletions example/simple/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"os/signal"
"syscall"

"github.com/msales/streams/v6"
"github.com/msales/streams/v7"
)

func main() {
Expand All @@ -20,8 +20,9 @@ func main() {

tp, _ := builder.Build()
task := streams.NewTask(tp)
task.OnError(func(err error) {
task.OnError(func(err error) error {
log.Fatal(err.Error())
return err
})
task.Start(context.Background())
defer task.Close()
Expand Down
Loading