This tool aims to convert Xcode generated code coverage data into CI friendly formats.
Please execute xcc generate --help
for all options.
brew install twittemb/formulae/Xcodecoverageconverter
-derivedDataPath Build/ -enableCodeCoverage YES
xcrun xccov view --report --json Build/Logs/Test/*.xcresult > coverage.json
/usr/local/bin/xcc generate coverage.json . cobertura-xml --exclude-packages Tests
(this command excludes the Tests package from the export)The XML output can then be uploaded to your CI provider as an artefact. It has been sucessfully tested with Azure DevOps pipelines.
xcc
currently supports these output formats:
cobertura-xml
sonarqube-xml
You can specify several output formats in the CLI /usr/local/bin/xcc generate coverage.json . cobertura-xml sonarqube-xml
PR are of course welcome. To add new input or output formats, please refer to how Decoders
and Converters
are implemented.
This tool is based on the following gist:
https://gist.github.com/csaby02/ab2441715a89865a7e8e29804df23dc6
Thanks to its author.