codacy / codacy-coverage-reporter-action

GitHub Action for the codacy-coverage-reporter
Other
58 stars 15 forks source link

Errors using action #17

Closed ola-mymed closed 4 years ago

ola-mymed commented 4 years ago

I'm using PHPUnit 8.5 but can't seem to get my coverage file located at '/build/coverage-xml/index.xml' uploaded.

When I supply that to the 'coverage-reports' param of your action, I get:

2020-06-01 14:17:44.156Z info [ConfigurationRules] API base URL: https://api.codacy.com - (ConfigurationRules.scala:84) 2020-06-01 14:17:44.157Z info [ReportRules] Parsing coverage data from: /build/coverage-xml/index.xml ... - (ReportRules.scala:48) 2020-06-01 14:17:44.157Z error [CodacyCoverageReporter] File /build/coverage-xml/index.xml does not exist. - (CodacyCoverageReporter.scala:25) --> Failed!

When I supply nothing, I get: Can't get any report due to no matching! Try to specify the report with -r.

Any ideas where I'm going wrong?

franciscodua commented 4 years ago

Hi @ola-mymed

2020-06-01 14:17:44.157Z error [CodacyCoverageReporter] File /build/coverage-xml/index.xml does not exist. - (CodacyCoverageReporter.scala:25)

That error occurs when the file doesn't exist. So, is it possible that the path is incorrect? Check if build/coverage-xml/index.xml (without the first /) exists, since the actions usually use the path relative to the repository root.

When I supply nothing, I get: Can't get any report due to no matching! Try to specify the report with -r.

In the reporter's documentation you can find the following note under the format column PHPUnit XML (version <= 4). This means, that the PHPUnit XML format is only supported for PHPUnit version 4 or below. From version 5 and up you should use the clover file format. Is it possible that you're using a more recent version of PHPUnit?

Let us know if these suggestions helped or if you remain with the same problem.

ola-mymed commented 4 years ago

Thanks @franciscodua but using build/coverage-xml/index.xml (without the first /) gives this error instead:

error [CodacyCoverageReporter] The provided coverage report /github/workspace/build/coverage-xml/index.xml generated an empty result.

To confirm: I'm using PHPUnit 8.5.

franciscodua commented 4 years ago

Ok cool.

This means the first problem is solved. The path is now correct.

But the report is not supported by the tool. Because you are using a PHPUnit 8.5, which is more recent than version 4. That's why it's generating empty results, because it doesn't know the document format.

To fix that problem you can instead generate a Clover report and use it instead. To use a clover report you can follow this guide.

ola-mymed commented 4 years ago

Thanks a lot @franciscodua I actually figured that out right after I dropped my last message so I went off to confirm this by creating a clover report in the root of my directory and then supplied this to the 'coverage-reports' param instead. Works a treat now, thanks again!

franciscodua commented 4 years ago

Great to hear! I'll close this issue then