Skip to content

Commit

Permalink
Merge pull request #61 from hellofresh/feature/github-actions-pipeline
Browse files Browse the repository at this point in the history
Github Actions pipeline instead of Travis
  • Loading branch information
vgarvardt committed Aug 25, 2021
2 parents 6c07f57 + cb9f747 commit eab73a0
Show file tree
Hide file tree
Showing 15 changed files with 256 additions and 117 deletions.
49 changes: 49 additions & 0 deletions .github/workflows/testing.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Testing

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v2
- name: golangci-lint
uses: golangci/golangci-lint-action@v2

test:
name: Test
runs-on: ubuntu-latest
needs: [ lint ]

services:
postgres:
image: postgres:10
ports:
- "5432"
env:
POSTGRES_USER: goengine
POSTGRES_PASSWORD: goengine
POSTGRES_DB: goengine
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: ^1.16
- name: Check out code
uses: actions/checkout@v2
- name: Run tests
run: go test -cover ./... -coverprofile=coverage.txt -covermode=atomic
env:
POSTGRES_DSN: postgres://goengine:goengine@localhost:${{ job.services.postgres.ports[5432] }}/goengine?sslmode=disable
5 changes: 2 additions & 3 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,16 @@ run:

linters:
enable:
- maligned
- govet
- deadcode
- errcheck
- gosec
- goconst
- gocyclo
- gofmt
- goimports
- golint
- revive
- ineffassign
- interfacer
- staticcheck
- structcheck
- unconvert
Expand Down
42 changes: 0 additions & 42 deletions .travis.yml

This file was deleted.

4 changes: 0 additions & 4 deletions aggregate/aggregate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,6 @@ func TestIDFromString(t *testing.T) {
"some string",
"some string",
},
{
"UUID with missing minuses",
"f4ec75dbc0b04b00a04fa0d9ed18e9fb",
},
}

for _, testCase := range testCases {
Expand Down
4 changes: 2 additions & 2 deletions driver/inmemory/internal/generate_matcher/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ func isSupportedOperator(value interface{}, operator metadata.Operator) bool {
switch operator {
case metadata.Equals,
metadata.NotEquals:
switch value.(type) {
switch value.(type) {
{{- range $i, $e := .Types }}
{{- if eq $i 0 }}
case {{ $e }},
Expand Down Expand Up @@ -195,7 +195,7 @@ func main() {
panic(err)
}

/* #nosec G302 */
/* #nosec */
f, err := os.OpenFile(matcherPath, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0644)
if err != nil {
panic(err)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ package postgres
import (
"context"
"database/sql"
"errors"
"fmt"
"strings"

"github.com/hellofresh/goengine"
driverSQL "github.com/hellofresh/goengine/driver/sql"
"github.com/pkg/errors"
)

var _ driverSQL.AggregateProjectorStorage = &AdvisoryLockAggregateProjectionStorage{}
Expand Down
6 changes: 3 additions & 3 deletions driver/sql/projection.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ package sql
import (
"context"
"database/sql"
"errors"
"time"

"github.com/mailru/easyjson/jlexer"
"github.com/mailru/easyjson/jwriter"
"github.com/pkg/errors"

"github.com/hellofresh/goengine"
)
Expand Down Expand Up @@ -37,7 +37,7 @@ type (

// ProjectionStateSerialization is an interface describing how a projection state can be initialized, serialized/encoded anf deserialized/decoded
ProjectionStateSerialization interface {
// init initializes the state
// Init initializes the state
Init(ctx context.Context) (interface{}, error)

// DecodeState reconstitute the projection state based on the provided state data
Expand Down Expand Up @@ -156,7 +156,7 @@ type nopProjectionStateSerialization struct {
}

// DecodeState reconstitute the projection state based on the provided state data
func (nopProjectionStateSerialization) DecodeState(data []byte) (interface{}, error) {
func (nopProjectionStateSerialization) DecodeState([]byte) (interface{}, error) {
return nil, nil
}

Expand Down
2 changes: 1 addition & 1 deletion driver/sql/projection_notification_processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ package sql

import (
"context"
"errors"
"runtime"
"sync"

"github.com/hellofresh/goengine"
"github.com/pkg/errors"
)

type (
Expand Down
5 changes: 3 additions & 2 deletions driver/sql/projector_notification.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ package sql
import (
"context"
"database/sql"
"errors"
"fmt"

"github.com/hellofresh/goengine"
"github.com/pkg/errors"
)

// Ensure the notificationProjector.Execute is a ProjectionTrigger
Expand Down Expand Up @@ -210,7 +211,7 @@ func wrapProjectionHandlerToTrapError(handler goengine.MessageHandler) goengine.
case error:
err = x
default:
err = errors.Errorf("unknown panic: (%T) %v", x, x)
err = fmt.Errorf("unknown panic: (%T) %v", x, x)
}

handlerErr = NewProjectionHandlerError(err)
Expand Down
7 changes: 4 additions & 3 deletions driver/sql/projector_notification_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@ package sql

import (
"context"
"errors"
"testing"

"github.com/hellofresh/goengine"
"github.com/hellofresh/goengine/aggregate"
"github.com/pkg/errors"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

"github.com/hellofresh/goengine"
"github.com/hellofresh/goengine/aggregate"
)

func TestWrapProjectionHandlerToTrapError(t *testing.T) {
Expand Down
6 changes: 3 additions & 3 deletions driver/sql/projector_stream.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ package sql
import (
"context"
"database/sql"
"fmt"
"math"
"sync"

"github.com/hellofresh/goengine"
"github.com/pkg/errors"
)

// StreamProjector is a postgres projector used to execute a projection against an event stream.
Expand Down Expand Up @@ -149,8 +149,8 @@ func (s *StreamProjector) processNotification(
}
}

return errors.Errorf(
"seriously %d retries is enough! maybe it's time to fix your projection or error handling code?",
return fmt.Errorf(
"seriously %d retries is enough! maybe it's time to fix your projection or error handling code",
math.MaxInt16,
)
}
Expand Down
28 changes: 14 additions & 14 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
module github.com/hellofresh/goengine

go 1.12
go 1.16

require (
github.com/DATA-DOG/go-sqlmock v1.3.0
github.com/golang/mock v1.2.0
github.com/google/uuid v1.0.0
github.com/lib/pq v1.0.0
github.com/mailru/easyjson v0.0.0-20190221075403-6243d8e04c3f
github.com/pkg/errors v0.8.0
github.com/prometheus/client_golang v0.9.4
github.com/sirupsen/logrus v1.2.0
github.com/streadway/amqp v0.0.0-20190827072141-edfb9018d271
github.com/stretchr/testify v1.3.0
go.uber.org/atomic v1.3.2 // indirect
go.uber.org/multierr v1.1.0 // indirect
go.uber.org/zap v1.9.1
github.com/DATA-DOG/go-sqlmock v1.5.0
github.com/golang/mock v1.6.0
github.com/google/uuid v1.3.0
github.com/lib/pq v1.10.2
github.com/mailru/easyjson v0.7.7
github.com/prometheus/client_golang v1.11.0
github.com/sirupsen/logrus v1.8.1
github.com/streadway/amqp v1.0.0
github.com/stretchr/testify v1.7.0
go.uber.org/atomic v1.9.0 // indirect
go.uber.org/multierr v1.7.0 // indirect
go.uber.org/zap v1.19.0
golang.org/x/sys v0.0.0-20210823070655-63515b42dcdf // indirect
)
Loading

0 comments on commit eab73a0

Please sign in to comment.