WordPress / two-factor

Two-Factor Authentication for WordPress.
https://wordpress.org/plugins/two-factor/
GNU General Public License v2.0
725 stars 151 forks source link

Fix Coveralls reporting #364

Open kasparsd opened 4 years ago

kasparsd commented 4 years ago

Currently the following error is generated when trying to upload the coverage report to Coveralls during the Travis run:

https://travis-ci.com/github/WordPress/two-factor/jobs/349903189

$ source "$DEV_LIB_PATH/travis.after_script.sh"
if can_generate_coverage_clover && [ -s "$TEMP_DIRECTORY/paths-scope-php" ] && [ -n "$INITIAL_DIR" ]; then
    cd "$INITIAL_DIR"
    # Coveralls 1.x.x path
    COVERALLS_BIN="vendor/bin/coveralls";
    # Coveralls 2.x.x path
    if [ ! -e "$COVERALLS_BIN" ]; then
        COVERALLS_BIN="vendor/bin/php-coveralls"
    fi
    php $COVERALLS_BIN -v
    cd - > /dev/null
fi
In Configurator.php line 165:

  [Symfony\Component\Config\Definition\Exception\InvalidConfigurationException]  
  coverage_clover XML file is not readable                                       

Exception trace:
  at /tmp/wordpress/src/wp-content/plugins/two-factor/vendor/php-coveralls/php-coveralls/src/Satooshi/Bundle/CoverallsV1Bundle/Config/Configurator.php:165
 Satooshi\Bundle\CoverallsV1Bundle\Config\Configurator->getGlobPaths() at /tmp/wordpress/src/wp-content/plugins/two-factor/vendor/php-coveralls/php-coveralls/src/Satooshi/Bundle/CoverallsV1Bundle/Config/Configurator.php:191
 Satooshi\Bundle\CoverallsV1Bundle\Config\Configurator->getGlobPathsFromStringOption() at /tmp/wordpress/src/wp-content/plugins/two-factor/vendor/php-coveralls/php-coveralls/src/Satooshi/Bundle/CoverallsV1Bundle/Config/Configurator.php:141
 Satooshi\Bundle\CoverallsV1Bundle\Config\Configurator->ensureCloverXmlPaths() at /tmp/wordpress/src/wp-content/plugins/two-factor/vendor/php-coveralls/php-coveralls/src/Satooshi/Bundle/CoverallsV1Bundle/Config/Configurator.php:119
 Satooshi\Bundle\CoverallsV1Bundle\Config\Configurator->createConfiguration() at /tmp/wordpress/src/wp-content/plugins/two-factor/vendor/php-coveralls/php-coveralls/src/Satooshi/Bundle/CoverallsV1Bundle/Config/Configurator.php:36
 Satooshi\Bundle\CoverallsV1Bundle\Config\Configurator->load() at /tmp/wordpress/src/wp-content/plugins/two-factor/vendor/php-coveralls/php-coveralls/src/Satooshi/Bundle/CoverallsV1Bundle/Command/CoverallsV1JobsCommand.php:149
 Satooshi\Bundle\CoverallsV1Bundle\Command\CoverallsV1JobsCommand->loadConfiguration() at /tmp/wordpress/src/wp-content/plugins/two-factor/vendor/php-coveralls/php-coveralls/src/Satooshi/Bundle/CoverallsV1Bundle/Command/CoverallsV1JobsCommand.php:118
 Satooshi\Bundle\CoverallsV1Bundle\Command\CoverallsV1JobsCommand->execute() at /tmp/wordpress/src/wp-content/plugins/two-factor/vendor/symfony/console/Command/Command.php:255
 Symfony\Component\Console\Command\Command->run() at /tmp/wordpress/src/wp-content/plugins/two-factor/vendor/symfony/console/Application.php:987
 Symfony\Component\Console\Application->doRunCommand() at /tmp/wordpress/src/wp-content/plugins/two-factor/vendor/symfony/console/Application.php:255
 Symfony\Component\Console\Application->doRun() at /tmp/wordpress/src/wp-content/plugins/two-factor/vendor/symfony/console/Application.php:148
 Symfony\Component\Console\Application->run() at /tmp/wordpress/src/wp-content/plugins/two-factor/vendor/php-coveralls/php-coveralls/bin/coveralls:22
coveralls:v1:jobs [-c|--config [CONFIG]] [--dry-run] [--exclude-no-stmt] [-e|--env [ENV]] [-x|--coverage_clover COVERAGE_CLOVER] [-o|--json_path JSON_PATH] [-r|--root_dir [ROOT_DIR]]
kasparsd commented 2 years ago

I attempted to enable coverage reporting but it turns out that the wp-env doesn't support Xdebug outside of the wordpress container, so phpunit, cli and other containers don't get Xdebug support when enabled via the flag. This is reported here https://github.com/WordPress/gutenberg/issues/42286

I've opened https://github.com/WordPress/wpdev-docker-images/issues/89 to potentially address this for all images automatically.