What is Continuous Integration (CI)
- Vishesh Kalia
- Aug 10, 2020
- 4 min read
Updated: Aug 13, 2020
Continuous integration (CI) is the practice of automating the integration of code changes from multiple contributors into a single software project. The CI process is comprised of automatic tools that assert the new code’s correctness before integration. A source code version control system is the crux of the CI process. The version control system is also supplemented with other checks like automated code quality tests, syntax style review tools, and more.
Continuous integration (CI) is a practice where a team of developers integrate their code early and often to the main branch or code repository. The goal is to reduce the risk of seeing “integration hell” by waiting for the end of a project or a sprint to merge the work of all developers.
One of the primary benefits of adopting CI is that it will save you time during your development cycle by identifying and addressing conflicts early. It’s also a great way to reduce the amount of time spent on fixing bugs and regression by putting more emphasis on having a good test suite. Finally, it helps share a better understanding of the codebase and the features that you’re developing for your customers.
Continuous integration refers to the build and unit testing stages of the software release process. Every revision that is committed triggers an automated build and test. The first step on your journey to continuous integration: setting up automated testing.
Running your tests automatically
To adopt continuous integration, you will need to run your tests on every change that gets pushed back to the main branch. To do so, you will need to have a service that can monitor your repository and listen to new pushes to the codebase. There are many solutions that you can choose from both on-premise and in the Cloud. You’ll need to consider the following to pick your server:
Where is your code hosted?
What OS and resources do you need for your application?
How much resource do you need for your tests?
How many developers are on your team?
Adopting continuous integration
While automating your tests is a key part of CI it is not enough by itself. You may need to change your team culture to make sure that developers do not work days on a feature without merging their changes back to the main branch and you’ll need to enforce a culture of a green build
Integrate early and often
Keep the build green at all time
Write tests as part of your stories
Write tests when fixing bugs
Work towards leveraging CI to enable your QA Engineers to scale quality
How does Continuous Integration Work?
With continuous integration, developers frequently commit to a shared repository using a version control system such as Git. Prior to each commit, developers may choose to run local unit tests on their code as an extra verification layer before integrating. A continuous integration service automatically builds and runs unit tests on the new code changes to immediately surface any errors.
With continuous delivery, code changes are automatically built, tested, and prepared for a release to production. Continuous delivery expands upon continuous integration by deploying all code changes to a testing environment and/or a production environment after the build stage.
What is the Best CI Tool For Your Company?
When choosing a CI tool for your team there are a few important decision-making factors to consider.
Version Control System support: The core pillar of a CI / CD system is the support and integration of the underlying Version Control System (VCS). The most popular VCS’s are Git, Subversion, Mercurial and Perforce. cloud CI tools may offer support for some or all of these VCS’s. It is critical to choose a CI tool that offers support for your projects VCS.
On-premises vs Cloud: Some of the aforementioned CI Tools like Jenkins can be installed on-premises. This means your team is responsible for configuring and managing the CI system on your own infrastructure. This can be beneficial for privacy and security reasons. For example, if you have customer data privacy concerns to meet compliance standards, on-premises may be a requirement. Additionally, on-premises instances may offer deeper customization and configuration options. On-premises can be extra work that is not in line with your core business needs. Cloud options outsource the management of the CI Tool to a 3rd party vendor.
Container support: Containerization is a modern software development trend. Containerization enables the distribution of an immutable, repeatable, isolated copy of an application. Containerization is enabled by tools like Docker, and Kubernetes. Modern CI Tools will offer support for integrating containers into the CI/CD process. Containers solve the “works on my machine” problem. Ensuring that application code is packaged in a frozen snapshot of system level dependencies.
Plugins and 3rd party integrations: CI Tools become even more useful when integrated with the rest of your tech stack. Analytics about engineering team efficiency and performance can be collected from CI tools.
To summarize continuous integration in 5 steps
Start writing tests for the critical parts of your codebase.
Get a CI service to run those tests automatically on every push to the main repository.
Make sure that your team integrates their changes everyday.
Fix the build as soon as it’s broken.
Write tests for every new story that you implement.
Some of common CI tools used are:
Bitbucket Pipelines (https://bitbucket.org/product/features/pipelines)
Jenkins (https://jenkins.io/)
AWS CodePipeline (https://aws.amazon.com/codepipeline/)
CircleCI (https://circleci.com/)
Azure Pipelines (https://azure.microsoft.com)
GitLab (https://about.gitlab.com)
Atlassian Bamboo (https://www.atlassian.com/software/bamboo)
Comments