Skip to content

Commit

Permalink
Add github actions to lint and test (#241)
Browse files Browse the repository at this point in the history
Signed-off-by: Steve Coffman <steve@khanacademy.org>

Signed-off-by: Steve Coffman <steve@khanacademy.org>
  • Loading branch information
StevenACoffman authored Sep 14, 2022
1 parent eae2341 commit 372cb17
Show file tree
Hide file tree
Showing 4 changed files with 110 additions and 0 deletions.
14 changes: 14 additions & 0 deletions .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
### What happened?

### What did you expect?

### Minimal graphql.schema and models to reproduce

### versions
- `go list -m github.com/vektah/gqlparser/v2`?
- `go version`?

<!--
Please make sure you are using github.com/vektah/gqlparser/v2 as the v1 is no longer supported!
-->

5 changes: 5 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Describe your PR and link to any relevant issues.

I have:
- [ ] Added tests covering the bug / feature
- [ ] Updated any relevant documentation
46 changes: 46 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: golangci-lint
on:
push:
branches:
- main
pull_request:
branches:
- main
env:
GOFLAGS: "-trimpath"
GO_VERSION: 1.19
jobs:
resolve-modules:
name: Resolve Modules
# runs-on: [self-hosted, linux, x64]
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- name: Checkout Sources
uses: actions/checkout@v2
- id: set-matrix
run: ./tools/resolve-modules.sh
golangci:
name: Linter
needs: resolve-modules
runs-on: ubuntu-latest
strategy:
matrix: ${{ fromJson(needs.resolve-modules.outputs.matrix) }}
steps:
- name: Install Go
uses: actions/setup-go@v3
with:
# stable: 'false' # Keep this line to be able to use rc and beta version of Go (ex: 1.18.0-rc1).
go-version: ${{ env.GO_VERSION }}
- uses: actions/checkout@v2
- name: lint
uses: golangci/golangci-lint-action@v3.2.0
with:
version: latest
# skip cache because of flaky behaviors
skip-build-cache: true
skip-pkg-cache: true
working-directory: ${{ matrix.workdir }}
args: --timeout 5m --issues-exit-code=0
# only-new-issues: true #show only new issues if it's a pull request. options working-directory and only-new-issues are incompatible
45 changes: 45 additions & 0 deletions .golangci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
run:
timeout: 10m
linters:
disable-all: true
enable:
- ineffassign
- typecheck
- varcheck
- unused
- structcheck
- deadcode
- gosimple
- goimports
- errcheck
- staticcheck
- stylecheck
- gosec
- asciicheck
- bodyclose
- exportloopref
- rowserrcheck
- makezero
- durationcheck
- prealloc
- predeclared

linters-settings:
staticcheck:
checks: ["S1002","S1004","S1007","S1009","S1010","S1012","S1019","S1020","S1021","S1024","S1030","SA2*","SA3*","SA4009","SA5*","SA6000","SA6001","SA6005", "-SA2002"]
stylecheck:
checks: ["-ST1003"]
gosec:
severity: "low"
confidence: "low"
excludes:
- G101
- G112
issues:
exclude-rules:
- path: _test\.go
linters:
- errcheck
- gosec
- rowserrcheck
- makezero

0 comments on commit 372cb17

Please sign in to comment.