What are the best practices of Continuous Integration (CI)?

Some of the best practices of Continuous Integration (CI)areas follows:

  1. Build Automation: In CI, we create such a build environment that even with one command build can be triggered. This automation is done all the way up to deployment to the Production environment.
  2. Main Code Repository: In CI, we maintain a main branch in the code repository that stores all the Production ready code. This is the branch that we can deploy to Production at any time.
  3. Self-testing build: Every build inCI should be self-tested. It means with every build there are a set of tests that run to ensure that changes are of high quality.
  4. Every day commits to baseline: Developers will commit all of their changes to baseline every day. This ensures that there is no big pileup of code waiting for integration with the main repository for a long time.
  5. Build every commit to baseline: WithAutomated Continuous Integration, every time a commit is made into baseline, a build is triggered. This helps in confirming that every change integrates correctly.
  6. Fast Build Process: One of the requirements of CI is to keep the build process fast so that we can quickly identify any problem.
  7. Production-like environment testing: In CI, we maintain a production-like environment also known as a pre-production or staging environment, which is very close to the Production environment. We perform testing in this environment to check for any integration issues.
  8. Publish Build Results: We publish build results on a common site so that everyone can see these and take corrective actions.
  9. Deployment Automation: The deployment process is automated to the extent that in a build process, we can add the step of deploying the code to a test environment. In this test environment, all the stakeholders can access and test the latest delivery.