Skip to content

Commit

Permalink
Fix issues in coverage-cop action (#11)
Browse files Browse the repository at this point in the history
  • Loading branch information
aggarw13 authored Feb 15, 2021
1 parent 51bbab9 commit 7702e5b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ jobs:
uses: ./coverage-cop
with:
path: ./build/coverage.info
branch-min-coverage: 100
line-min-coverage: 99
branch-coverage-min: 70
line-coverage-min: 100
test-memory-statistics:
runs-on: ubuntu-latest
steps:
Expand Down
12 changes: 6 additions & 6 deletions coverage-cop/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ inputs:
path:
description: 'Path to lcov output file containing coverage data.'
required: true
branch-min-coverage:
branch-coverage-min:
description: 'The minumum required branch coverage (in %) for success'
required: false
default: 100
line-min-coverage:
line-coverage-min:
description: 'The minumum required line coverage (in %) for success'
required: false
default: 100
Expand All @@ -20,15 +20,15 @@ runs:
LINE_COVERAGE=$(lcov --list ${{ inputs.path }} | tail -n 1 | cut -d '|' -f 2 | sed -n "s/\([^%]*\)%.*/\1/p")
BRANCH_COVERAGE=$(lcov --rc lcov_branch_coverage=1 --list ${{ inputs.path }} | tail -n 1 | cut -d '|' -f 4 | sed -n "s/\([^%]*\)%.*/\1/p")
RESULT=0
echo "Required line coverage: ${{ inputs.line-min-coverage }}"
echo "Required line coverage: ${{ inputs.line-coverage-min }}"
echo "Line coverage: $LINE_COVERAGE"
if [[ $(echo "$LINE_COVERAGE < ${{ inputs.line-min-coverage }}" | bc) -ne 0 ]]; then
if [[ $(echo "$LINE_COVERAGE < ${{ inputs.line-coverage-min }}" | bc) -ne 0 ]]; then
echo "Line Coverage is too low."
RESULT=1
fi
echo "Required branch coverage: ${{ inputs.line-min-coverage }}"
echo "Required branch coverage: ${{ inputs.branch-coverage-min }}"
echo "Branch coverage: $BRANCH_COVERAGE"
if [[ $(echo "$BRANCH_COVERAGE < $${{ inputs.line-branch-coverage }}" | bc) -ne 0 ]]; then
if [[ $(echo "$BRANCH_COVERAGE < ${{ inputs.branch-coverage-min }}" | bc) -ne 0 ]]; then
echo "Branch Coverage is too low."
RESULT=1
fi
Expand Down

0 comments on commit 7702e5b

Please sign in to comment.