We built a sample project on Github to show how we integrate with various CI tools, including Circle CI.
Our project is configured to provide a continuous delivery flow by default. Here's how it works!
- Run the automated tests
- Install the rainforest-cli gem
- Deploy the 'develop' branch to a staging server
- Run the rainforest tests using the rainforest-cli gem against the staging server
- Once the rainforest tests are successful, push the 'develop' branch to the 'master' branch
- Step 5 triggers another CI build, which pushes the code to production
If any of the above steps fail, the whole build fails, preventing the deployment of broken code to your users.
Getting Started With Circle CI
We'll cover some important items next, but for the full picture we encourage you to consult the excellent Circle CI getting started documentation.
The circle.yml file
The main way to configure the Circle CI tool is through a file that you store in your git repository. You can see the sample configuration for our project here.
You'll notice that instead of entering the Rainforest API key directly in the circle.yml file, we're using an environment variable. We do this for security reason. We don't want to expose that variable to any reader of that file. This especially true if the repository is publicly accessible.
To configure environment variables, you can do so in the project's settings. You can find your Rainforest API token by navigating to "My Account" --> "Integrations" --> "API". You can then create a RAINFOREST_TOKEN variable in Circle CI and you're done.
More details about environment variables and Circle CI here.
Testing your setup
You can test your setup by committing a change to your develop branch and pushing it your git repository. Circle CI should pick up on the change and deploy your code.
You now have a continuous delivery flow + amazing QA and can consider yourself in the cool kids club.