Makefile: add test and cover targets

This commit is contained in:
Roman Khimov 2021-04-30 18:58:26 +03:00
parent 12859c2e5d
commit ebd3ad8842
2 changed files with 13 additions and 1 deletions

3
.gitignore vendored
View file

@ -13,3 +13,6 @@ testfile
.neofs-cli.yml
.cache
coverage.txt
coverage.html

View file

@ -13,7 +13,7 @@ BINDIR = bin
DIRS = $(BINDIR)
BINS = "$(BINDIR)/neofs-http-gw"
.PHONY: help all dep clean fmts fmt imports test lint docker/lint
.PHONY: help all dep clean fmts fmt imports test cover lint docker/lint
# Make all binaries
all: $(BINS)
@ -43,6 +43,15 @@ dep:
GO111MODULE=on \
go mod tidy -v && echo OK
# Run tests
test:
@go test ./... -cover
# Run tests with race detection and produce coverage output
cover:
@go test -v -race ./... -coverprofile=coverage.txt -covermode=atomic
@go tool cover -html=coverage.txt -o coverage.html
# Run all code formatters
fmts: fmt imports