Skip to content

Add makefile entries for api-lint #1384

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions .github/workflows/kal.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,5 @@ jobs:
persist-credentials: false
- name: Set up Go
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # tag=v5.5.0
- name: Install Golang CI Lint
run: go install github.com/golangci/golangci-lint/v2/cmd/[email protected]
- name: Build KAL
run: golangci-lint custom
- name: run api linter
run: ./bin/golangci-kube-api-linter run -c ./.golangci-kal.yml ./...
- name: Run API Linter
run: make api-lint
15 changes: 14 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,9 @@ test-e2e: ## Run end-to-end tests against an existing Kubernetes cluster.
lint: golangci-lint ## Run golangci-lint linter
$(GOLANGCI_LINT) run --timeout 5m

.PHONY: api-lint
api-lint: golangci-lint ## Run golangci-kube-api-linter

.PHONY: lint-fix
lint-fix: golangci-lint ## Run golangci-lint linter and perform fixes
$(GOLANGCI_LINT) run --fix
Expand All @@ -160,8 +163,12 @@ lint-fix: golangci-lint ## Run golangci-lint linter and perform fixes
ci-lint: golangci-lint
$(GOLANGCI_LINT) run --timeout 15m0s

.PHONY: api-lint
api-lint: golangci-api-lint
$(GOLANGCI_API_LINT) run -c .golangci-kal.yml --timeout 15m0s ./...

.PHONY: verify
verify: vet fmt-verify generate ci-lint verify-all
verify: vet fmt-verify generate ci-lint api-lint verify-all
git --no-pager diff --exit-code config api client-go

.PHONY: verify-crds
Expand Down Expand Up @@ -365,6 +372,7 @@ KUSTOMIZE ?= $(LOCALBIN)/kustomize
CONTROLLER_GEN ?= $(LOCALBIN)/controller-gen
ENVTEST ?= $(LOCALBIN)/setup-envtest
GOLANGCI_LINT = $(LOCALBIN)/golangci-lint
GOLANGCI_API_LINT = $(LOCALBIN)/golangci-kube-api-linter
HELM = $(PROJECT_DIR)/bin/helm
YQ = $(PROJECT_DIR)/bin/yq
KUBECTL_VALIDATE = $(PROJECT_DIR)/bin/kubectl-validate
Expand Down Expand Up @@ -399,6 +407,11 @@ golangci-lint: $(GOLANGCI_LINT) ## Download golangci-lint locally if necessary.
$(GOLANGCI_LINT): $(LOCALBIN)
$(call go-install-tool,$(GOLANGCI_LINT),github.com/golangci/golangci-lint/v2/cmd/golangci-lint,$(GOLANGCI_LINT_VERSION))

.PHONY: golangci-api-lint
golangci-api-lint: golangci-lint $(GOLANGCI_API_LINT) ## Download golangci-lint locally if necessary before building KAL
$(GOLANGCI_API_LINT):
$(GOLANGCI_LINT) custom

.PHONY: yq
yq: ## Download yq locally if necessary.
GOBIN=$(PROJECT_DIR)/bin GO111MODULE=on go install github.com/mikefarah/yq/[email protected]
Expand Down