We wanted to speak about Travis-CI, this project makes Continuous Integration simple. It comes with some amazing features!
Continuous Integration is the process of applying continuous quality control in order to increase the quality of software, rather than the more traditional method of applying quality control at the end.
Travis CI allows you to test your project with different versions of Python and Django. The integration with github is seamless and there is a great support for Python (http://about.travis-ci.org/docs/user/languages/python/). Travis-CI uses Vagrant and creates an isolated virtual environment for each of Python version you want to test your project with.
As with anything new, it’s common to meet beginner’s issues. To explain, one of the first things to do before testing your Django project is to install the dependencies, Travis-CI uses Pip. Newfies-Dialer have a lot of dependencies, and if the dependencies aren’t installed in the right order the installation may fail and therefore Travis-CI will also fail to run the tests. Pip sorts dependencies to check for duplicates.
We solved this issue by creating a bash script that installs the dependencies in the correct order:
https://github.com/Star2Billing/newfies-dialer/blob/develop/install/requirements/install-requirements.sh
Then, you need to tell Travis-CI to use the script for installation in your .travis.yml file:
install:
- bash install/requirements/install-requirements.sh
The second issue we met is the setup of the database with MySQL, this article provides the solution : http://about.travis-ci.org/docs/user/database-setup/
In your # .travis.yml, you need to add the database that will be used for the tests:
before_script:
- "mysql -e 'create database newfies_test;'"
We then created a new settings file for our travis project : settings_travis.py, which we will install prior running our test suite:
before_script:
- cp install/conf/settings_travis.py newfies/settings_travis.py
Another common issue is having your Yaml file “.travis.yml” not valid, this will result with an error on Travis “No Rakefile found”. Travis comes with a good tool, travis-lint which will help to validate the travis.yml file : http://about.travis-ci.org/docs/user/travis-lint/
Documentation and support from Travis-CI is very good, and we were able to ask some questions on their IRC and move forward quickly. We have now an astounding service that takes care of the Continuous Integration and we can say this has been a very pleasant experience.
Our next steps are to increase our test suite, try to improve our code coverage and of course keep our test results green.
See Newfies-Dialer on Travis-CI : http://travis-ci.org/#!/Star2Billing/newfies-dialer