I have been hearing a lot recently about continuous deployment especially in the context of building a lean startup, so I decided to try and get one of my projects running with continuous deployment.
Here’s what I learned today:
Travis CI is an open source tool for continuous integration and deployment.
There are several steps to setting up your project with Travis CI:
The getting started guide does a good job explaining the basics.
For my project, I needed to make a few customizations the biggest one was creating a test database that my test could use. Here is my
.travis.yml
:language: ruby rvm: - 2.0.0 env: - DB=postresql script: - bundle exec rake db:test:prepare --trace - bundle exec rspec before_script: - psql -c 'create database my_app_test;' -U postgres
Travis CI integrates nicely with Heroku, so that your code be deployed after a successful build. I was having some problems deploying using Anvil, so I switched to using git. Here is what I added to my
.travis.yml
for deploying to Heroku:deploy: provider: heroku api_key: secure: encrypted-key strategy: git app: epicodus-qa run: "rake db:migrate"