From 900f6cfe8d8be252fdaeac4a71a8e50dc279f166 Mon Sep 17 00:00:00 2001 From: Brad Davidson Date: Fri, 12 Dec 2025 22:44:21 +0000 Subject: [PATCH] Add lint/validate job `make validate` use to run in drone, move it into GHA Signed-off-by: Brad Davidson --- .github/workflows/validate.yaml | 63 +++++++++++++++++++++++++++++++++ .golangci.yml | 8 ++++- 2 files changed, 70 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/validate.yaml diff --git a/.github/workflows/validate.yaml b/.github/workflows/validate.yaml new file mode 100644 index 00000000000..9f537b83e93 --- /dev/null +++ b/.github/workflows/validate.yaml @@ -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" diff --git a/.golangci.yml b/.golangci.yml index c024faebc88..31f748c17ce 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -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}