mirror of
https://github.com/k3s-io/k3s.git
synced 2025-12-18 23:06:14 -05:00
Add lint/validate job
`make validate` use to run in drone, move it into GHA Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
This commit is contained in:
parent
2d313a6f72
commit
900f6cfe8d
2 changed files with 70 additions and 1 deletions
63
.github/workflows/validate.yaml
vendored
Normal file
63
.github/workflows/validate.yaml
vendored
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
name: Validate
|
||||
on:
|
||||
pull_request:
|
||||
paths-ignore:
|
||||
- "**.md"
|
||||
- "channel.yaml"
|
||||
- "install.sh"
|
||||
- "tests/**"
|
||||
- "!tests/e2e**"
|
||||
- "!tests/docker**"
|
||||
- ".github/**"
|
||||
- "!.github/actions/**"
|
||||
- "!.github/workflows/validate.yaml"
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
validate:
|
||||
name: Validate
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v6
|
||||
with:
|
||||
fetch-depth: ${{ github.event.pull_request.commits }}
|
||||
|
||||
- name: Set Go Version
|
||||
run: |
|
||||
source ./scripts/version.sh
|
||||
{
|
||||
echo "GOTOOLCHAIN=${VERSION_GOLANG/go}"
|
||||
} >> "$GITHUB_ENV"
|
||||
|
||||
- name: Setup Go
|
||||
uses: actions/setup-go@v6
|
||||
with:
|
||||
go-version: "${{ env.GOTOOLCHAIN }}"
|
||||
|
||||
- name: Lint
|
||||
uses: golangci/golangci-lint-action@v9
|
||||
with:
|
||||
version: v2.7
|
||||
args: "--new-from-merge-base ${{ github.event.pull_request.base.sha }}"
|
||||
|
||||
- name: Lint (windows)
|
||||
uses: golangci/golangci-lint-action@v9
|
||||
with:
|
||||
version: v2.7
|
||||
args: "--new-from-merge-base ${{ github.event.pull_request.base.sha }} ./pkg/... ./cmd/..."
|
||||
env:
|
||||
GOOS: "windows"
|
||||
|
||||
- name: Validate
|
||||
run: ./scripts/validate
|
||||
env:
|
||||
SKIP_LINT: "true"
|
||||
|
||||
- name: Validate (windows)
|
||||
run: ./scripts/validate
|
||||
env:
|
||||
SKIP_LINT: "true"
|
||||
GOOS: "windows"
|
||||
|
|
@ -1,3 +1,6 @@
|
|||
issues:
|
||||
max-issues-per-linter: 1000
|
||||
max-same-issues: 100
|
||||
formatters:
|
||||
enable:
|
||||
- gofmt
|
||||
|
|
@ -18,20 +21,23 @@ linters:
|
|||
enable-all-rules: true
|
||||
rules:
|
||||
- {name: add-constant, disabled: true}
|
||||
- {name: argument-limit, disabled: true}
|
||||
- {name: cognitive-complexity, disabled: true}
|
||||
- {name: confusing-naming, disabled: true}
|
||||
- {name: confusing-results, disabled: true}
|
||||
- {name: cyclomatic, disabled: true}
|
||||
- {name: early-return, disabled: true}
|
||||
- {name: empty-block, disabled: true}
|
||||
- {name: enforce-switch-style, disabled: true}
|
||||
- {name: flag-parameter, disabled: true}
|
||||
- {name: function-length, disabled: true}
|
||||
- {name: function-result-limit, disabled: true}
|
||||
- {name: import-shadowing, disabled: true}
|
||||
- {name: line-length-limit, disabled: true}
|
||||
- {name: redundant-import-alias, disabled: true}
|
||||
- {name: max-control-nesting, disabled: true}
|
||||
- {name: max-public-structs, disabled: true}
|
||||
- {name: redundant-import-alias, disabled: true}
|
||||
- {name: unsecure-url-scheme, disabled: true}
|
||||
- {name: unused-parameter, disabled: true}
|
||||
- {name: unused-receiver, disabled: true}
|
||||
- {name: var-naming, disabled: true}
|
||||
|
|
|
|||
Loading…
Reference in a new issue