Wednesday, July 24, 2019

An introduction to Continuous Integration (CI), its benefits and tools used


What is Continuous Integration?


Continuous Integration is a development practice that requires developers to integrate code into a shared repository several times a day. Each commit is then verified by an automated build, allowing team to detect problems early.



Continuous Integration (CI) is the process of automating the build and testing of code every time a team member commits changes to version control. CI encourages developers to share their code and unit tests by merging their changes into a shared version control repository after every small task completion. Committing code triggers an automated build system to grab the latest code from the shared repository and to build, test, and validate the full master branch (also known as the trunk or main).

CI emerged as a best practice because software developers often work in isolation, and then need to integrate their changes with the rest of the team’s code base. Waiting days or weeks to integrate code creates many merge conflicts, hard-to-fix bugs, diverging code strategies, and duplicated efforts. CI requires the development team’s code to be continuously merged to a shared version control branch to avoid these problems.

CI keeps the master branch clean. Teams can leverage modern version control systems such as Git to create short-lived feature branches to isolate their work. A developer submits a “pull request” when the feature is complete and, on approval of the pull request, the changes get merged into the master branch. Then the developer can delete the previous feature branch. Development teams repeat the process for additional work. The team can establish branch policies to ensure the master branch meets desired quality criteria.

Teams use build definitions to ensure that every commit to the master branch triggers the automated build and testing processes. Implementing CI as described here ensures bugs are caught earlier in the development cycle, which makes them less expensive to fix. Automated tests run for every build to ensure builds maintain a consistent quality.


Benefits of Continuous Integration

Continuous Integration (CI) provides many benefits to the development process, including:
  • Improving code quality based on rapid feedback
  • Triggering for automated testing for every code change
  • Reducing build times for rapid feedback and early detection of problems (risk reduction)
  • Better managing technical debt and conducting code analysis
  • Reducing long, difficult, and bug-inducing merges
  • Increasing confidence in code base health long before production
  • Key Benefit: Rapid Feedback for Code Quality

Possibly the most important benefit of continuous integration is rapid feedback to the developer. If the developer commits something and it breaks the code, he or she will know that almost immediately from the build, unit tests, and through other metrics. If successful integration is happening across the team, the developer is also going to know if her or his code change breaks something that another team member did to a different part of the code base. This process removes very long, difficult, and drawn out bug-inducing merges, which allows organizations to deliver in a very fast cadence.

Continuous integration also enables tracking metrics to assess code quality over time, such as unit test pass rates, code which breaks frequently, code coverage trends, and code analysis. It can be used to provide information on what has been changed between builds for traceability benefits, as well as for introducing anecdotal evidence of what teams do in order to have a global view of build results.


Three Pillars of Continuous Integration


Continuous Integration relies on three foundational elements for successful implementation. For each element, your team needs to select the specific platforms and tools they will use, but you must ensure that you have established each pillar in order to proceed. The Three Pillars of Continuous Integration are:
  • A Version Control System
  • A Continuous Integration System
  • An Automated Build Process

Tools used for Continuous Integration:

SL.Version ControlContinuous IntegrationAutomated Build Process
1GitJenkinsMaven
2T-SVNBambooTeam Build
3PerforceTeamCityApache ANT
4CVSVisual Studio Team ServicesGradle




No comments:

Post a Comment

Please keep your comments relevant.
Comments with external links and adult words will be filtered.