Skip to content

Improve Sempahore CI #481

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

Merged
merged 5 commits into from
Dec 15, 2021
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
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