Skip to content

Feature Request: Support for retrieving code coverage data from Android emulator #8

@leogdion

Description

@leogdion

Hello folks! I love your work. I'm trying to collect Swift code coverage data from tests running on the Android emulator specifically for https://about.codecov.io but there's currently no built-in way to retrieve the generated .profraw files from the device back to the CI host.

Use Case

When running Swift tests with code coverage instrumentation on Android:

  1. Tests are built with coverage flags: -Xswiftc -profile-coverage-mapping -Xswiftc -profile-generate
  2. Tests run on the Android emulator via this action
  3. Coverage data (.profraw files) are generated on the emulator
  4. These files need to be retrieved to process with llvm-profdata and upload to codecov

Current Limitation

The copy-files parameter only supports copying files to the emulator before tests run, not retrieving files from the emulator after tests complete.

Proposed Solution

Add support for retrieving files from the emulator after tests complete. Possible implementations:

Option 1: New retrieve-files parameter

- uses: skiptools/swift-android-action@v2
  with:
    retrieve-files: |
      /data/local/tmp/android-xctest/*.profraw
    retrieve-to: .build/coverage

Option 2: Automatic coverage retrieval

Add a collect-coverage boolean parameter that:

  • Automatically pulls .profraw files from the test directory
  • Places them in .build/ for standard Swift coverage tools to find

You can look at my attempts here:
https://github.com/brightdigit/MistKit/blob/feature/android-ci/.github/workflows/MistKit.yml

Would be happy to test any implementation or provide additional details!

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions