ci: use awk to parse coverage percentage

This commit is contained in:
Cinco Euzebio 2026-02-28 21:38:28 -03:00
parent b6e33c37ac
commit ef13e884ba

View File

@ -24,7 +24,9 @@ steps:
commands: commands:
- apt-get update -qq && apt-get install -y -qq jq curl - apt-get update -qq && apt-get install -y -qq jq curl
- | - |
PCT=$(cargo tarpaulin 2>&1 | grep -oE '[0-9]+\.[0-9]+% coverage' | cut -d'.' -f1) PCT=$(cargo tarpaulin 2>&1 | awk '/coverage,/{print int($1)}')
echo "PCT=$PCT"
[ -z "$PCT" ] && PCT=0
if [ "$PCT" -ge 80 ]; then COLOR="brightgreen" if [ "$PCT" -ge 80 ]; then COLOR="brightgreen"
elif [ "$PCT" -ge 60 ]; then COLOR="yellow" elif [ "$PCT" -ge 60 ]; then COLOR="yellow"
else COLOR="red"; fi else COLOR="red"; fi