forked from sosnovski/synch
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmakefile
More file actions
26 lines (18 loc) · 688 Bytes
/
makefile
File metadata and controls
26 lines (18 loc) · 688 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
#!/bin/sh
MIN_COV = 100
bin/: ; mkdir -p $@
bin/golangci-lint: | bin/
@GOBIN="$(realpath $(dir $@))" go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.64.6
.PHONY: lint
lint: | bin/golangci-lint ## Run code linters
@PATH="$(realpath bin):$$PATH" golangci-lint run
.PHONY: test
test:
go test ./... -v -race -cover -coverpkg=./... -coverprofile=cov.out
.PHONY: cov
cov:
@go tool cover -func cov.out | grep total | awk '{print substr($$3, 1, length($$3)-1)}'
.PHONY: check-cov
check-cov:
@$(eval COV:=$(shell make cov))
@echo $(shell echo ${COV}\>=${MIN_COV} | bc) | grep 1 > /dev/null || false | (echo 'current coverage ${COV} lower then ${MIN_COV}'; exit 1)