Skip to content

Commit 0c2c2b8

Browse files
author
Guy Steinberger
committed
Add COVERAGE_THRESHOLD_DELTA
1 parent 07a2d02 commit 0c2c2b8

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

.github/workflows/ci.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,8 +244,15 @@ jobs:
244244
body: output
245245
})
246246
247+
- name: Calculate minimum required coverage with tolerance
248+
run: |
249+
STMT_COVERAGE=${{ steps.set-stmts-coverage.outputs.STMTS_COVERAGE }}
250+
THRESHOLD_DELTA=${{ vars.COVERAGE_THRESHOLD_DELTA }}
251+
MIN_REQUIRED=$(echo "$STMT_COVERAGE + $THRESHOLD_DELTA" | bc)
252+
echo "MIN_REQUIRED_COVERAGE=$MIN_REQUIRED" >> $GITHUB_ENV
253+
247254
- name: Fail PR if current code coverage percentage is higher than the new one
248-
if: ${{ (fromJson(steps.set-stmts-coverage.outputs.STMTS_COVERAGE) < fromJson(steps.set-current-coverage.outputs.CURRENT_COVERAGE)) && (vars.CODE_COVERAGE_ENFORCEMENT == 'true') }}
255+
if: ${{ (fromJson(env.MIN_REQUIRED_COVERAGE) < fromJson(steps.set-current-coverage.outputs.CURRENT_COVERAGE)) && (vars.CODE_COVERAGE_ENFORCEMENT == 'true') }}
249256
run: exit 1
250257

251258
- name: Update service code coverage percentage in Port

0 commit comments

Comments
 (0)