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:
Brad Davidson 2025-12-12 22:44:21 +00:00 committed by Brad Davidson
parent 2d313a6f72
commit 900f6cfe8d
2 changed files with 70 additions and 1 deletions

63
.github/workflows/validate.yaml vendored Normal file
View 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"

View file

@ -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}