coverage input selects the code coverage driver. setup-php supports xdebug, pcov, and none. Only one driver can be active at a time.
Xdebug
Specifycoverage: xdebug to enable Xdebug and disable PCOV. Xdebug runs on all PHP versions supported by setup-php.
coverage: xdebug is set, the latest Xdebug version compatible with the specified PHP version is installed automatically.
Xdebug 2.x for PHP 7.x
If you need Xdebug 2.x on PHP 7.2, 7.3, or 7.4, usecoverage: xdebug2:
PCOV
Specifycoverage: pcov to enable PCOV and disable Xdebug. PCOV requires PHP 7.1 or newer.
Custom source directory
By default, PCOV tracks coverage insrc, lib, and app directories. If your source code is in a different directory, set pcov.directory via ini-values:
PHPUnit compatibility
PHPUnit 8.x and above support PCOV out of the box. If you are using PHPUnit 5.x, 6.x, or 7.x, install thepcov/clobber package before running your tests:
Xdebug vs PCOV comparison
- Xdebug
- PCOV
Disabling coverage
Specifycoverage: none to disable both Xdebug and PCOV:
When to disable coverage
Disable coverage in the following situations:Not generating coverage reports
Not generating coverage reports
If your workflow runs tests without producing a coverage report, disable coverage to avoid the overhead of the driver being loaded on every request.
Using phpdbg
Using phpdbg
When running tests through
phpdbg, coverage drivers are not needed and may cause conflicts.Profiling with Blackfire
Profiling with Blackfire
Xdebug and PCOV conflict with Blackfire profiling. Always disable coverage when using Blackfire:
Using PHP in JIT mode
Using PHP in JIT mode
JIT conflicts with Xdebug, PCOV, and any extension that overrides
zend_execute_ex. You must set coverage: none when enabling JIT:Performance note
Xdebug is enabled by default on Ubuntu GitHub Actions images. Even when you do not specifycoverage: xdebug, the extension is already loaded and incurs a performance cost. For workflows that do not need coverage, explicitly set coverage: none to unload Xdebug and improve PHP execution speed.