Integrating Codacy with Codeship
At Codeship, we’re pleased to be able to integrate with several third-party products across a variety of areas to ensure your CI/CD workflows are that much smoother. For example, Codacy is an automated code-coverage service that helps you enforce standards of code quality and transparency with your engineering team.
Getting started with Codacy and Codeship is fast and easy, but their documentation does a great job of providing more information, in addition to our setup instructions in this post. Let's begin with setting up Codacy with Codeship Pro.
Codacy and Codeship Pro
To get started, you'll need to add your CODACY_PROJECT_TOKEN
to the encrypted environment variables that you encrypt and include in your codeship-services.yml file.
Project configuration
Once your Codacy project ID is loaded via your environment variables, you'll need to install the Codacy package into your Dockerfile via your preferred package manager. You can find specific instructions per language over at Codacy's documentation.
The next step will vary by language. Some of the Codacy packages will automatically run whenever your tests run while some will require separate commands added to your codeship-steps.yml file.
For instance, the Rails gem will automatically update your coverage report and export it to Codacy and requires no additional steps. The Python package, on the other hand, will require an additional command placed either directly in your codeship-steps.yml file or inside of a script:
- name: codacy service: app command: python-codacy-coverage -r coverage.xml
Note that the above command is only for Python. We recommend reviewing their documentation for your specific language to be sure the necessary commands are run.
Codeship Basic
Moving on to setting up Codacy with Codeship Basic, you'll need to add your CODACY_PROJECT_TOKEN
to your project’s environment variables. You can do this by navigating to Project Settings and then clicking on the Environment tab.
Project configuration
Once your Codacy project ID is loaded via your environment variables, you will need to install the Codacy package via your preferred package manager in your project’s setup commands. You can find specific instructions per language over at Codacy's documentation.
The next step will vary by language. Some of the Codacy packages will automatically run whenever your tests run while some will require separate commands added to your project’s test commands.
For instance, the Rails gem will automatically update your coverage report and export it to Codacy and requires no additional steps. The Python packag, on the other hand, will require an additional command placed either directly in your test commands or inside of a script:
python-codacy-coverage -r coverage.xml
Note that the above command is only for Python. We recommend reviewing their documentation for your specific language to be sure the necessary commands are run.
To add automated code coverage to your CI/CD pipeline, try integrating Codacy with your Codeship projects.
Stay up to date
We'll never share your email address and you can opt out at any time, we promise.