Kamil's Weblog

How to setup Code Climate Quality test coverage with Bitrise

How to setup Code Climate Quality test coverage with Bitrise

Quality by Code Climate is a web service that gives you analytics for your code. It analyzes your code for code smells, and with proper CI/CD integration, it can track changes in test coverage data.

This article will list, step by step, how to set up Code Climate test coverage upload from Bitrise - probably most famous and widely used mobile Continues Integration and Continues Delivery service.

Initial assumption: Your GitHub repository is added to the Quality by Code Climate and the Bitrise.

#!/usr/bin/env bash

curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-darwin-amd64 > ./cc-test-reporter
chmod +x ./cc-test-reporter
./cc-test-reporter before-build
#!/usr/bin/env bash

xcrun xccov view --report $BITRISE_XCRESULT_PATH --json > coverage.json
./cc-test-reporter after-build --coverage-input-type xccov

Bitrise steps needed for test coverage setup

That's it. With that few simple steps, you can send test coverage data from Bitrise to Code Climate.