make: Ignore coverage for generator scripts

This commit is contained in:
Abhinav Gupta
2020-05-11 16:37:32 -07:00
parent 08f23f163e
commit 49e6584f11
2 changed files with 13 additions and 1 deletions

View File

@@ -13,6 +13,7 @@ coverage:
if_not_found: success # if parent is not found report status as success, error, or failure
if_ci_failed: error # if ci fails report status as success, error, or failure
# Also update COVER_IGNORE_PKGS in the Makefile.
ignore:
- /internal/gen-atomicint/
- /internal/gen-valuewrapper/

View File

@@ -7,6 +7,11 @@ GEN_VALUEWRAPPER = $(GOBIN)/gen-valuewrapper
GO_FILES ?= $(shell find . '(' -path .git -o -path vendor ')' -prune -o -name '*.go' -print)
# Also update ignore section in .codecov.yml.
COVER_IGNORE_PKGS = \
go.uber.org/atomic/internal/gen-atomicint \
go.uber.org/atomic/internal/gen-valuewrapper
.PHONY: build
build:
go build ./...
@@ -37,9 +42,15 @@ golint: $(GOLINT)
.PHONY: lint
lint: gofmt golint generatenodirty
# comma separated list of packages to consider for code coverage.
COVER_PKG = $(shell \
go list -find ./... | \
grep -v $(foreach pkg,$(COVER_IGNORE_PKGS),-e "^$(pkg)$$") | \
paste -sd, -)
.PHONY: cover
cover:
go test -coverprofile=cover.out -coverpkg ./... -v ./...
go test -coverprofile=cover.out -coverpkg $(COVER_PKG) -v ./...
go tool cover -html=cover.out -o cover.html
.PHONY: generate