Update README.md

This commit is contained in:
Nuno Cruces
2023-01-26 01:11:09 +00:00
parent d88a19f7e8
commit 17b720a217
5 changed files with 24 additions and 24 deletions

15
.github/coverage.sh vendored Executable file
View File

@@ -0,0 +1,15 @@
#!/usr/bin/env bash
set -eo pipefail
cd -P -- "$(dirname -- "$0")"
go test ../... -coverprofile coverage.svg
COVERAGE=$(go tool cover -func=coverage.svg | grep total: | grep -Eo '[0-9]+\.[0-9]+')
echo $COVERAGE
COLOR=orange
if (( $(echo "$COVERAGE <= 50" | bc -l) )) ; then
COLOR=red
elif (( $(echo "$COVERAGE > 80" | bc -l) )); then
COLOR=green
fi
curl -s "https://img.shields.io/badge/coverage-$COVERAGE%25-$COLOR" > coverage.svg

1
.github/coverage.svg vendored Normal file
View File

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="108" height="20" role="img" aria-label="coverage: 50.6%"><title>coverage: 50.6%</title><linearGradient id="s" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><clipPath id="r"><rect width="108" height="20" rx="3" fill="#fff"/></clipPath><g clip-path="url(#r)"><rect width="61" height="20" fill="#555"/><rect x="61" width="47" height="20" fill="#fe7d37"/><rect width="108" height="20" fill="url(#s)"/></g><g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" text-rendering="geometricPrecision" font-size="110"><text aria-hidden="true" x="315" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="510">coverage</text><text x="315" y="140" transform="scale(.1)" fill="#fff" textLength="510">coverage</text><text aria-hidden="true" x="835" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="370">50.6%</text><text x="835" y="140" transform="scale(.1)" fill="#fff" textLength="370">50.6%</text></g></svg>

After

Width:  |  Height:  |  Size: 1.1 KiB