Capitolo 5 – Continuous Integration

Di seguito trovate il libro: Continuous Integration: Improving Software Quality and Reducing Risk Paul M. Duval

Questo libro esplora gli aspetti dell’automazione di  Continuous Integration, per i molteplici benefici che ne derivano. E’ consigliata la lettura della Prefazione, di cui riportiamo un estratto, poiché sintetizza la tematica di Continuous Integration.

Preface – What Is Continuous Integration?

Waiting until the end of a project to integrate leads to all sorts of software quality problems, which are costly and often lead to project delays. CI addresses these risks faster and in smaller increments. In his popular “Continuous Integration” article (See martinfowler.com/articles/) , Martin Fowler describes CI as:: . . . a software development practice where members of a team integrate their work frequently, usually each person integrates at least daily—leading to multiple integrations per day. Each integration is verified by an automated build (including test) to detect integration errors as quickly as possible. Many teams find that this approach leads to significantly reduced integration problems and allows a team to develop cohesive software more rapidly. In my experience, this means that:

  • All developers run private builds on their own workstations before committing their code to the version control repository to ensure that their changes don’t break the integration build.
  • Developers commit their code to a version control repository at least once a day.
  • Integration builds occur several times a day on a separate build machine.
  • 100% of tests must pass for every build.
  • A product is generated (e.g., WAR, assembly, executable, etc.) that can be functionally tested.
  • Fixing broken builds is of the highest priority.
  • Some developers review reports generated by the build, such as coding standards and dependency analysis reports, to seek areas for improvement.

Rapid Feedback

Continuous Integration increases your opportunities for feedback. Through it, you learn the state of the project several times a day. CI can be used to reduce the time between when a defect is introduced and when it is fixed, thus improving overall software quality. A development team should not believe that because their CI system is automated, they are safe from integration problems. It is even less true if the group is using an automated tool for nothing more than compiling source code; some refer to this as a “build,” which it is not (see Chapter 1). The effective practice of CI involves much more than a tool. It includes the practices we outline in the book, such as frequent commits to a version control repository, fixing broken builds immediately, and using a separate integration build machine. The practice of CI enables faster feedback. When using effective CI practices, you’ll know the overall health of software under development several times a day. What’s more, CI works well with practices like refactoring and test-driven development, because these practices are centered on the notion of making small changes. CI, in essence, provides a safety net to ensure that changes work with the rest of the software. At a higher level, CI increases the collective confidence of teams and lessens the amount of human activity needed on projects, because it’s often a hands-off process that runs whenever your software changes.”

Il libro è suddiviso in 2 Parti. La prima parte è un’introduzione alla CI ed è rivolta a quei lettori che non hanno familiarità con le pratiche fondamentali di CI. La seconda parte espande i concetti di base in altri processi efficaci eseguiti dai sistemi CI, come testing, inspection, deployment, and feedback. Di seguito vi riportiamo l’indice degli argomenti che potrebbero essere utilizzati per approfondimenti specifici.

Part I: A Background on CI—Principles and Practices

Chapter 1, Getting Started, gets you right into things with a high-level example of using a CI server to continuously build your software. Chapter 2, Introducing Continuous Integration, familiarizes you with the common practices and how we got to CI. Chapter 3, Reducing Risks Using CI, identifies the key risks CI can mitigate using scenario-based examples. Chapter 4, Building Software at Every Change, explores the practice of integrating your software for every change by leveraging the automated build.

Part II: Creating a Full-Featured CI System

Chapter 5, Continuous Database Integration, moves into more advanced concepts involving the process of rebuilding databases and applying test data as part of every integration build. Chapter 6, Continuous Testing, covers the concepts and strategies of testing software with every integration build. Chapter 7, Continuous Inspection, takes you through some automated and continuous inspections (static and dynamic analysis) using different tools and techniques. Chapter 8, Continuous Deployment, explores the process of deploying software using a CI system so that it can be functionally tested. Chapter 9, Continuous Feedback, describes and demonstrates the use of continuous feedback devices (such as e-mail, RSS, X10, and the Ambient Orb) so that you are notified on build success or failure as it happens.

Degno di nota su questo argomento è l’articolo già citato nel Capitolo 1 Extreme-Programming.pdf di cui riportiamo un estratto:

“Developers always keep the system fully integrated. XP teams take iterative development to another level because they commit code multiple times a day, which is also called continuous delivery. XP practitioners understand the importance of communication. Programmers discuss which parts of the code can be re-used or shared. This way, they know exactly what functionality they need to develop. The policy of shared code helps eliminate integration problems. In addition, automated testing allows developers to detect and fix errors early, before deployment.“

Libro