File tree 1 file changed +4
-8
lines changed
1 file changed +4
-8
lines changed Original file line number Diff line number Diff line change @@ -233,28 +233,24 @@ jobs:
233
233
if : steps.unit_tests.outcome == 'success' && env.coverage_ran == 'true'
234
234
id : check_coverage
235
235
run : |
236
- THRESHOLD=$(grep -oP '(?<=lines: )\d+' jest.config.js)
237
236
TARGET_COVERAGE=${{ inputs.target-coverage }}
238
237
echo "coverage_passed=false" >> $GITHUB_ENV
239
238
240
- if [ -z "$COVERAGE" ] || [ -z "$TARGET_COVERAGE" ] || [ -z "$THRESHOLD" ] ; then
239
+ if [ -z "$COVERAGE" ] || [ -z "$TARGET_COVERAGE" ]; then
241
240
echo "One of the coverage variables is unset. Please check the test outputs."
242
241
exit 1
243
242
fi
244
243
245
- if [ "$COVERAGE" -ge " $TARGET_COVERAGE" ] ; then
244
+ if (( $(echo "$COVERAGE >= $TARGET_COVERAGE" | bc -l) )) ; then
246
245
echo "Coverage is above or equal to the target of $TARGET_COVERAGE%. Test passes."
247
246
echo "coverage_passed=true" >> $GITHUB_ENV
248
- elif [ "$COVERAGE" -ge "$THRESHOLD" ]; then
249
- echo "Coverage is below $TARGET_COVERAGE% but meets or exceeds the current threshold. Test passes."
250
- echo "coverage_passed=true" >> $GITHUB_ENV
251
247
else
252
- echo "Coverage check failed! Coverage is below target ( $TARGET_COVERAGE%) and below the current threshold ($THRESHOLD) ."
248
+ echo "Coverage check failed! Coverage $COVERAGE% is below target $TARGET_COVERAGE%."
253
249
if [ "${{ env.IS_UNIT_TESTS_REQUIRED }}" == "true" ]; then
254
250
echo "Coverage has decreased below the threshold and tests are required to pass. Failing the build."
255
251
exit 1
256
252
else
257
- echo "Coverage has decreased below the threshold but tests are NOT required to pass"
253
+ echo "Coverage has decreased below the target coverage but tests are NOT required to pass"
258
254
exit 0
259
255
fi
260
256
fi
You can’t perform that action at this time.
0 commit comments