codecov-action icon indicating copy to clipboard operation
codecov-action copied to clipboard

Support for xcresult-based uploads in `v4`.

Open Supereg opened this issue 10 months ago • 5 comments

Problem

We found that tokenless uploads using action v3 are essential broken since Friday (e.g., see https://github.com/StanfordBDHG/LLMonFHIR/actions/runs/8592479578/job/23631941264). This encouraged to explore an upgrade to the v4 action using organization wide tokens (nice feature btw). However, we quickly found that the xcode and xcode_archive_path options were completely removed from v4 without clear instructions on how to migrate.

So our question is, what are the drop in replacements for the xcode and xcode_archive_path options with v4? Are xcresult-based coverage uploads still supported (if so, how?) or were they just silently removed? We would highly appreciate respective migration guides or according documentation for the most prominent use cases as both are currently completely missing.

I tired my best to provide you the best possible overview of our current situation and hope you can provide helpful feedback and point us towards the next steps.

Current Workflow

To highlight our current workflow:

  • We have build and test n actions each producing a .xcresult file with collected code coverage.
  • All of these files are uploaded as GitHub artifacts
  • Once all steps completed successfully, a new GitHub Actions Job runs to collect all artifacts from previous build steps, merge all coverage reports using xcrun xcresulttool merge ... creating a new CodeCoverage.xcresult.
  • Previously we used the codecov action with xcode: true and xcode_archive_path: CodeCoverage.xcresult options to upload the coverage report. This step is seemingly not possible anymore.

What we've tried

I tried to explore how such interactions are handled with v4. CLI options seem to mention some form of xcode plugin to be available (see https://docs.codecov.com/docs/cli-options#do-upload). The Supported Coverage Report Formats also still seem to mention some txt-based Xcode code coverage format. Also, when running codecovcli locally it randomly pulls code coverage reports from all, completely unrelated Xcode projects in derived data into the current directory (Not sure if that is the intended new way?). This doesn't work with our current workflow, as we don't have the derived data available (also we don't use the global derrivedData directory), as we have a dedicated step to assemble a self-contained xcresult package.

Attempts that failed

I have tried to manually convert the code coverage report of a xcresult package into a format that codecov understands. Simple attempts by just manually pulling out the coverage format in json or txt have failed (e.g., using the xcrun xccov view --report --json CodeCoverage.xcresult > cov.json). While the overall upload action completed successfully (by supplying the file argument with the respective output), the UI shows the error null. Not super helpful. See https://app.codecov.io/github/StanfordSpezi/SpeziFileFormats/commit/0a7434be32dea2e44e126f314ab9b116ec042e39.

CC: @PSchmiedmayer @philippzagar @vishnuravi

### Tasks

Supereg avatar Apr 10 '24 00:04 Supereg

@Supereg Thank you for raising this issue; an issue we are struggling with across our GitHub organization and multiple projects.

PSchmiedmayer avatar Apr 10 '24 00:04 PSchmiedmayer

@Supereg Can you share the .yml file? I want to see how you implemented that in v3. I am facing issues. I will be thankful to you.

Zee326 avatar May 08 '24 13:05 Zee326

@Zee326 create-and-upload-coverage-report.yml is our action that uploads the coverage reports collected from the xcodebuild-or-fastlane.yml action.

Supereg avatar May 08 '24 14:05 Supereg

We went with the approach seen at https://github.com/bitwarden/authenticator-ios/commit/2edaf9ba91a2080c69b2f8cdbf22b2f176383556 to work around this issue. Looking forward to this being automated so we can avoid installing and using xcresultparser.

withinfocus avatar Jun 05 '24 15:06 withinfocus

This can be addressed by https://github.com/codecov/uploader/issues/1078

drazisil-codecov avatar Jul 26 '24 12:07 drazisil-codecov