Tutorial: Truffle Continuous Integration with CodeShip

I’m currently working on building a Distributed Application using Truffle, and wanted to set up a continuous integration pipeline for my work.

I couldn’t find a good guide out there for setting this up, so I thought I’d give it a go and post my findings online.

I recalled using Codeship some time ago for continuous integration on other projects, and considering that Codeship has a free version for small projects, this seemed like a perfect fit.

Create a New Project

The first step is to set up your new project. I chose BitBucket as my SCM and grabbed the Git URL from my BitBucket home page to connect Codeship and my repository together.

Configure Tests

In the Tests tab, you have two command boxes; setup commands and test commands.

I used the setup commands to install the required nodejs packages:

npm install truffle
npm install ganache-cli
npm install run-with-testrpc

Truffle is the Ethereum development framework that I’m using to build my distributed application. I expect that you’ll already be familiar with Truffle, but if not, you can read more about it here.

Ganache-CLI (previously known as TestRPC) is a tool that simulates the Ethereum client, making it easier to develop smart contracts and distributed applications. Again, I expect that you’ll already be familiar with Ganache-CLI, but if not, you can read more about it here.

“Run with TestRPC” is a neat little tool that I found to run a command with TestRPC in the background. This was the simplest way that I could find to run both Ganache-CLI (TestRPC) and truffle tests at the same time.

Finally, I configured the test pipeline to run my actual tests:

./node_modules/.bin/run-with-testrpc --port 7545 'truffle test'

I set the port manually, as this appears to be what Truffle/Ganache-CLI uses by default.


I’m impressed with just how easy it was to get this set up and running. With four commands we have a continuous integration pipeline running tests. I’ll endeavour to come back and update this post if anything changes, but for now, I hope this is helpful to anyone else who is trying to set this up.

Happy coding!