diff --git a/.golangci.yaml b/.golangci.yaml index 6b266392..3f2196cf 100644 --- a/.golangci.yaml +++ b/.golangci.yaml @@ -3,4 +3,4 @@ linters: - gocyclo linters-settings: gocyclo: - min-complexity: 10 \ No newline at end of file + min-complexity: 10 diff --git a/Makefile b/Makefile index dad0935b..a67d7804 100644 --- a/Makefile +++ b/Makefile @@ -1,21 +1,23 @@ -.PHONY: make-artifacts-dir generate validate-sigs test coverage install-metrics-binaries lint +.PHONY: generate validate-sigs test coverage lint export GOLANGCI_LINT_VERSION := v1.62.2 ifndef GOPATH GOPATH=$(shell go env GOPATH) export GOPATH endif +WORKDIR := /tmp +LOCAL_BIN := $(WORKDIR)/local_bin +PATH := $(LOCAL_BIN):${PATH} ifndef ARTIFACTS - ARTIFACTS=/tmp/artifacts - export ARTIFACTS + export ARTIFACTS := $(WORKDIR)/artifacts endif ifndef COVERAGE_OUTPUT_PATH - COVERAGE_OUTPUT_PATH=${ARTIFACTS}/coverage.html - export COVERAGE_OUTPUT_PATH + COVERAGE_OUTPUT_PATH := ${ARTIFACTS}/coverage.html endif -make-artifacts-dir: +work-dirs: mkdir -p ${ARTIFACTS} + mkdir -p ${LOCAL_BIN} generate: go run ./validators/cmd/sigs --dry-run=false @@ -28,13 +30,11 @@ validate-sigs: test: go test ./... -coverage: make-artifacts-dir - if ! command -V covreport; then go install github.com/cancue/covreport@latest; fi +coverage: work-dirs + if ! command -V covreport; then GOBIN=$(LOCAL_BIN) go install github.com/cancue/covreport@latest; fi go test ./... -coverprofile=/tmp/coverage.out - covreport -i /tmp/coverage.out -o ${COVERAGE_OUTPUT_PATH} + covreport -i /tmp/coverage.out -o $(COVERAGE_OUTPUT_PATH) -install-metrics-binaries: - if ! command -V golangci-lint; then curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b ${GOPATH}/bin ${GOLANGCI_LINT_VERSION} ; fi - -lint: install-metrics-binaries +lint: work-dirs + if ! command -V golangci-lint; then curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b "${LOCAL_BIN}" ${GOLANGCI_LINT_VERSION} ; fi golangci-lint run --verbose