Add support for pcov code coverage driver

This commit is contained in:
Alec Joy 2019-08-04 14:07:05 -04:00
parent 8254c34647
commit b2de93cc1b
5 changed files with 65 additions and 0 deletions

View File

@ -299,6 +299,29 @@ For information on how to configure xDebug with your IDE and work it out, check
<br>
<a name="Install-pcov"></a>
## Install pcov
1 - First install `pcov` in the Workspace and the PHP-FPM Containers:
<br>
a) open the `.env` file
<br>
b) search for the `WORKSPACE_INSTALL_PCOV` argument under the Workspace Container
<br>
c) set it to `true`
<br>
d) search for the `PHP_FPM_INSTALL_PCOV` argument under the PHP-FPM Container
<br>
e) set it to `true`
2 - Re-build the containers `docker-compose build workspace php-fpm`
Note that pcov is only supported on PHP 7.1 or newer. For more information on setting up pcov optimally, check the recommended section
of the [README](https://github.com/krakjoe/pcov)
<br>
<a name="Control-xDebug"></a>
## Start/Stop xDebug:

View File

@ -59,6 +59,7 @@ services:
- LARADOCK_PHALCON_VERSION=${PHALCON_VERSION}
- INSTALL_SUBVERSION=${WORKSPACE_INSTALL_SUBVERSION}
- INSTALL_XDEBUG=${WORKSPACE_INSTALL_XDEBUG}
- INSTALL_PCOV=${WORKSPACE_INSTALL_PCOV}
- INSTALL_PHPDBG=${WORKSPACE_INSTALL_PHPDBG}
- INSTALL_BLACKFIRE=${INSTALL_BLACKFIRE}
- INSTALL_SSH2=${WORKSPACE_INSTALL_SSH2}
@ -148,6 +149,7 @@ services:
- LARADOCK_PHP_VERSION=${PHP_VERSION}
- LARADOCK_PHALCON_VERSION=${PHALCON_VERSION}
- INSTALL_XDEBUG=${PHP_FPM_INSTALL_XDEBUG}
- INSTALL_PCOV=${PHP_FPM_INSTALL_PCOV}
- INSTALL_PHPDBG=${PHP_FPM_INSTALL_PHPDBG}
- INSTALL_BLACKFIRE=${INSTALL_BLACKFIRE}
- INSTALL_SSH2=${PHP_FPM_INSTALL_SSH2}

View File

@ -97,6 +97,7 @@ WORKSPACE_INSTALL_PHPREDIS=true
WORKSPACE_INSTALL_WORKSPACE_SSH=false
WORKSPACE_INSTALL_SUBVERSION=false
WORKSPACE_INSTALL_XDEBUG=false
WORKSPACE_INSTALL_PCOV=true
WORKSPACE_INSTALL_PHPDBG=false
WORKSPACE_INSTALL_SSH2=false
WORKSPACE_INSTALL_LDAP=false
@ -157,6 +158,7 @@ PHP_FPM_INSTALL_IMAGE_OPTIMIZERS=true
PHP_FPM_INSTALL_PHPREDIS=true
PHP_FPM_INSTALL_MEMCACHED=false
PHP_FPM_INSTALL_XDEBUG=false
PHP_FPM_INSTALL_PCOV=false
PHP_FPM_INSTALL_XHPROF=false
PHP_FPM_INSTALL_PHPDBG=false
PHP_FPM_INSTALL_IMAP=false

View File

@ -164,6 +164,25 @@ RUN sed -i "s/xdebug.remote_autostart=0/xdebug.remote_autostart=1/" /usr/local/e
sed -i "s/xdebug.remote_enable=0/xdebug.remote_enable=1/" /usr/local/etc/php/conf.d/xdebug.ini && \
sed -i "s/xdebug.cli_color=0/xdebug.cli_color=1/" /usr/local/etc/php/conf.d/xdebug.ini
###########################################################################
# pcov:
###########################################################################
USER root
ARG INSTALL_PCOV=false
RUN if [ ${INSTALL_PCOV} = true ]; then \
if [ $(php -r "echo PHP_MAJOR_VERSION;") = "7" ]; then \
if [ $(php -r "echo PHP_MAJOR_VERSION;") != "0" ]; then \
pecl install pcov && \
echo "extension=pcov.so" >> /etc/php/${LARADOCK_PHP_VERSION}/cli/php.ini && \
echo "pcov.enabled" >> /etc/php/${LARADOCK_PHP_VERSION}/cli/php.ini \
;fi \
;fi \
;fi
###########################################################################
# Phpdbg:
###########################################################################

View File

@ -324,6 +324,25 @@ RUN sed -i "s/xdebug.remote_autostart=0/xdebug.remote_autostart=1/" /etc/php/${L
sed -i "s/xdebug.remote_enable=0/xdebug.remote_enable=1/" /etc/php/${LARADOCK_PHP_VERSION}/cli/conf.d/xdebug.ini && \
sed -i "s/xdebug.cli_color=0/xdebug.cli_color=1/" /etc/php/${LARADOCK_PHP_VERSION}/cli/conf.d/xdebug.ini
###########################################################################
# pcov:
###########################################################################
USER root
ARG INSTALL_PCOV=false
RUN if [ ${INSTALL_PCOV} = true ]; then \
if [ $(php -r "echo PHP_MAJOR_VERSION;") = "7" ]; then \
if [ $(php -r "echo PHP_MAJOR_VERSION;") != "0" ]; then \
pecl install pcov && \
echo "extension=pcov.so" >> /etc/php/${LARADOCK_PHP_VERSION}/cli/php.ini && \
echo "pcov.enabled" >> /etc/php/${LARADOCK_PHP_VERSION}/cli/php.ini \
;fi \
;fi \
;fi
###########################################################################
# Phpdbg:
###########################################################################