Delen via


Use continuous integration

Continuous integration (CI) is the process of automatically building and testing code every time a team member commits code changes to version control. A code commit to the main or trunk branch of a shared repository triggers the automated build system to build, test, and validate the full branch. CI encourages developers to share their code and unit tests by merging their changes into the shared version control repository every time they complete a task.

Software developers often work in isolation, and then need to integrate their changes with the rest of a team's code base. Waiting days or weeks to integrate code can create many merge conflicts, hard to fix bugs, diverging code strategies, and duplicated efforts. CI avoids these problems because it requires the development team's code to continuously merge to the shared version control branch.

CI keeps the main branch up-to-date. Developers can use modern version control systems like Git to isolate their work in short-lived feature branches. When the feature is complete, the developer submits a pull request from the feature branch to the main branch. On approval of the pull request, the changes merge into the main branch, and the feature branch can be deleted.

Development teams repeat this process for each work item. Teams can establish branch policies to ensure the main branch maintains desired quality criteria.

Build definitions specify that every commit to the main branch triggers the automated build and testing process. Automated tests verify that every build maintains consistent quality. CI catches bugs earlier in the development cycle, making them less expensive to fix. 

CI is a standard feature in modern DevOps platforms. GitHub users can implement CI through GitHub Actions. Azure DevOps users can use Azure Pipelines.