Skip to content

Instantly share code, notes, and snippets.

@strategicpause
Created November 16, 2022 16:41
Show Gist options
  • Save strategicpause/9e430375f0c47cdbf5a53934621bd131 to your computer and use it in GitHub Desktop.
Save strategicpause/9e430375f0c47cdbf5a53934621bd131 to your computer and use it in GitHub Desktop.
TEST_COVERAGE_THRESHOLD=90.0
coverage:
@TEST_COVERAGE=$(shell go test -coverpkg ./... | grep coverage | grep -Eo '[0-9]+\.[0-9]+'); \
if (( $(echo "$$TEST_COVERAGE $(TEST_COVERAGE_THRESHOLD)" | awk '{print ($1 > $2)}') )); then \
exit 0; \
else \
echo "Current test coverage $$TEST_COVERAGE is below threshold of $(TEST_COVERAGE_THRESHOLD)."; \
exit 1; \
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment