Skip to content

Commit d1db433

Browse files
authored
support --coverage-filter flag (#60)
1 parent 8b81f7e commit d1db433

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@ The following configuration options are available:
6060
+ `group` Only runs tests from the specified group(s)
6161
+ `exclude_group` Exclude tests from the specified group(s)
6262
+ `test_suffix` Only search for test in files with specified suffix(es)
63-
+ `whitelist` Path to directory to whitelist for code coverage analysis
63+
+ `whitelist` Path to directory to whitelist for code coverage analysis (phpunit <= 8)
64+
+ `coverage_filter` Include directory in code coverage reporting (phpunit >= 9)
6465
+ `coverage_clover` Generate code coverage report in Clover XML format
6566
+ `coverage_cobertura` Generate code coverage report in Cobertura XML format
6667
required

action.yml

+5
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,10 @@ inputs:
7373
description: Path to directory to whitelist for code coverage analysis
7474
required: false
7575

76+
coverage_filter:
77+
description: Include directory in code coverage reporting
78+
required: false
79+
7680
coverage_clover:
7781
description: Generate code coverage report in Clover XML format
7882
required: false
@@ -126,6 +130,7 @@ runs:
126130
ACTION_TEST_SUFFIX: ${{ inputs.test_suffix }}
127131
ACTION_WHITELIST: ${{ inputs.whitelist }}
128132
ACTION_MEMORY_LIMIT: ${{ inputs.memory_limit }}
133+
ACTION_COVERAGE_FILTER: ${{ inputs.coverage_filter }}
129134
ACTION_COVERAGE_CLOVER: ${{ inputs.coverage_clover }}
130135
ACTION_COVERAGE_COBERTURA: ${{ inputs.coverage_cobertura }}
131136
ACTION_COVERAGE_CRAP4J: ${{ inputs.coverage_crap4j }}

phpunit-action.bash

+6
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,12 @@ then
8686
command_string+=(-d memory_limit="$ACTION_MEMORY_LIMIT")
8787
fi
8888

89+
if [ -n "$ACTION_COVERAGE_FILTER" ]
90+
then
91+
command_string+=(--coverage-filter "$ACTION_COVERAGE_FILTER")
92+
export XDEBUG_MODE=coverage
93+
fi
94+
8995
if [ -n "$ACTION_COVERAGE_CLOVER" ]
9096
then
9197
command_string+=(--coverage-clover "$ACTION_COVERAGE_CLOVER")

0 commit comments

Comments
 (0)