I've been thinking about CI and automatic builds a lot lately and am interested in knowing if there are any best practices for setting up and maintaining a continuous integration environment. Do you keep all your CI related files checked in with your project source? How would you usually structure your CI and build files? Any tips are welcome!
If you haven't already, definitely check out the Continuous Integration book from the Martin Fowler series, by Duvall/Matyas/Glover. It covers all of the questions you ask in depth with solid examples.
There's also the Pragmatic Series' "Pragmatic Project Automation".
Of course, all files required to build have to be checked in. How else would CI get at them?
I've used CI with Java, so that means an Ant build.xml and either Cruise Control, Team City, or Hudson. It's possible for the build.xml to be generic if you stick with a consistent directory structure for your projects.
If your build script starts getting big you can split it out and include the relevant parts. This makes maintenance and readability better.
My other advice would be unlike traditional programming - when making a build script make use of liberal amounts of comments.
- Start with a one step build. If you don't have that, you can not have any reasonable CI
- If it isn't in source control, it doesn't exist
- If setting up and maintaining your CI exceeds the effort of setting up a developer workstation then you are overly dependent on your IDE or your project structure is overly complicated. Consider that as a refactoring opportunity.
- You don't need anything fancy to do CI. You don't even need to know what it is to do it. I wrote about my earlier experience here, when I implemented a naive CI before I ever heard the term CI.