Skip to content
refresh-cw

GitHub Action

Swift Coverage Conversion

v4.0.0 Latest version

Swift Coverage Conversion

refresh-cw

Swift Coverage Conversion

Converts Swift / Xcode code coverage files for processing with e.g. codecov

Installation

Copy and paste the following snippet into your .yml file.

              

- name: Swift Coverage Conversion

uses: sersoft-gmbh/swift-coverage-action@v4.0.0

Learn more about this action in sersoft-gmbh/swift-coverage-action

Choose a version

Swift Coverage Conversion

Tests

This action converts code coverage files from swift test or xcodebuild runs for processing with e.g. codecov. Note that this action does not run any test. Use swift test, xcodebuild or xcodebuild-action for that.

Inputs

search-paths

A list of search paths (one per line) that should be used for searching coverage data.
Default:

./.build
$HOME/Library/Developer/Xcode/DerivedData

output

The path to the output folder. Note that this folder will be deleted / overwritten by this action. You should probably put it in .gitignore.
Default: ./.swiftcov

format

The format to write the coverage files in. Can be 'lcov' or 'txt'.
Default: lcov

target-name-filter

A regular expression that is used to filter coverage files by their target names.

ignore-conversion-failures

If true, conversion failures are ignored. If fail-on-empty-output is also set to true, the action might still fail if all conversions fail.
Default: 'false'

fail-on-empty-output

If true, the action fails if no coverage files were found (output is still set to an empty array).
Default: 'false'

Outputs

files

The JSON encoded array of (absolute) file paths that were written. They are all contained inside the directory specified in the output input.

Example Usage

Use the following snippet after running tests with Swift or Xcode to convert those coverage files:

uses: sersoft-gmbh/swift-coverage-action@v4

Codecov Action (v2 or later)

To use this action together with codecov/codecov-action, you need to convert the output to a comma separated string:

- uses: sersoft-gmbh/swift-coverage-action@v4
  id: coverage-files
- uses: codecov/codecov-action@v3
  with:
    token: ${{ secrets.CODECOV_TOKEN }}
    files: ${{ join(fromJSON(steps.coverage-files.outputs.files), ',') }}