-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build: add linting action before publishing
- Loading branch information
1 parent
7c6d8eb
commit 4c0c74d
Showing
2 changed files
with
115 additions
and
6 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 |
---|---|---|
@@ -1,10 +1,23 @@ | ||
name: Test and publish | ||
|
||
on: | ||
push: | ||
branches: ['main'] | ||
on: [push, pull_request] | ||
|
||
jobs: | ||
lint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-go@v2 | ||
with: | ||
go-version: 1.17 | ||
stable: true | ||
|
||
- name: Install golangci-lint | ||
uses: golangci/[email protected] | ||
with: | ||
version: v1.43.0 | ||
skip-go-installation: true | ||
|
||
test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
|
@@ -14,7 +27,8 @@ jobs: | |
go-version: 1.17 | ||
stable: true | ||
|
||
- run: | | ||
- name: Download K8s envtest - local K8s cluster control plane | ||
run: | | ||
go install sigs.k8s.io/controller-runtime/tools/setup-envtest@latest | ||
mkdir -p local/envtest-bin/ | ||
setup-envtest use -p env 1.21.x --bin-dir local/envtest-bin > local/envtest-bin/env | ||
|
@@ -35,7 +49,7 @@ jobs: | |
release-tagged: | ||
if: "startsWith(github.ref, 'refs/tags/v')" | ||
needs: | ||
# - lint | ||
- lint | ||
- test | ||
runs-on: ubuntu-latest | ||
steps: | ||
|
@@ -60,7 +74,7 @@ jobs: | |
release-untagged: | ||
if: "!startsWith(github.ref, 'refs/tags/v')" | ||
needs: | ||
# - lint | ||
- lint | ||
- test | ||
runs-on: ubuntu-latest | ||
steps: | ||
|
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,95 @@ | ||
--- | ||
run: | ||
tests: false | ||
skip-dirs: | ||
- .github | ||
- build | ||
- web | ||
- .go | ||
linters-settings: | ||
dupl: | ||
threshold: 100 | ||
funlen: | ||
lines: 100 | ||
statements: 50 | ||
goconst: | ||
min-len: 2 | ||
min-occurrences: 2 | ||
gocritic: | ||
enabled-tags: | ||
- diagnostic | ||
- experimental | ||
- opinionated | ||
- performance | ||
- style | ||
disabled-checks: | ||
- whyNoLint | ||
- hugeParam | ||
gocyclo: | ||
min-complexity: 15 | ||
revive: | ||
min-confidence: 0.8 | ||
govet: | ||
check-shadowing: true | ||
lll: | ||
line-length: 140 | ||
misspell: | ||
locale: US | ||
nolintlint: | ||
allow-leading-space: false | ||
require-explanation: true | ||
allow-no-explanation: | ||
- gocognit | ||
- funlen | ||
- gocyclo | ||
|
||
linters: | ||
disable-all: true | ||
enable: | ||
- bodyclose | ||
- deadcode | ||
- depguard | ||
- dogsled | ||
- dupl | ||
- errcheck | ||
- funlen | ||
- nolintlint | ||
- gochecknoglobals | ||
- gochecknoinits | ||
- gocognit | ||
- goconst | ||
- gocritic | ||
- gocyclo | ||
- gofmt | ||
- goimports | ||
- revive | ||
- goprintffuncname | ||
- gosec | ||
- gosimple | ||
- govet | ||
- ineffassign | ||
- misspell | ||
- nakedret | ||
- prealloc | ||
- rowserrcheck | ||
- exportloopref | ||
- staticcheck | ||
- structcheck | ||
- stylecheck | ||
- typecheck | ||
- unconvert | ||
- unparam | ||
- unused | ||
- varcheck | ||
- whitespace | ||
- wsl | ||
|
||
issues: | ||
exclude: | ||
# Very commonly not checked. | ||
- 'Error return value of .(l.Sync|.*Close|.*.Write|.*Flush|os\.Remove(All)?|os\.(Un)?Setenv). is not checked' | ||
- 'G104:.*' | ||
- 'exported method (.*\.MarshalJSON|.*\.UnmarshalJSON) should have comment or be unexported' | ||
- 'shadow: declaration of "err" shadows declaration.*' | ||
max-same-issues: 0 | ||
exclude-use-default: false |