28 lines
638 B
Makefile
28 lines
638 B
Makefile
|
GOFILES = *.go go.mod
|
||
|
|
||
|
# Default make target will run tests
|
||
|
.DEFAULT_GOAL = test
|
||
|
|
||
|
# Run all tests
|
||
|
.PHONY: test
|
||
|
test:
|
||
|
go test -coverprofile=coverage.out
|
||
|
go tool cover -func=coverage.out
|
||
|
@go tool cover -func=coverage.out | awk -v target=50.0% \
|
||
|
'/^total:/ { print "Total coverage: " $$3 " Minimum coverage: " target; if ($$3+0.0 >= target+0.0) print "ok"; else { print "fail"; exit 1; } }'
|
||
|
|
||
|
# Installs pre-commit hooks
|
||
|
.PHONY: install-hooks
|
||
|
install-hooks:
|
||
|
pre-commit install --install-hooks
|
||
|
|
||
|
# Runs pre-commit checks on files
|
||
|
.PHONY: check
|
||
|
check:
|
||
|
pre-commit run --all-files
|
||
|
|
||
|
.PHONY: clean
|
||
|
clean:
|
||
|
rm -f ./coverage.out
|
||
|
rm -fr ./dist
|