This repository was archived by the owner on Oct 29, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +22
-6
lines changed
Expand file tree Collapse file tree 3 files changed +22
-6
lines changed Original file line number Diff line number Diff line change @@ -8,10 +8,17 @@ A Github Action which helps enforce a minimum code coverage threshold.
88
99** Required** The path to the ` lcov.info ` file.
1010
11+ ### ` min_coverage `
12+
13+ ** Required** The minimum coverage percentage allowed.
14+
15+ ** Default** 100
16+
1117## Example usage
1218
1319``` yaml
1420uses : ChicagoFlutter/lcov-cop@master
1521with :
16- path : ' ./coverage/lcov.info'
17- ` ` `
22+ path : " ./coverage/lcov.info"
23+ min_coverage : 95
24+ ` ` `
Original file line number Diff line number Diff line change 88 path :
99 description : ' lcov path'
1010 required : true
11+ min_coverage :
12+ description : ' minimum coverage percentage allowed' ,
13+ required : true
14+ default : 100
1115runs :
1216 using : ' docker'
1317 image : ' Dockerfile'
1418 args :
15- - ${{ inputs.path }}
19+ - ${{ inputs.path }}
20+ - ${{ inputs.min_coverage }}
Original file line number Diff line number Diff line change 11#! /bin/sh -l
22
33LCOV_PATH=$1
4+ MINIMUM_COVERAGE=$2
45
5- code_coverage =$( lcov --list ${LCOV_PATH} | sed -n " s/.*Total:|\(.*\)%.*/\1/p" )
6+ CODE_COVERAGE =$( lcov --list ${LCOV_PATH} | sed -n " s/.*Total:|\(.*\)%.*/\1/p" )
67
7- echo " Code Coverage: ${code_coverage} %"
8- if (( $(echo "$code_coverage < 100 " | bc) )) ; then exit 1; fi
8+ echo " Minumum Coverage: ${MINIMUM_COVERAGE} $"
9+ echo " Code Coverage: ${CODE_COVERAGE} %"
10+ if (( $(echo "$CODE_COVERAGE < $2 " | bc) )) ; then
11+ exit 1;
12+ fi
You can’t perform that action at this time.
0 commit comments