diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 91763ba..808f0b4 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -7,13 +7,20 @@ jobs: runs-on: ubuntu-latest steps: - - name: Set up Go 1.21 + - name: Set up Go 1.23 uses: actions/setup-go@v4 with: - go-version: "1.21" + go-version: "1.23" - uses: actions/checkout@v3 + - name: Set up golangci-lint + uses: golangci/golangci-lint-action@v6 + with: + version: v1.60.3 + args: -v --timeout 5m + skip-cache: true + - name: Run go generate run: | set -x @@ -22,15 +29,13 @@ jobs: git diff | cat git status --porcelain=v1 test $(git status --porcelain=v1 | wc -l) -eq 0 - env: - GO111MODULE: on build: name: Run tests runs-on: ubuntu-latest strategy: matrix: - go: [ '1.21' ] + go: [ '1.23' ] steps: - uses: actions/checkout@v3 @@ -40,5 +45,12 @@ jobs: with: go-version: ${{ matrix.go }} + - name: Set up golangci-lint + uses: golangci/golangci-lint-action@v6 + with: + version: v1.60.3 + args: -v --timeout 5m + skip-cache: true + - name: Run unit tests run: make test diff --git a/.golangci.yml b/.golangci.yml new file mode 100644 index 0000000..7ee91ef --- /dev/null +++ b/.golangci.yml @@ -0,0 +1,20 @@ +run: + timeout: 10m + +linters: + enable: + - contextcheck + - gocritic + - gofmt + - goimports + - gosec + - gosimple + - govet + - ineffassign + - misspell + - staticcheck + - unconvert + +linters-settings: + goimports: + local-prefixes: github.com/mittwald/go-helm-client diff --git a/Makefile b/Makefile index 0df8b05..9f830ed 100644 --- a/Makefile +++ b/Makefile @@ -19,22 +19,18 @@ help: ## Display this help. @awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m\033[0m\n"} /^[a-zA-Z_0-9-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST) -.PHONY: fmt -fmt: ## Run go fmt against code. - go fmt ./... - -.PHONY: vet -vet: ## Run go vet against code. - go vet ./... +.PHONY: lint +lint: ## Run golangci-lint against code. + golangci-lint run ./... ##@ Build .PHONY: build -build: generate fmt vet ## Build binary. +build: generate lint ## Build binary. go build -o bin/client . .PHONY: test -test: generate fmt vet ## Run tests. +test: generate lint ## Run tests. go test ./... -coverprofile cover.out .PHONY: generate @@ -55,7 +51,7 @@ CONTROLLER_GEN ?= $(LOCALBIN)/controller-gen ## Tool Versions MOCKGEN_VERSION ?= v0.4.0 -CONTROLLER_TOOLS_VERSION ?= v0.13.0 +CONTROLLER_TOOLS_VERSION ?= v0.16.1 .PHONY: mockgen mockgen: $(MOCKGEN) ## Download mockgen locally if necessary. diff --git a/client.go b/client.go index ffb1b1b..a76ab28 100644 --- a/client.go +++ b/client.go @@ -793,7 +793,7 @@ func (c *HelmClient) RunChartTests(releaseName string) (bool, error) { } // Check that there are no test failures - return checkReleaseForTestFailure(rel) == false, nil + return !checkReleaseForTestFailure(rel), nil } // chartExists checks whether a chart is already installed