mirror of https://github.com/grafana/loki
Introduce coverage to PR pipelines (#5357)
* Add code coverage diff to CI * remove test package from coverage diff * review feedback * lint * Env variable test * faster experiment * drone vars * drone vars * how does the shell work? * add pr comment * escape json * report diff in comment * properly format json * quote post body * review feedback * add querier/queryrange to coveragepull/6097/head
parent
1389857846
commit
d97724e8dd
@ -0,0 +1,18 @@ |
||||
#!/bin/bash |
||||
|
||||
if [[ ! -f "$1" ]] || [[ ! -f "$2" ]]; then |
||||
echo "unable to compare test coverage: both old and new files must exist" |
||||
exit 0 |
||||
fi |
||||
|
||||
echo '```diff' |
||||
for pkg in ${3//,/ }; do |
||||
old=$(grep "pkg/${pkg}\s" "$1" | sed s/%// | awk '{print $5}') |
||||
new=$(grep "pkg/${pkg}\s" "$2" | sed s/%// | awk '{print $5}') |
||||
echo | awk -v pkg="${pkg}" -v old="${old:-0}" -v new="${new:-0}" \ |
||||
'{ |
||||
sign=new - old < 0 ? "-" : "+" |
||||
printf ("%s %11s\t%s\n", sign, pkg, new - old) |
||||
}' |
||||
done |
||||
echo '```' |
Loading…
Reference in new issue