提交 802542d7 编写于 作者: M Mislav Marohnić

Support floating point minimum coverage treshold

上级 ca5a340d
......@@ -9,7 +9,7 @@ while [ $# -gt 0 ]; do
case "$1" in
--coverage )
export HUB_COVERAGE="$PWD/tmp/cover.out"
if [ "$2" -gt 0 ] 2>/dev/null; then
if [ "${2%.*}" -gt 0 ] 2>/dev/null; then
min_coverage="$2"
shift 2
else
......@@ -39,7 +39,8 @@ script/ruby-test "$@" || STATUS="$?"
if [ -n "$HUB_COVERAGE" ]; then
total_coverage="$(script/coverage generate)"
echo "Code coverage: $total_coverage"
if [ "${total_coverage%.*}" -lt "$min_coverage" ]; then
result="$(bc <<<"${total_coverage%\%} < $min_coverage")"
if [ "$result" -eq 1 ]; then
echo "Error: coverage dropped below the minimum treshold of ${min_coverage}%!"
if [ -n "$CI" ]; then
html_result="${HUB_COVERAGE%.out}.html"
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册