Skip to content

Commit

Permalink
Update Makefile (#478)
Browse files Browse the repository at this point in the history
  • Loading branch information
cubxxw committed Mar 27, 2024
1 parent 0d3afa4 commit 9d1043b
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,20 @@ test:
## cover: Run unit test with coverage.
.PHONY: cover
cover: test
@$(GO) test -cover
@echo "Running tests with coverage..."
@$(GO) test -coverprofile=coverage.out ./...
@echo "Checking coverage..."
@$(GO) tool cover -func=coverage.out | grep total: | awk '{print $$3}' | sed 's/%//g' | { \
read coverage; \
echo "Total coverage: $$coverage%"; \
minCoverage=75; \
if [ `echo "$$coverage < $$minCoverage" | bc` -eq 1 ]; then \
echo "Coverage ($$coverage%) is below the minimum required ($$minCoverage%). Failing."; \
exit 1; \
else \
echo "Coverage meets minimum requirement ($$minCoverage%)."; \
fi; \
}

## start: Start the chat all service.
.PHONY: start
Expand Down

0 comments on commit 9d1043b

Please sign in to comment.