The most complete build I ever saw did the following things in the given order. There are two groups, all targets in each group are executed regardless of failure, but the group fails if a member of the group fails. So we see ALL problems.
First group working on sources:
- clean work directory
- update to newest sources, get everything from SVN
- compile sources, rmic etc.
- valudate XML resources (as at least in Java there were a lot, like deployment descriptors, stylesheets etc.)
- do static code analysis available for sources, e.g. checking whitespace, coding conventions namings, file names, or more sophisticated checks done on the AST of the source (like PMD does it for Java).
- check naming conventions of other files, e.g. we checked the names of all dependant libraries to contain a version number.
Second group is working on the produced code, only if the first step succeeded:
- run the unit tests
- run fast integration tests
- do static code analysis available for sources (most tools for Java do it this way), e.g. checking for typical bug patterns (like Findbugs does it for Java)
- do reference checking, e.g. enforce layering of architecture, allowance of usage of certain classes from other classes etc.
- create the full deployment package
This is the main build that is triggered time after time for commits. It did a lot, but with some powerfull machine using several cores it was around 4 mins for 500k LOC. Testers can get the newest snapshot builds if they like to.
Long running integration tests (2 hours each) would run once per night and only do
- compile
- run long running tests
Another build was a purely documantion build, triggered once per night. It would never fail.
- create API documentation
- do a full static code analysis with all rules and produce some kind of indicator for the overall project quality
- produce coverage reports (it's a pity we did not enforce coverage to grow) from all projects build before
- produce all kind of fancy documentation like Maven site or Sonar report etc. This is for management/QA most of the time.