codacy / codacy-coverage-reporter

Multi-language coverage reporter for Codacy
https://www.codacy.com
Other
135 stars 94 forks source link

[CY-3145] [Github actions] Can't send coverage due to error #266

Closed feugy closed 4 years ago

feugy commented 4 years ago

Operating System/Scala version/Java version/Library deps...

Github actions (codacy-coverage-reporter-action's DockerFile)

Expected Behavior

At the end of the CI job, coverage should be sent to Codacy.

Actual Behavior

The coverage file (which exists, and is valid, see attached) is not sent, and the following error is displayed in logs:

error [CodacyCoverageReporter] Can't guess the language due to invalid path  - (CodacyCoverageReporter.scala:25)

Failed!

coverage file, zipped so it could be attached to that issue

full log attached

Reproducible Test Case

As my application is open source, you can find failing logs here.

github-actions[bot] commented 4 years ago

Internal ticket created : CY-3145

franciscodua commented 4 years ago

Hi @feugy

The problem seems to be an unsupported file extension. In this case, the .svelte extension. For the reporter to send coverage you should exclude these files from the generated coverage.

You can do it by removing the pattern '**/*.svelte' from the collectCoverageFrom array in jest.config.js. (https://github.com/feugy/melodie/blob/master/jest.config.js#L58).

Let us know if it helps. And if this is a good approach to your problem.

feugy commented 4 years ago

Hello @franciscodua. Thanks for this lightning fast response.

I'm sorry but the svelte files are part of the coverage report since day one. Svelte is the main technology used, so I can not exclude it. Besides, Codacy never complained about svelte files in the coverage report until few days ago.

It's only in the latest PR that things broke. There is no new file extensions in there. Could it be a recent change on Codacy side?

franciscodua commented 4 years ago

Hey @feugy

Ok, I think I know what happened, and it's due to a tool limitation.

This tool assumes the coverage report only has files that use the same language, i.e., all Javascript, or all PHP. You can check the validation that it's done here. It's just checking the first file in the list to check if the tool "knows" the language.

Something must have changed since, and before the first file was a .js file and now it's a .svelte file.

While svelte is not supported by Codacy, the thing we can do is ignore non supported files. What do you think? Would it work for you if the tool just ignored unknown languages? (this would be similar to the behavior it had before you started getting this error)

feugy commented 4 years ago

Indeed, ignoring unsupported files sounds a good idea.

Thanks a million for you support!

lolgab commented 4 years ago

Indeed, ignoring unsupported files sounds a good idea.

Hi @feugy, We implemented the approach to skip unsupported languages: https://github.com/codacy/codacy-coverage-reporter/pull/270 . Can you try again to see if it works for you? Thank you!

feugy commented 4 years ago

Hello @lolgab

Yes, it worked fine: image

Thanks a million for this quick resolution.

lolgab commented 4 years ago

Thank you for your patience! Feel free to re-open in case you face other problems.