Almost everybody does Continuous Integration today. But the question is : How effective is your Continuous Integration? In this short article, let’s explore five important questions we need to ask about Continuous Integration (CI).
Article Series
This is the last article in a series of eight articles on Code Quality
- 1 - Introduction To Code Quality
- 2 - Introduction To Coding Standards - Java examples
- 3 - Five Important Coding Standards
- 4 - Best Practices in Static Code Analysis with SonarQube
- 5 - Code Review Best Practices
- 6 - What Are Code Smells?
- 7 - What Is Refactoring?
- 8 - Continuous Integration - 5 Important Questions or Tips
Questions To Ask About Continuous Integration
Let’s look at them one by one:
Frequency Of Commits
How frequently is code being committed to the version control system?
It is awesome to have great CI infrastructure in place with frequent builds, wonderful unit tests and integration tests. However, if code is not committed frequently enough to the repository, all this infrastructure is sitting idle.
Whenever you think your code is in a good working state, commit it to get immediate feedback. Do this five, ten, or a hundred times a day!
Frequency Of Builds
How often are your CI builds running?
Are they running every time a commit is done, every minute, every hour, or once a day? With CI, it is important to get immediate feedback. If you are running your builds less frequently, you might be enjoying all the possible benefits of CI.
Ideally, CI should run for every commit.
What’s in the Build?
What are the various steps that are run in your CI build?
Are all of these are run in CI?
- Code compilation
- Unit tests
- Integration tests
- User acceptance tests
- Deployment
It is desirable to have as many steps as possible as part of the CI build.
Build Performance
How fast is your CI build?
Any CI build should not take more than 10-15 minutes of time, as a benchmark. Of course, the steps involved in the build affects build performance.
As the number of steps in the build increase, the longer it takes. You need to find the right balance between the two, such as testing everything versus testing quickly.
One strategy would be to have two kinds of CI builds - one smaller frequent build, and one larger slower build that only runs from time to time.
Handling Broken Builds
This is one of the more fun events for the team. Having the member who breaks the build, buy lunch for the entire team is incentive enough for careful programming and commits! Not the least, it helps foster team building and team spirit.
Do check out our video on this:
Summary
In this article, we explored the five important questions that a team using a CI infrastructure, to ask about its development process.