-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathMakefile
More file actions
33 lines (26 loc) · 833 Bytes
/
Makefile
File metadata and controls
33 lines (26 loc) · 833 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
SHELL := bash
.ONESHELL:
.SHELLFLAGS := -eu -o pipefail -c
.DELETE_ON_ERROR:
MAKEFLAGS += --warn-undefined-variables
MAKEFLAGS += --no-builtin-rules
GO ?= go
TEST := $(GO) test
TEST_FLAGS ?= -v
TEST_TARGET ?= .
GO111MODULE = on
PROJECT_NAME := $(shell basename $(PWD))
.PHONY: test coverage clean download
download: go.sum
go.sum: go.mod
$(GO) mod tidy
test: go.sum
$(TEST) $(TEST_FLAGS) -cover $(TEST_TARGET) -json | go tool tparse -all
coverage: go.sum clean
@mkdir ./_coverage
$(TEST) $(TEST_FLAGS) -covermode=count -args -test.gocoverdir="$(PWD)/_coverage" ./tests > /dev/null
$(TEST) $(TEST_FLAGS) -covermode=count -args -test.gocoverdir="$(PWD)/_coverage" $(TEST_TARGET) > /dev/null
$(GO) tool covdata percent -i=./_coverage/ -o $(PROJECT_NAME).coverprofile
clean:
@$(RM) -v *.coverprofile
@$(RM) -r ./_coverage