How to Best Implement Continuous Integration

Share on linkedin
Share on twitter
Share on facebook

Before delving into what the best practices are around Continuous Integration (CI), perhaps a proper definition of CI is necessary.

What is Continuous Integration?

CI is a software development practice where members of a team integrate their code changes with the existing code repository frequently; each person integrates at least once daily – leading to multiple integrations per day. Each integration/commit to the baseline is followed by an automated build (including test) so that no errors can remain unnoticed by developers.

Best Practice for Continuous Integration

A best practice here is to trigger the build after every commit rather than having a scheduled build. Defects usually appear not only in just the code, but also in the naming conventions, documentation, how the software is designed, build scripts, the process of deploying the software to servers, and so on. CI forces the defects to emerge early, rather than waiting for software to be fully produced. If defects are caught in the later stages of the software development lifecycle, the process is usually much more expensive.

Many teams find that this approach leads to significantly reduced integration issues and allows a team to develop software more rapidly.

Here are some basic rules to remember for a successful CI implementation:
  1. Maintain a single source repository. Everything that is required for a build should be in a source control system.
  2. Fully automated build scripts. Anyone should be able to bring in a new machine, check the sources out of the repository, issue a command and have a running system on their machine.
  3. Write unit tests for all new code and code fixes. All unit tests must be part of the source control.
  4. Run private developer builds including unit tests before committing to the CI branch.
  5. Commit code frequently to the CI branch.
  6. Do not commit broken code or code that breaks unit tests.
  7. Fix broken builds immediately. If the mainline build fails it needs to be fixed right away.
  8. Write automated tests.
  9. Do not pull broken code into development branches.

Remember, the effectiveness of a CI environment is strictly dependent on the developer’s discipline and adherence to established practices / procedures (e.g. Merge CI branch into the local development branches few times a day, to ensure any potential merge / code conflicts are spotted and addressed as early as possible) as well as the effectiveness and test coverage (the higher percentage – the more reliable builds).

Next Pathway is one of North America’s leading Digital Transformation technology firms. Contact Chetan Mathur, CEO cmathur@nextpathway.com for further information.
[x_share title=”Share this Post” twitter=”true” linkedin=”true” email=”true”]

Share on linkedin
Share on twitter
Share on facebook