Build Python desktop application with Jenkins
Applying Jenkins to new tasks like building and packaging multi-platform desktop apps
Recently, we have begun applying Jenkins, a well-known system for Continuous Integration, to brand-new tasks like building and packaging multi-platform desktop applications.
We're currently in charge of developing a desktop application written in Python using the Qt framework. Though small, the application is quite complex and has a lot of dependencies which we are able to satisfy on a local environment (provided that you're not on Windows, but that's another story).
There are several proprietary C/C++ libraries involved, and some of them are under active development, so we have to stay up-to-date on them and on the relative Python bindings. In the early stages of development the environment was entirely hand-crafted, so building and packaging the software with the right configuration was up to a single developer who wrote the first draft of the project.
The prototype was pretty good, so we started a refactoring of the codebase and assigned other resources to the project. Problems with the building environment arose almost instantly: not every developer works on the same configuration (and this is a free choice) and maintaining different build scripts was not possible.
We needed a build system and we needed it fast, so we started reviewing some of our top choices:
CMake seems the most flexible option (at least for a newcomer) and it was the only one which let us collect the code from several sources (CVS repos, git repos, source tarballs) construct it with different build systems (Make, QMake, distutils, custom scripts), execute it with PyInstaller and create the archive to distribute. First issue solved: developers could now build the software with minimum effort and in a well defined and versioned environmentThe next step was a bigger issue- beta tester started asking for packages for their own distributions/OSs and we needed a build system capable of running our CMake script on several machines, producing the software package and making it available for download somewhere on the internet.
- a turnkey solution
- should be able to start and stop virtual machines inside our LAN
- should be able to start and stop EC2 machines
- can speak with cloud storage systems (e.g. S3)
We briefly reviewed two products, Jenkins and CDash, and ended up with Jenkins for three reasons:
- huge amount of very useful plugins
- easy installation and maintaining
At the moment, we have a master/slave installation on Jenkins running on a physical machine and several slave nodes with different Linux distributions (both physical and virtual) where the git repository containing the CMake builder is cloned, run, and the final product is actually produced. Jenkins can remotely control KVM virtual machines, starting and stopping them depending on its needs. Artifacts produced by the builders (i.e. the tarballs containing the software package ready to be shipped) are collected and uploaded to a S3 bucket, where authorized beta testers can download them.
Feel free to drop a comment here and share your experience, it's never easy finding a best practice when the requirements are complex and not well-defined, as in this case.