uploader: [CODE-874] New uploader is unable to find and upload coverage reports from Xcode

Describe the bug The new uploader fails to find coverage reports from Xcode.

To Reproduce

  1. git clone https://github.com/chris-araman/CombineCloudKit.git
  2. cd CombineCloudKit
  3. swift package generate-xcodeproj
  4. xcodebuild test -enableCodeCoverage YES -scheme CombineCloudKit-Package
  5. bin/codecov -n -Q github-action-2.0.1 -Z

Expected behavior The coverage report is found and uploaded successfully.

Additional context codecov-action@v2 uses the new uploader. codecov-action@v1 used the old bash uploader. The new uploader fails to find coverage reports from Xcode when the bash uploader found them successfully. I encountered this issue when attempting to migrate from codecov-action@v1 to @v2.

It seems this functionality was implemented in the bash uploader here: https://github.com/codecov/codecov-bash/blob/ae76691c8554334bc1ddc355f6667fd36d6890f5/codecov#L1148

There are notes in https://github.com/codecov/uploader/issues/15 about wanting to keep this project a “pure uploader”. I think separating the concerns of the uploader from the concerns of something processing reports is admirable. However, I think this sort of boilerplate logic is useful to users of the uploader. Perhaps it can be ported to a more coverage-friendly environment (Node.js, Typescript) alongside the uploader functionality, even if it’s in a separate module?

This issue is preventing me from migrating to the new uploader via codecov-action@v2.

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 4
  • Comments: 24 (9 by maintainers)

Commits related to this issue

Most upvoted comments

Doesn’t seem to work, or I’m doing something wrong.

😏 I was doing something wrong. This got me on the right track:

swift package generate-xcodeproj
xcodebuild -scheme CombineCloudKit-Package -destination 'id=529F3FC8-EB55-4644-A1B3-01FF1DA6A2BA' -resultBundlePath foo.xcresult -enableCodeCoverage YES test
cd ../xcode-poc/
node generate-codecov-json.js --archive-path ../CombineCloudKit/foo.xcresult/

This generates coverage-report-.json, which seems to show valid file names and line numbers.

Is there an update on this? I see a more recent related issue https://github.com/codecov/uploader/issues/803 where there’s a “Running Xcode conversion…” step in the output log of the uploader. When using the latest CircleCI orb I don’t see that step, instead seeing the error “There was an error running the uploader: No coverage files located, please try use -f, or change the project root with -R”.

I wonder if writing the llvm-cov commands as a Fastlane plugin would be an option.

It would help some, but certainly not enough developers. We’re not using fastlane for example and we have a ton of swift packages that are now failing to produce coverage reports.

To mitigate the issue temporarily, I’ve written an swift-coverage-action that performs the tasks previously done by the bash uploader. There are certain features missing (e.g. the -J parameter), but it should do the trick most of the time.

An example of how to use it can be found here.

I still hope to retire that action in the near future, though. 😉

Any update on this? All my coverage reports say 0%