-
Notifications
You must be signed in to change notification settings - Fork 121
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add github actions to lint and test (#241)
Signed-off-by: Steve Coffman <steve@khanacademy.org> Signed-off-by: Steve Coffman <steve@khanacademy.org>
- Loading branch information
1 parent
eae2341
commit 372cb17
Showing
4 changed files
with
110 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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! | ||
--> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |