Skip to content

Commit da45ffe

Browse files
authored
Improve Sempahore CI (#481)
Improve Sempahore CI build
1 parent 5a4e6a3 commit da45ffe

File tree

6 files changed

+449
-30
lines changed

6 files changed

+449
-30
lines changed

.semaphore/semaphore.yml

Lines changed: 35 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,35 @@
1-
version: v1.0
2-
name: Go
3-
agent:
4-
machine:
5-
type: e1-standard-2
6-
os_image: ubuntu2004
7-
blocks:
8-
- name: Test
9-
task:
10-
jobs:
11-
- name: go test
12-
commands:
13-
- sem-version go 1.17
14-
- export GO111MODULE=on
15-
- export GOPATH=~/go
16-
- 'export PATH=/home/semaphore/go/bin:$PATH'
17-
- checkout
18-
- go version
19-
- go get ./...
20-
- go test ./...
21-
- go build -v .
1+
version: v1.0
2+
name: Go
3+
agent:
4+
machine:
5+
type: e1-standard-2
6+
os_image: ubuntu2004
7+
blocks:
8+
- name: Style Check
9+
task:
10+
jobs:
11+
- name: fmt
12+
commands:
13+
- sem-version go 1.17
14+
- checkout
15+
- ./scripts/golangci_install.sh -b $(go env GOPATH)/bin v1.42.1
16+
- export PATH=$(go env GOPATH)/bin:$PATH
17+
- golangci-lint run ./...
18+
19+
- name: Test & Build
20+
task:
21+
prologue:
22+
commands:
23+
- sem-version go 1.17
24+
- export PATH=$(go env GOPATH)/bin:$PATH
25+
- checkout
26+
- go version
27+
28+
jobs:
29+
- name: Test
30+
commands:
31+
- go test ./...
32+
33+
- name: Build
34+
commands:
35+
- go build -v .

graphql.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import (
44
"context"
55
"encoding/json"
66
"fmt"
7-
"reflect"
87
"time"
98

109
"github.com/graph-gophers/graphql-go/errors"
@@ -197,7 +196,7 @@ func (s *Schema) ValidateWithVariables(queryString string, variables map[string]
197196
// without a resolver. If the context get cancelled, no further resolvers will be called and a
198197
// the context error will be returned as soon as possible (not immediately).
199198
func (s *Schema) Exec(ctx context.Context, queryString string, operationName string, variables map[string]interface{}) *Response {
200-
if s.res.Resolver == (reflect.Value{}) {
199+
if !s.res.Resolver.IsValid() {
201200
panic("schema created without resolver, can not exec")
202201
}
203202
return s.exec(ctx, queryString, operationName, variables, s.res)

internal/exec/subscribe.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ func (r *Request) Subscribe(ctx context.Context, s *resolvable.Schema, op *types
8282

8383
c := make(chan *Response)
8484
// TODO: handle resolver nil channel better?
85-
if result == reflect.Zero(result.Type()) {
85+
if result.IsZero() {
8686
close(c)
8787
return c
8888
}

internal/schema/schema_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -995,13 +995,13 @@ func TestInterfaceImplementsInterface(t *testing.T) {
995995
if tt.validateError == nil {
996996
t.Fatal(err)
997997
}
998-
if err := tt.validateError(err); err != nil {
999-
t.Fatal(err)
998+
if err2 := tt.validateError(err); err2 != nil {
999+
t.Fatal(err2)
10001000
}
10011001
}
10021002
if tt.validateSchema != nil {
1003-
if err := tt.validateSchema(s); err != nil {
1004-
t.Fatal(err)
1003+
if err2 := tt.validateSchema(s); err2 != nil {
1004+
t.Fatal(err2)
10051005
}
10061006
}
10071007
})

0 commit comments

Comments
 (0)