Wednesday, February 17, 2016

Continuous integration with Python on TeamCity

Here is how we can configure TeamCity 9.1.3 (build 37176) to perform continuous integration on Python 2 projects. I assume that you have already installed Python 2 (2.6 and above), virtual-env, TeamCity, and have access to your code in a version control system. Unit tests written in Nose seem to work well in TeamCity.

  1. Create a virtual-env on the server hosting your TeamCity installation. 
  2. Install teamcity-messages in your virtual-env.
  3. Create a new project in TeamCity. See this page for more details.
  4. Setup your VCS root(s). This may not be the best approach, but for dependent Python projects, I create VCS roots for every dependent projects so that all dependencies are satisfied within the project. You may have to define VCS roots in a parent TeamCity project if they are shared among several dependent projects.
  5. Create a build configuration.
  6. Attach relevant VCS roots in the "Version Control Settings" page.
  7. Create a new build step with "Command Line" as the runner type.
  8. Enter the script content so that you invoke your virtual-env's nosetests.exe.
  9. Add a new trigger in the Triggers page.
  10. You can manually schedule a build now or wait for TeamCity to build automatically.

No comments:

Post a Comment