Software systems are complex, and in a big team of developers, there might be constant pressure to produce output without compromising first, the software's quality and secondly, the time spent working on it. A clean and efficient software development workflow does require the two to go hand in hand, and the modern response to that is the necessity to implement automated tests, code validation processes and deployments as part of the development routine.
Historically, teams of developers would not only write unit tests, code coverage tests and deployment monitoring systems, but it would also be necessary for them to maintain and run those tests against every build before pushing deployments to staging or production.
This methodology requires a lot of efforts and essentially adds a lot of overhead to the developer's time. Continuous Integration and Continuous Deployment offer streamlined solutions to this problem by taking the heavy-lifting on the testing, monitoring and deployment procedures.
We can separate CI into three distinct stages:
Continuous Integration builds and tests softwares after every push. It does not deploy the build.
Continuous Delivery deploys every change made to the code to a staging environment, and allows for a push to production on demand.
Continuous Deployment takes it even further, every code changes going through the pipeline will merge into production automatically.
There are many success stories about Continuous Integration. For example. HP attests that after 3 years, their development costs per program went down 78% by integrating Continuous Delivery. (source: https://continuousdelivery.com/evidence-case-studies/)
One of the most interesting statistic comes from the Oregon State University, who conducted a research among GitHub projects to assess the popularity and efficiency of continuous integration in open source projects. They analyzed 34,544 open source projects from GitHub and measured different metrics with the intention to reveal certain patterns.
If CI leads to better outcomes, then we would expect to see higher usage of CI among the most popular projects. By correlating CI usage with the number of stars of a project, they indeed found that popular projects are more likely to use CI.
This shows direct correlation between the quality and performance of a project. Another part of their research found that software teams were increasingly implementing continuous integration systems as part of their workflow. Projects that switched to CI ended up releasing more than twice as often as those that didn't.
6 Valuable Benefits with CI
At Hybrid Heroes, we have found many advantages to implementing CI in our projects. We have compiled a list of all the optimizations we witnessed along the way.
1- Every time our code will go through the CI pipeline, it will be running inside the same environment. By isolating the code inside a specific container, we avoid the common development issue of "it works on my machine" and improve predictability.
2- Code coverage and Test coverage can be calculated and streamlined into the new development workflow with minimal human interaction. This gives direct feedback to our team and can also motivate us to write better tests and enforce cleaner code. This kind of practice does ultimately also drive telemetry by continuously generating data that can be used down the line to measure the performance and stability of our code.
3- We increase transparency across our team. One feature being developed in one branch can shed light on particularly fragile areas of the code by triggering tests errors on the pipeline and exposing them to other developers. Our project managers are always aware of failed pipelines, this might be useful information for them and help them anticipate problems with their own features. We are improving communication across the team and enhancing the visibility of bugs and roadblocks that would otherwise have needed to go through many layers of communication before being global knowledge.
4- By enforcing standards of code quality and leveraging test results, we are decreasing time spent in code review. Bugs will be caught early on and leave the code review focused on important decisions, rather than syntax or functional issues that can easily be tested against a machine. That leaves our developers focused on their own tasks.
5- Code is tested before it is built, and tested again. This is crucial, as this avoids merging problematic branches to master. As a result, builds and deployments on the master branch are more likely to be bug-free and well-tested. In the context of a deployment to production, this is even more important because it avoids human errors to be introduced before a build is manually generated.
6- Faster development and shipping times: We have found that by integration these automated solutions, the ultimate by-product of all those optimizations is an enormous gain of time. This results in a much higher velocity for our business. If we implement pieces of code faster, we can react to market needs and produce high quality features faster than the competition, and we stay ahead of the pack.
In conclusion, we can safely affirm that by automating tests, builds and deployments through Continuous Integration, we provide to our software development workflow a faster and reliable way to merge features and ship products. By relying on a low-risk and controlled environment, we avoid common pitfalls and focus our developer time on integrating high quality features that finally makes us and clients happier.
Here is what Lucie, project manager at Hybrid Heroes, has to say:
CI was a real game-changer for projects with a lot of QA iterations. Project managers have immediate access to the latest state of the app and can test it autonomously.