2019-11-15 19:25:21 +00:00
|
|
|
.PHONY: all
|
2019-10-11 00:20:42 +00:00
|
|
|
DOCKER_TAG ?= minitor-go-${USER}
|
|
|
|
|
2019-11-15 19:25:21 +00:00
|
|
|
.PHONY: default
|
2019-10-03 19:56:03 +00:00
|
|
|
default: test
|
|
|
|
|
|
|
|
.PHONY: build
|
|
|
|
build:
|
2019-10-07 21:58:21 +00:00
|
|
|
go build
|
2019-10-03 19:56:03 +00:00
|
|
|
|
|
|
|
minitor-go:
|
|
|
|
go build
|
|
|
|
|
|
|
|
.PHONY: run
|
2019-10-07 21:58:21 +00:00
|
|
|
run: minitor-go build
|
2019-11-16 01:36:10 +00:00
|
|
|
./minitor-go -debug
|
|
|
|
|
|
|
|
.PHONY: run-metrics
|
|
|
|
run-metrics: minitor-go build
|
2019-11-15 19:25:21 +00:00
|
|
|
./minitor-go -debug -metrics
|
2019-10-03 19:56:03 +00:00
|
|
|
|
|
|
|
.PHONY: test
|
|
|
|
test:
|
|
|
|
go test -coverprofile=coverage.out
|
2019-10-07 21:58:21 +00:00
|
|
|
@echo
|
2019-10-03 19:56:03 +00:00
|
|
|
go tool cover -func=coverage.out
|
2019-10-07 21:58:21 +00:00
|
|
|
@echo
|
|
|
|
@# Check min coverage percentage
|
|
|
|
@go tool cover -func=coverage.out | awk -v target=80.0% \
|
|
|
|
'/^total:/ { print "Total coverage: " $$3 " Minimum coverage: " target; if ($$3+0.0 >= target+0.0) print "ok"; else { print "fail"; exit 1; } }'
|
|
|
|
|
2019-11-21 23:30:19 +00:00
|
|
|
# Installs pre-commit hooks
|
|
|
|
.PHONY: install-hooks
|
|
|
|
install-hooks:
|
|
|
|
pre-commit install --install-hooks
|
|
|
|
|
|
|
|
# Checks files for encryption
|
|
|
|
.PHONY: check
|
|
|
|
check:
|
|
|
|
pre-commit run --all-files
|
|
|
|
|
2019-10-03 19:56:03 +00:00
|
|
|
.PHONY: clean
|
|
|
|
clean:
|
|
|
|
rm -f ./minitor-go
|
|
|
|
rm -f ./coverage.out
|
2019-10-11 00:20:42 +00:00
|
|
|
|
|
|
|
.PHONY: docker-build
|
|
|
|
docker-build:
|
|
|
|
docker build -f ./Dockerfile.multi-stage -t $(DOCKER_TAG) .
|
|
|
|
|
|
|
|
.PHONY: docker-run
|
|
|
|
docker-run: docker-build
|
|
|
|
docker run --rm -v $(shell pwd)/config.yml:/root/config.yml $(DOCKER_TAG)
|