There are two common benefits cited as reasons to make a project open source:
- Generosity: Open source projects are a way of “giving back” to the technical community.
- Crowd-sourcing: Outside contributors can submit features, bug fixes, and bug reports, providing a free labor source.
Both of these arguments may be a tough sell for a business because they have no tangible benefit. Generosity does not directly translate to dollars, and there’s certainly no guarantee that outside developers will want to spend their time improving your product.
But there is another benefit that we should consider – open source software can greatly reduce the burden and cost of a continuous integration environment.
Continuous integration is the strategy of merging and testing software commits as often as possible. When a developer commits new code, the team should know as soon as possible if that code introduced a problem. Setting up tools to perform these tests have not only an up-front labor cost, but also a long-term cost for server infrastructure and, in some cases, software licenses.
There are several continuous integration cloud services that are free for open source repositories, effectively eliminating the long-term costs for continuous integration.
A mature continuous integration environment will include three types of services: automated unit testing, static code analysis, and browser tests (if it is a web application). All of these actions can be executed on an open source repository for free using cloud-based services. If your workflow also requires automated deployments, these tools can do that too!
1. Basic Continuous Integration (Unit Tests and Deployment)
Perhaps the most obvious requirement of a continuous integration platform is that the project should run its unit tests often, preferably after every commit. There are several established tools to accomplish this task, such as Jenkins, Bamboo, and CircleCI, that either cost money or require you to manage and pay for the infrastructure to host them.
Several cloud-based competitors offer their continuous integration services for free to open source repositories. Since all CI processing run on their infrastructure, there are no hardware or maintenance costs for the end user. Options include Travis, Codeship, Appveyor, Semaphore, and Drone.io. These services will detect when you commit new code, or submit a pull request, and automatically run your unit tests on their infrastructure. Depending on your setup, these tools may also be able to deploy the software automatically if the tests pass.
2. Static Code Analysis
Static code analysis is the process of analyzing code and reporting on its quality without actually executing the code. For example, static code analysis may find that you aren’t following coding best practices or that your functions are too complex. Generally, this is accomplished using an open source tool like Sonar, or by wiring lint and coverage tools into Jenkins. Both of these options utilize free software, but the maintenance and infrastructure burdens of hosting the applications are not free.
Similar to continuous integration, several cloud-based vendors offer their static code analysis services for free to open source repositories. Options include Code Climate, Coveralls, Codacy, Bithound, Requires.io, Coverity, and Landscape. These services will detect when you commit new code, or submit a pull request, and automatically run code quality tests for free.
3. Browser Testing
There are free tools available to perform browser testing, such as Selenium alongside PhantomJS or Chromedriver. While there is no cost to use these tools, plugging them into an automated testing environment such as Jenkins incurs the same maintenance and infrastructure costs as mentioned above.
Once again, cloud services are available that provide free browser testing for open source repositories. The most well-known vendor is SauceLabs, but other options are available for browser testing, such as Testling, and Drone.io. Cloud browser testing can actually do more than a comparable Jenkins stack. For example, SauceLabs can run your tests against several hundred combinations of browsers and operating systems without the hassle of maintaining those operating systems.
Should You Open Source Your Project?
If you are looking for a way to contribute back to the community, the answer to the question above is easy: YES!
For some projects, giving back isn’t a high priority, and that’s okay. However, if funding and staffing costs for a project are a concern, maintaining continuous integration infrastructure can be significant. Your ability to run unit tests, static analysis, browser testing, and deployments for free can result in significant long-term savings.