Skip to content

Commit

Permalink
Improve Sempahore CI (#481)
Browse files Browse the repository at this point in the history
Improve Sempahore CI build
  • Loading branch information
agnivade authored Dec 15, 2021
1 parent 5a4e6a3 commit da45ffe
Show file tree
Hide file tree
Showing 6 changed files with 449 additions and 30 deletions.
56 changes: 35 additions & 21 deletions .semaphore/semaphore.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,35 @@
version: v1.0
name: Go
agent:
machine:
type: e1-standard-2
os_image: ubuntu2004
blocks:
- name: Test
task:
jobs:
- name: go test
commands:
- sem-version go 1.17
- export GO111MODULE=on
- export GOPATH=~/go
- 'export PATH=/home/semaphore/go/bin:$PATH'
- checkout
- go version
- go get ./...
- go test ./...
- go build -v .
version: v1.0
name: Go
agent:
machine:
type: e1-standard-2
os_image: ubuntu2004
blocks:
- name: Style Check
task:
jobs:
- name: fmt
commands:
- sem-version go 1.17
- checkout
- ./scripts/golangci_install.sh -b $(go env GOPATH)/bin v1.42.1
- export PATH=$(go env GOPATH)/bin:$PATH
- golangci-lint run ./...

- name: Test & Build
task:
prologue:
commands:
- sem-version go 1.17
- export PATH=$(go env GOPATH)/bin:$PATH
- checkout
- go version

jobs:
- name: Test
commands:
- go test ./...

- name: Build
commands:
- go build -v .
3 changes: 1 addition & 2 deletions graphql.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"context"
"encoding/json"
"fmt"
"reflect"
"time"

"github.com/graph-gophers/graphql-go/errors"
Expand Down Expand Up @@ -197,7 +196,7 @@ func (s *Schema) ValidateWithVariables(queryString string, variables map[string]
// without a resolver. If the context get cancelled, no further resolvers will be called and a
// the context error will be returned as soon as possible (not immediately).
func (s *Schema) Exec(ctx context.Context, queryString string, operationName string, variables map[string]interface{}) *Response {
if s.res.Resolver == (reflect.Value{}) {
if !s.res.Resolver.IsValid() {
panic("schema created without resolver, can not exec")
}
return s.exec(ctx, queryString, operationName, variables, s.res)
Expand Down
2 changes: 1 addition & 1 deletion internal/exec/subscribe.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ func (r *Request) Subscribe(ctx context.Context, s *resolvable.Schema, op *types

c := make(chan *Response)
// TODO: handle resolver nil channel better?
if result == reflect.Zero(result.Type()) {
if result.IsZero() {
close(c)
return c
}
Expand Down
8 changes: 4 additions & 4 deletions internal/schema/schema_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -995,13 +995,13 @@ func TestInterfaceImplementsInterface(t *testing.T) {
if tt.validateError == nil {
t.Fatal(err)
}
if err := tt.validateError(err); err != nil {
t.Fatal(err)
if err2 := tt.validateError(err); err2 != nil {
t.Fatal(err2)
}
}
if tt.validateSchema != nil {
if err := tt.validateSchema(s); err != nil {
t.Fatal(err)
if err2 := tt.validateSchema(s); err2 != nil {
t.Fatal(err2)
}
}
})
Expand Down
Loading

0 comments on commit da45ffe

Please sign in to comment.