Skip to content

Commit 07174ff

Browse files
authored
Update vektah/gqlparser imports (#96)
* updated mod * updated references to vektah parser * updated selection set formatting to use graphql utilitiy * revert local changes * removed unnecessary logging * removed more logs * updated to latest version of graphql package * added tests action * added go binary to path * attempt to address working dir issue in gh action * removed context reference in github action * added missing path in github action test runner * rely on path for goveralls executable * report using third-party action * use built in go cover ; specify path to coverage report * use thirdparty reporter to handle golang coverage report conversion to lcov * fixed syntax error in yaml * removed travis file * added untested action to deploy release * used github action for badge * specify master branch in ci check badge
1 parent 0c65a91 commit 07174ff

19 files changed

+241
-134
lines changed
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Upload Executables
2+
3+
# run this workflow when a release is published
4+
on:
5+
release:
6+
types: [published]
7+
8+
jobs:
9+
build:
10+
name: Run Tests
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Use Go 1.13
15+
uses: actions/setup-go@v1
16+
with:
17+
go-version: 1.13
18+
19+
- name: Checkout source
20+
uses: actions/checkout@master
21+
with:
22+
ref: ${{ github.ref }}
23+
24+
- name: Install runner and dependencies
25+
run: |
26+
go get github.com/alecaivazis/run
27+
export PATH=${PATH}:`go env GOPATH`/bin
28+
run install:ci
29+
30+
- name: Get the version
31+
id: get_version
32+
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
33+
34+
- name: Build and deploy binaries
35+
run: |
36+
export PATH=${PATH}:`go env GOPATH`/bin
37+
run build
38+
run deploy
39+
with:
40+
version: ${{ steps.get_version.outputs.VERSION }}

.github/workflows/run-tests.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: CI Checks
2+
3+
# run this workflow on commits and pull requests
4+
on: [push, pull_request]
5+
6+
jobs:
7+
tests:
8+
name: Run Tests
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- name: Use Go 1.13
13+
uses: actions/setup-go@v1
14+
with:
15+
go-version: 1.13
16+
17+
- name: Checkout source
18+
uses: actions/checkout@master
19+
with:
20+
ref: ${{ github.ref }}
21+
22+
- name: Install runner and dependencies
23+
run: |
24+
go get github.com/alecaivazis/run
25+
export PATH=${PATH}:`go env GOPATH`/bin
26+
run install:ci
27+
28+
- name: Run tests
29+
run: |
30+
export PATH=${PATH}:`go env GOPATH`/bin
31+
run tests:coverage
32+
33+
- name: Report to Coveralls
34+
uses: shogo82148/actions-goveralls@v1
35+
with:
36+
path-to-profile: coverage.out

.travis.yml

Lines changed: 0 additions & 36 deletions
This file was deleted.

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# nautilus/gateway
22

3-
[![Build Status](https://travis-ci.org/nautilus/gateway.svg?branch=master)](https://travis-ci.org/nautilus/gateway) [![Coverage Status](https://coveralls.io/repos/github/nautilus/gateway/badge.svg?branch=master)](https://coveralls.io/github/nautilus/gateway?branch=master) [![Go Report Card](https://goreportcard.com/badge/github.com/nautilus/gateway)](https://goreportcard.com/report/github.com/nautilus/gateway)
3+
![CI Checks](https://github.com/nautilus/gateway/workflows/CI%20Checks/badge.svg?branch=master) [![Coverage Status](https://coveralls.io/repos/github/nautilus/gateway/badge.svg?branch=master)](https://coveralls.io/github/nautilus/gateway?branch=master) [![Go Report Card](https://goreportcard.com/badge/github.com/nautilus/gateway)](https://goreportcard.com/report/github.com/nautilus/gateway)
44

55
A standalone service designed to consolidate your graphql APIs into one endpoint.
66

@@ -23,5 +23,5 @@ arguments to pass the executable, run `./gateway --help`.
2323
## Versioning
2424

2525
This project is built as a go module and follows the practices outlined in the [spec](https://github.com/golang/go/wiki/Modules). Please consider all APIs experimental and subject
26-
to change until v1 has been released at which point semantic versioning will be strictly followed. Before
26+
to change until v1 has been released at which point semantic versioning will be strictly followed. Before
2727
then, minor version bumps denote an API breaking change.

_tasks.hcl

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ task "install:ci" {
22
description = "Install the necessary dependencies to run in CI. does not run `install`"
33
command = <<EOF
44
go get \
5-
golang.org/x/tools/cmd/cover \
6-
github.com/mattn/goveralls \
75
github.com/tcnksm/ghr \
86
github.com/mitchellh/gox
97
EOF
@@ -23,7 +21,6 @@ task "tests:coverage" {
2321
description = "Run the tests, generate a coverage report, and report it to coveralls"
2422
pipeline = [
2523
"go test -v -covermode=atomic -coverprofile=coverage.out {% .files %}",
26-
"$HOME/gopath/bin/goveralls -coverprofile=coverage.out -service=travis-ci -repotoken $COVERALLS_TOKEN"
2724
]
2825
}
2926

@@ -36,7 +33,7 @@ task "build" {
3633

3734
task "deploy" {
3835
description = "Push the built artifacts to the release. assumes its running in CI"
39-
command = "ghr -t $GITHUB_TOKEN -u nautilus -r gateway $TRAVIS_TAG ./bin"
36+
command = "ghr -t $GITHUB_TOKEN -u nautilus -r gateway $INPUT_VERSION ./bin"
4037
}
4138

4239
variables {

examples/auth/gateway.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import (
77

88
"github.com/nautilus/gateway"
99
"github.com/nautilus/graphql"
10-
"github.com/vektah/gqlparser/ast"
10+
"github.com/vektah/gqlparser/v2/ast"
1111
)
1212

1313
// the first thing we need to define is a middleware for our handler

execute.go

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import (
99
"sync"
1010

1111
"github.com/nautilus/graphql"
12-
"github.com/vektah/gqlparser/ast"
12+
"github.com/vektah/gqlparser/v2/ast"
1313
)
1414

1515
// Executor is responsible for executing a query plan against the remote
@@ -259,8 +259,6 @@ func executeStep(
259259
// we need to find the ids of the objects we are inserting into and then kick of the worker with the right
260260
// insertion point. For lists, insertion points look like: ["user", "friends:0", "catPhotos:0", "owner"]
261261
for _, dependent := range step.Then {
262-
log.Debug("Looking for insertion points for ", dependent.InsertionPoint, "\n\n")
263-
264262
insertPoints, err := executorFindInsertionPoints(resultLock, dependent.InsertionPoint, step.SelectionSet, queryResult, [][]string{insertionPoint}, step.FragmentDefinitions)
265263
if err != nil {
266264
errCh <- err
@@ -305,6 +303,7 @@ func findSelection(matchString string, selectionSet ast.SelectionSet, fragmentDe
305303
}
306304
}
307305
}
306+
308307
return nil, nil
309308
}
310309

@@ -338,17 +337,17 @@ func executorFindInsertionPoints(resultLock *sync.Mutex, targetPoints []string,
338337
// the point in the steps insertion path that we want to add
339338
point := targetPoints[pointI]
340339

341-
log.Debug("Looking for ", point)
342-
343-
// track wether we found a selection
340+
// find the selection node in the AST corresponding to the point
344341
var foundSelection *ast.Field
345342
foundSelection, err := findSelection(point, selectionSetRoot, fragmentDefs)
346343
if err != nil {
344+
log.Debug("Error looking for selection")
347345
return [][]string{}, err
348346
}
349347

350348
// if we didn't find a selection
351349
if foundSelection == nil {
350+
log.Debug("No selection")
352351
return [][]string{}, nil
353352
}
354353

@@ -377,7 +376,6 @@ func executorFindInsertionPoints(resultLock *sync.Mutex, targetPoints []string,
377376
if !ok {
378377
return nil, fmt.Errorf("Root value of result chunk was not a list: %v", rootValue)
379378
}
380-
381379
// build up a new list of insertion points
382380
newInsertionPoints := [][]string{}
383381

execute_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import (
1313

1414
"github.com/nautilus/graphql"
1515
"github.com/stretchr/testify/assert"
16-
"github.com/vektah/gqlparser/ast"
16+
"github.com/vektah/gqlparser/v2/ast"
1717
)
1818

1919
type roundTripFunc func(req *http.Request) *http.Response

gateway.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import (
66
"fmt"
77
"strings"
88

9-
"github.com/vektah/gqlparser/ast"
9+
"github.com/vektah/gqlparser/v2/ast"
1010

1111
"github.com/nautilus/graphql"
1212
)

gateway_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import (
88

99
"github.com/nautilus/graphql"
1010
"github.com/stretchr/testify/assert"
11-
"github.com/vektah/gqlparser/ast"
11+
"github.com/vektah/gqlparser/v2/ast"
1212
)
1313

1414
type schemaTableRow struct {

0 commit comments

Comments
 (0)