Skip to content

AWS CodeBuild not recognize Clover XML format report #828

@IgorDePaula

Description

@IgorDePaula
Q A
PHPUnit version 9.4.2
PHP version 7.4.2
Installation Method Composer

Summary

I tried codecoverage in clover format to aws codebuild, but its said that file has a bug, and not recognize the clover format. I not found none issue related with problem.

Current behavior

I tried codecoverage in clover format to aws codebuild, but its said that file has a bug, and not recognize the clover format.

How to reproduce

Create a simple project with a simple test. Upload to github, make a project with codebuild, and aws pipeline.

phpunit.xml

<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:noNamespaceSchemaLocation="./vendor/phpunit/phpunit/phpunit.xsd"
         bootstrap="vendor/autoload.php"
         colors="true"
>
    <testsuites>
        <testsuite name="Unit">
            <directory suffix="Test.php">./tests</directory>
        </testsuite>
    </testsuites>
    <coverage includeUncoveredFiles="true" processUncoveredFiles="true">
        <include>
            <directory suffix=".php">./</directory>
        </include>
        <exclude>
            <directory suffix=".php">vendor/</directory>
            <directory suffix=".php">tests/</directory>
        </exclude>
        <report>
            <clover outputFile="build/logs/clover.xml"/>
        </report>
    </coverage>
    <logging>
        <junit outputFile="build/reports.xml"/>
    </logging>
    <php>
        <server name="APP_ENV" value="testing"/>
        <server name="BCRYPT_ROUNDS" value="4"/>
        <server name="CACHE_DRIVER" value="array"/>
        <!-- <server name="DB_DATABASE" value=":memory:"/> -->
        <server name="MAIL_MAILER" value="array"/>
        <server name="QUEUE_CONNECTION" value="sync"/>
        <server name="SESSION_DRIVER" value="array"/>
        <server name="TELESCOPE_ENABLED" value="false"/>
    </php>
</phpunit>

buildspec.yml

version: 0.2
phases:
  install:
    runtime-versions:
       php: "7.3"
      # name: version
    commands:
       - apt-get update
       - apt-get install php-xdebug -y
  pre_build:
    commands:
       - composer install
  build:
    commands:
       - ./vendor/bin/phpunit --coverage-clover clover.xml
reports:
  test-report:
    files:
      - build/reports.xml
    file-format: JunitXml
  #clover-report:
  #  files:
  #   - clover.xml
  #  file-format: CloverXml
artifacts:
  files:
     - "**/*"
  name: codebuild-php
  discard-paths: yes
  #base-directory: coverage
cache:
  paths:
     - vendor/

Output

[Container] 2020/11/04 19:40:02 Running command ./vendor/bin/phpunit --coverage-clover clover.xml
PHPUnit 9.4.2 by Sebastian Bergmann and contributors.

.                                                                   1 / 1 (100%)
Time: 00:00.113, Memory: 12.00 MB
OK (1 test, 1 assertion)
Generating code coverage report in Clover XML format ... done [00:00.002]
[Container] 2020/11/04 19:40:02 Phase complete: BUILD State: SUCCEEDED
[Container] 2020/11/04 19:40:02 Phase context status code:  Message: 
[Container] 2020/11/04 19:40:02 Entering phase POST_BUILD
[Container] 2020/11/04 19:40:02 Phase complete: POST_BUILD State: SUCCEEDED
[Container] 2020/11/04 19:40:02 Phase context status code:  Message: 
[Container] 2020/11/04 19:40:02 Preparing to copy CODE_COVERAGE report clover-report
[Container] 2020/11/04 19:40:02 Expanding base directory path:  .
[Container] 2020/11/04 19:40:03 Assembling file list
[Container] 2020/11/04 19:40:03 Expanding .
[Container] 2020/11/04 19:40:03 Expanding file paths for base directory .
[Container] 2020/11/04 19:40:03 Assembling file list
[Container] 2020/11/04 19:40:03 Expanding clover.xml
[Container] 2020/11/04 19:40:03 Found 1 file(s)
[Container] 2020/11/04 19:40:03 Report export config is NO_EXPORT, skip exporting reports
[Container] 2020/11/04 19:40:03 Preparing to copy TEST report test-report
[Container] 2020/11/04 19:40:03 Expanding base directory path:  .
[Container] 2020/11/04 19:40:03 Assembling file list
[Container] 2020/11/04 19:40:03 Expanding .
[Container] 2020/11/04 19:40:03 Expanding file paths for base directory .
[Container] 2020/11/04 19:40:03 Assembling file list
[Container] 2020/11/04 19:40:03 Expanding build/reports.xml
[Container] 2020/11/04 19:40:03 Found 1 file(s)
[Container] 2020/11/04 19:40:03 Report export config is NO_EXPORT, skip exporting reports

Error in UPLOAD_ARTIFACTS phase: [clover-report: [error processing report: [InvalidParameter: 1 validation error(s) found.
- minimum field size of 1, BatchPutCodeCoveragesInput.RequestEntries[0].FilePath.
 InvalidInputException: Report status is invalid]]]

**Error in UPLOAD_ARTIFACTS phase: [clover-report: [error processing report: [InvalidParameter: 1 validation error(s) found.

  • minimum field size of 1, BatchPutCodeCoveragesInput.RequestEntries[0].FilePath.
    InvalidInputException: Report status is invalid]]]**

Expected behavior

Export clover code coverage report on correct format =/

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions