File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -21,6 +21,7 @@ concurrency:
2121 cancel-in-progress : true
2222
2323env :
24+ MIN_COVERAGE : 90
2425 PUB_ENVIRONMENT : bot.github
2526
2627jobs :
@@ -167,10 +168,26 @@ jobs:
167168 verbose : true
168169 - name : Check Code Coverage
169170 if : ${{ matrix.platform == 'vm' }}
170- uses : VeryGoodOpenSource/very_good_coverage@v3.0.0
171- with :
172- path : coverage/lcov.info
173- min_coverage : 90
171+ run : |
172+ set -euo pipefail
173+ awk -F: -v min="$MIN_COVERAGE" '
174+ /^LF:/ { total += $2 }
175+ /^LH:/ { hit += $2 }
176+ END {
177+ if (total == 0) {
178+ print "::error::No executable lines found in coverage/lcov.info"
179+ exit 1
180+ }
181+
182+ coverage = (hit / total) * 100
183+ printf("Line coverage: %.2f%% (%d/%d)\n", coverage, hit, total)
184+
185+ if (coverage < min) {
186+ printf("::error::Coverage %.2f%% is below %.2f%%\n", coverage, min)
187+ exit 1
188+ }
189+ }
190+ ' coverage/lcov.info
174191 - name : Upload coverage to Codacy
175192 if : ${{ matrix.platform == 'vm' }}
176193 continue-on-error : true
You can’t perform that action at this time.
0 commit comments