Use golangci-lint action

This commit is contained in:
Michael 2024-10-23 17:06:04 +02:00 committed by GitHub
parent 7edb9a2101
commit 3d2336bc83
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 23 additions and 11 deletions

View file

@ -12,6 +12,25 @@ env:
jobs: jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Go ${{ env.GO_VERSION }}
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
- name: golangci-lint
uses: golangci/golangci-lint-action@v6
with:
version: "${{ env.GOLANGCI_LINT_VERSION }}"
validate: validate:
runs-on: ubuntu-latest runs-on: ubuntu-latest
@ -26,9 +45,6 @@ jobs:
with: with:
go-version: ${{ env.GO_VERSION }} go-version: ${{ env.GO_VERSION }}
- name: Install golangci-lint ${{ env.GOLANGCI_LINT_VERSION }}
run: curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin ${GOLANGCI_LINT_VERSION}
- name: Install misspell ${{ env.MISSPELL_VERSION }} - name: Install misspell ${{ env.MISSPELL_VERSION }}
run: curl -sfL https://raw.githubusercontent.com/golangci/misspell/master/install-misspell.sh | sh -s -- -b $(go env GOPATH)/bin ${MISSPELL_VERSION} run: curl -sfL https://raw.githubusercontent.com/golangci/misspell/master/install-misspell.sh | sh -s -- -b $(go env GOPATH)/bin ${MISSPELL_VERSION}
@ -36,7 +52,7 @@ jobs:
run: touch webui/static/index.html run: touch webui/static/index.html
- name: Validate - name: Validate
run: make validate run: make validate-files
validate-generate: validate-generate:
runs-on: ubuntu-latest runs-on: ubuntu-latest

View file

@ -120,20 +120,16 @@ lint:
.PHONY: validate-files .PHONY: validate-files
#? validate-files: Validate code and docs #? validate-files: Validate code and docs
validate-files: lint validate-files:
$(foreach exec,$(LINT_EXECUTABLES),\ $(foreach exec,$(LINT_EXECUTABLES),\
$(if $(shell which $(exec)),,$(error "No $(exec) in PATH"))) $(if $(shell which $(exec)),,$(error "No $(exec) in PATH")))
$(CURDIR)/script/validate-vendor.sh
$(CURDIR)/script/validate-misspell.sh $(CURDIR)/script/validate-misspell.sh
$(CURDIR)/script/validate-shell-script.sh $(CURDIR)/script/validate-shell-script.sh
.PHONY: validate .PHONY: validate
#? validate: Validate code, docs, and vendor #? validate: Validate code, docs, and vendor
validate: lint validate: lint validate-files
$(foreach exec,$(EXECUTABLES),\
$(if $(shell which $(exec)),,$(error "No $(exec) in PATH")))
$(CURDIR)/script/validate-vendor.sh
$(CURDIR)/script/validate-misspell.sh
$(CURDIR)/script/validate-shell-script.sh
# Target for building images for multiple architectures. # Target for building images for multiple architectures.
.PHONY: multi-arch-image-% .PHONY: multi-arch-image-%