Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code coverage is tricky to set up and references deprecated flags #59

Open
shish opened this issue Feb 25, 2024 · 1 comment
Open

Code coverage is tricky to set up and references deprecated flags #59

shish opened this issue Feb 25, 2024 · 1 comment

Comments

@shish
Copy link
Contributor

shish commented Feb 25, 2024

It would be nice if just specifying coverage_* automatically did whatever it needed, so I try that

    - uses: php-actions/phpunit@v3
      with:
        version: 10
        php_version: ${{ matrix.php }}
        php_extensions: xdebug
        coverage_text: true
        bootstrap: vendor/autoload.php
        args: tests
1) XDEBUG_MODE=coverage or xdebug.mode=coverage has to be set

There are no instructions about how to set either of these flags, but by blind guessing I manage to figure it out:

    - uses: php-actions/phpunit@v3
      with:
        version: 10
        php_version: ${{ matrix.php }}
        php_extensions: xdebug
        coverage_text: true
        bootstrap: vendor/autoload.php
        args: tests
      env:
        XDEBUG_MODE: coverage
1) No filter is configured, code coverage will not be processed

Ok I need a filter -- The README mentions a whitelist parameter that seems to be what I want

    - uses: php-actions/phpunit@v3
      with:
        version: 10
        php_version: ${{ matrix.php }}
        php_extensions: xdebug
        coverage_text: true
        bootstrap: vendor/autoload.php
        whitelist: src
        args: tests
      env:
        XDEBUG_MODE: coverage
Unknown option "--whitelist"

Ok, looks like a few years ago whitelist was replaced with coverage-filter

    - uses: php-actions/phpunit@v3
      with:
        version: 10
        php_version: ${{ matrix.php }}
        php_extensions: xdebug
        coverage_text: true
        bootstrap: vendor/autoload.php
        coverage_filter: src
        args: tests
      env:
        XDEBUG_MODE: coverage
Warning: Unexpected input(s) 'coverage_filter', valid inputs are ['version', 'php_version', 'php_extensions', 'vendored_phpunit_path', 'configuration', 'log_junit', 'log_teamcity', 'testdox_html', 'testdox_text', 'memory_limit', 'bootstrap', 'filter', 'testsuite', 'group', 'exclude_group', 'test_suffix', 'whitelist', 'coverage_clover', 'coverage_cobertura', 'coverage_crap4j', 'coverage_html', 'coverage_php', 'coverage_text', 'coverage_xml', 'args']

Ok, so the action hasn't been updated to be compatible with the last few major releases, let's try args

    - uses: php-actions/phpunit@v3
      with:
        version: 10
        php_version: ${{ matrix.php }}
        php_extensions: xdebug
        coverage_text: true
        bootstrap: vendor/autoload.php
        args: --coverage-filter src tests
      env:
        XDEBUG_MODE: coverage

Success \o/

And now let's try using that coverage - The README mentions https://github.com/php-actions/code-coverage ... which is 404 ;(

@g105b
Copy link
Member

g105b commented Feb 26, 2024

Thank you for the issue report. I'll work on making this easier to set up and automating some of the steps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants