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 +21
-7
lines changed Expand file tree Collapse file tree 3 files changed +21
-7
lines changed Original file line number Diff line number Diff line change @@ -14,11 +14,16 @@ A Github Action which helps enforce a minimum code coverage threshold.
14
14
15
15
** Default** 100
16
16
17
+ ### ` exclude `
18
+
19
+ ** Optional** paths to exclude from coverage
20
+
17
21
## Example usage
18
22
19
23
``` yaml
20
24
uses : ChicagoFlutter/lcov-cop@master
21
25
with :
22
26
path : " ./coverage/lcov.info"
23
27
min_coverage : 95
28
+ exclude : " **/*.g.dart **/l10n/*.dart"
24
29
` ` `
Original file line number Diff line number Diff line change @@ -12,9 +12,13 @@ inputs:
12
12
description : ' minimum coverage percentage allowed'
13
13
required : true
14
14
default : 100
15
+ exclude :
16
+ description : ' paths to exclude from coverage'
17
+ required : false
15
18
runs :
16
19
using : ' docker'
17
20
image : ' Dockerfile'
18
21
args :
19
22
- ${{ inputs.path }}
20
- - ${{ inputs.min_coverage }}
23
+ - ${{ inputs.min_coverage }}
24
+ - ${{ inputs.exclude }}
Original file line number Diff line number Diff line change 4
4
5
5
LCOV_PATH=$1
6
6
MINIMUM_COVERAGE=$2
7
+ FILTERED_COVERAGE_PATH=' ./lcov_filtered.info'
7
8
8
- CODE_COVERAGE=$( lcov --list ${LCOV_PATH} | sed -n " s/.*Total:|\(.*\)%.*/\1/p" )
9
+ if [ ! -z " $3 " ]; then
10
+ echo " Excluding $3 from coverage..."
11
+ lcov --remove ${LCOV_PATH} $3 -o ${FILTERED_COVERAGE_PATH}
12
+ CODE_COVERAGE=$( lcov --list ${FILTERED_COVERAGE_PATH} | sed -n " s/.*Total:|\(.*\)%.*/\1/p" )
13
+ else
14
+ CODE_COVERAGE=$( lcov --list ${LCOV_PATH} | sed -n " s/.*Total:|\(.*\)%.*/\1/p" )
15
+ fi
9
16
10
- echo " Minumum Coverage: ${MINIMUM_COVERAGE} %"
11
- echo " Code Coverage: ${CODE_COVERAGE} %"
12
- if (( $(echo "$CODE_COVERAGE < $2 " | bc) )) ; then
13
- exit 1;
14
- fi
17
+ echo " Minumum Coverage Required: ${MINIMUM_COVERAGE} %"
18
+ echo " Current Code Coverage: ${CODE_COVERAGE} %"
19
+ if (( $(echo "$CODE_COVERAGE < $2 " | bc) )) ; then exit 1; fi
You can’t perform that action at this time.
0 commit comments