codecov / codecov-exe

.exe report uploader for Codecov https://codecov.io
MIT License
25 stars 21 forks source link

Can't upload coverage with AppVeyor (400/599 error) #106

Closed Xwilarg closed 4 years ago

Xwilarg commented 4 years ago

Hi,

I'm trying to use Codecov with AppVeyor but I'm getting a Bad Request (400) and an Internal Server Error (599) The unit tests are on .NET Core 3.1 My configuration file is the following:

image: Visual Studio 2019

before_build:
- nuget restore
- choco install opencover.portable
- dotnet tool install --global Codecov.Tool

build:
  project: BooruSharp.sln

test_script:
- OpenCover.Console.exe -register:user -target:"C:/Program Files/dotnet/dotnet.exe" -targetargs:test -filter:"+[BooruSharp*]* -[BooruSharp.UnitTests*]*" -output:"coverage.xml" -oldstyle
- codecov -f "coverage.xml"

And here is what AppVeyor is telling me:

2020-05-30 17:35:11 INF AppVeyor detected.
2020-05-30 17:35:11 INF Git detected.
2020-05-30 17:35:11 INF Project root: C:\projects\boorusharp
2020-05-30 17:35:11 INF Yaml not found, that's ok! Learn more at http://docs.codecov.io/docs/codecov-yaml
2020-05-30 17:35:11 INF Reading reports.
2020-05-30 17:35:11 INF coverage.xml
2020-05-30 17:35:11 INF Uploading Reports.
2020-05-30 17:35:11 INF url: https://codecov.io
2020-05-30 17:35:11 INF query: https://codecov.io/upload/v4?branch=master&commit=6c4f973ca611d4c190d875d3ba384b3015da85b6&build=o0lm0iwa551l22nt&tag=&pr=&name=&flags=&slug=Xwilarg%2FBooruSharp&token=&package=exe-1.10.0&build_url=https://ci.appveyor.com/project/Xwilarg/boorusharp/build/job/o0lm0iwa551l22nt&yaml=&job=Xwilarg%2Fboorusharp%2F2.0.3.771&service=appveyor
2020-05-30 17:35:12 INF Pinging Codecov
2020-05-30 17:35:13 INF Uploading
2020-05-30 17:35:13 WRN Unable to upload coverage report to Codecov. Server returned: (400) Bad Request
2020-05-30 17:35:13 WRN Unknown reason. Possible reason being invalid parameters.
2020-05-30 17:35:13 WRN Failed to upload the report with CodecovUploader.
2020-05-30 17:35:13 INF Uploading to Codecov
2020-05-30 17:35:28 WRN Unable to upload coverage report to Codecov. Server returned: (599) Internal Server Error
2020-05-30 17:35:28 WRN 
2020-05-30 17:35:28 WRN Failed to upload the report with CodecovFallbackUploader.
2020-05-30 17:35:28 FTL Failed to upload the report.
   at Codecov.Upload.Uploads.Uploader() in /home/appveyor/projects/codecov-exe/Source/Codecov/Upload/Uploads.cs:line 33
   at Codecov.Program.UploadFacade.Uploader() in /home/appveyor/projects/codecov-exe/Source/Codecov/Program/UploadFacade.cs:line 129
   at Codecov.Program.Run.Uploader() in /home/appveyor/projects/codecov-exe/Source/Codecov/Program/Run.cs:line 68
   at Codecov.Program.Run.Runner(IEnumerable`1 args) in /home/appveyor/projects/codecov-exe/Source/Codecov/Program/Run.cs:line 21

If needed you can find the full log here: https://ci.appveyor.com/project/Xwilarg/boorusharp#L656 (Errors are line 658 and 662)

Thanks in advance,

TimHess commented 4 years ago

Related? https://community.codecov.io/t/http-400-while-uploading-to-s3-with-python-codecov-from-travis/1428/8

Oh, looks like #105 fixes this

Xwilarg commented 4 years ago

I no longer have the 599 error but I still have the 400's one

AdmiringWorm commented 4 years ago

@Xwilarg the error code 400 is definitely will definitely be fixed by issue #105, the 599 error code could have been a temporary issue on the server (I can only assume).

I do see that you are able to upload the coverage report at least now, through the fallback uploader implemented in codecov-exe.

Xwilarg commented 4 years ago

Thanks for your answer, However even if the CI say that it managed to upload it I still have an error on codecov.io

For example the last AppVeyor run tells me

2020-06-09 01:35:54 INF Pinging Codecov
2020-06-09 01:35:55 INF Uploading
2020-06-09 01:35:56 WRN Unable to upload coverage report to Codecov. Server returned: (400) Bad Request
2020-06-09 01:35:56 WRN Unknown reason. Possible reason being invalid parameters.
2020-06-09 01:35:56 WRN Failed to upload the report with CodecovUploader.
2020-06-09 01:35:56 INF Uploading to Codecov
2020-06-09 01:35:56 INF View reports at: https://codecov.io/github/Xwilarg/BooruSharp/commit/4e5223dc403f618b4f91b80d273ca85bf8695be0

However if you go on https://codecov.io/github/Xwilarg/BooruSharp/commit/4e5223dc403f618b4f91b80d273ca85bf8695be0 it says there was an error processing the coverage report.

AdmiringWorm commented 4 years ago

@Xwilarg typical reasons I have seen that that can cause such issues is an empty or invalid coverage report, and looking at your latest build, I suspect there is an empty coverage report. (codecov-exe do not validate the coverage report before uploading it).

I see you are using opencover, which doesn't fully support .NET Core and its portable debug files. You will need to specify the old edition of the debug files for it to generate a valid coverage report.

You can quickly fix that by adding the following to your project files, and possibly also to the unit testing libraries as well (not entirely sure if the latter was needed or not).

<DebugType>pdbonly</DebugType>

Or you can switch to a coverage utility that supports .NET Core like coverlet (this is the one I use and would recommend).

Xwilarg commented 4 years ago

I switched to coverlet and it's now working, thanks!