09. Continuous Integration

Good programmers write code that humans can understand

The Integration Problem

When combining units into a product (after testing each unit individually), problems occur with integration:

Diagnosis gets harder as more units are combined.

Continuous Integration

Working software is the primary measure of progress

Agile Manifesto, 7th Principle

Integrate as you develop; when a story or unit is ready, integrate it immediately with master.

The smaller a chunk of code is, the easier it is to test and the easier it is to integrate.

Fowler’s Principles

  1. Single source repository
  2. Automate the build process
  3. Make the build self-testing
  4. Everyone commits to master/main every day
  5. Every commit trigger a build on an integration machine
  6. Broken builds should be fixed immediately
  7. Keep the build fast
  8. Test in a clone of the production environment
  9. Make it easy for everyone to get the latest executable
  10. Ensure everyone can see what is happening
  11. Automate the deployment phase

Single Source Repository

All code and resources should be in a single place:

Version Control:

Driessen’s Branching and Merging Strategy

Everyday Commits

Merge Requests and Code Review

Ensure:

Merge requests increases cross-functional knowledge and helps with onboarding.

When leaving feedback, be open-minded:

As a reviewee, remember that comments are made against the code, not you.

Be constructive and positive in giving feedback; point out what they have done right.

Managing Builds

Build after every commit. To reduce the burden of manual configuration, create automation scripts and use an integration server accessible to the team.

Self-testing: automate the build with upfront tests.

To make builds faster:

Make a snapshot of the latest stable build accessible to the team.

Automated Deployments

Requires the deployment to be scripted.

Requires rollback scripts too: