Skip to content

Commit

Permalink
coverage: add make target
Browse files Browse the repository at this point in the history
Signed-off-by: Daniel Hiller <[email protected]>
  • Loading branch information
dhiller committed Dec 13, 2024
1 parent 4471b16 commit b62b0e6
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,21 @@
.PHONY: generate validate-sigs install-metrics-binaries lint
.PHONY: make-artifacts-dir generate validate-sigs test coverage install-metrics-binaries lint

export GOLANGCI_LINT_VERSION := v1.62.2
ifndef $(GOPATH)
ifndef GOPATH
GOPATH=$(shell go env GOPATH)
export GOPATH
endif
ifndef ARTIFACTS
ARTIFACTS=/tmp/artifacts
export ARTIFACTS
endif
ifndef COVERAGE_OUTPUT_PATH
COVERAGE_OUTPUT_PATH=${ARTIFACTS}/coverage.html
export COVERAGE_OUTPUT_PATH
endif

make-artifacts-dir:
mkdir -p ${ARTIFACTS}

generate:
go run ./validators/cmd/sigs --dry-run=false
Expand All @@ -16,6 +27,11 @@ validate-sigs:
test:
go test ./...

coverage: make-artifacts-dir
if ! command -V covreport; then go install github.com/cancue/covreport@latest; fi
go test ./... -coverprofile=/tmp/coverage.out
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

Expand Down

0 comments on commit b62b0e6

Please sign in to comment.