A sample project containing code to run code coverage tools in github actions for iOS projects. This project attempts to simplify and explain the steps required to integrate the following code coverage tools in github actions:
Note that your XCode project will also have to be signed by setting a team as well.
CodeClimate does not provide an app or integration with github directly. You will need to download their uploader in order to integrate to codeclimate.
CodeClimate can injest a coverage file generated by xccov
. This project converts the output .xcresult
file to a .json
file using xccov
which is injested by the codeclimate uploader.
For iOS projects, CodeCov requires the upload file to be in a cobertura xml format. This project generates the xml file in the fastlane script using slather.
This project produces a lcov
format to upload to coveralls. The process of generating the lcov
file is as
follows:
fastlane test
generates a.xcresult
file.xcresult
file converted to a.json
file usingxccov view
command.json
file converted tolcov.info
file using xccov2lcovlcov.info
file ready to upload to coveralls
Coveralls provides a github actions app for the actual uploading step.
CodeClimate was the easiest to integrate because it required no other dependencies (such as slather or xccov2lcov), but also it was the worst code coverage tool when it comes to github pull request integrations; it was buggy at the time of my testing.
CodeCov has the most comprehensive pull request comments including delta values per PR basis. A bit of a hassle to integrate due to the cobertura xml format requirement.
Coveralls is just as good as CodeCov in its pull request comments but perhaps the most hassle to integrate due to the lcov format requirement.
All three tools work in a similar manner, an uploader is used to upload test output files to their servers. The three tools work with different test output file formats. The tools all require a token and the easiest setup for these tokens is to add them to the repository secrets: