持续集成 —— 改善软件质量并降低风险的方法. Continuous Integration. 主要内容. 简介 CI 原理 CI 实践 建立一个特征全面的 CI 系统 CI 的未来. 1 简介. 内容. The components of a CI system Features of CI Questions. 1.1 The components of a CI system. Developer. 一旦修改完代码后,会进行本地 build 通过后,将变化提交到版本控制库 这一步可以随时发生,而且并不影响 CI 过程的后续步骤
Une image / un lien ci-dessous est fourni (tel quel) pour télécharger la présentation
Politique de téléchargement : le contenu du site vous est fourni TEL QUEL pour votre information et votre usage personnel ; il ne peut être vendu, concédé sous licence ni partagé sur d’autres sites sans l’accord de son auteur.Le contenu vous est fourni TEL QUEL, pour votre information et votre usage personnel uniquement.Téléchargez la présentation en cliquant sur ce lien.Lors du téléchargement, si vous ne parvenez pas à télécharger une présentation, l’éditeur a peut-être supprimé le fichier de son serveur.Pendant le téléchargement, si vous ne parvenez pas à obtenir une présentation, le fichier a peut-être été supprimé par l’éditeur.
1.2 Features of CI • Four features requiredfor CI • A connection to a version control repository • A build script • Some sort of feedback mechanism (such as e-mail) • A process for integrating the source code changes (manual or CI server)
1.3 Questions • Are you using a version control repository (or SCM tool)? • Is your project’s build process automated and repeatable? Does it occur entirely without intervention? • Are you writing and running automated tests? • Is the execution of your tests a part of your build process? • How do you enforce coding and design standards? • Which of your feedback mechanisms are automated? • Are you using a separate integration machine to build software?
2.1 What Is the Value of CI? • Reduce risks • Reduce repetitive manual processes • Generate deployable software at any time and at any place • Enable better project visibility • Establish greater confidence in the software product from the development team
Reduce Risks • Defects are detected and fixed sooner • Health of software is measurable • Reduce assumptions
Reduce Repetitive Processes • The process runs the same way every time. • An ordered process is followed • The processes will run every time a commit occurs in the version control repository.
2.2 What Prevents Teams from Using CI? • Increased overhead in maintaining the CI system • Too much change • Too many failed builds • Additional hardware/software costs • Developers should be performing these activities
How Do I Get to “Continuous” Integration? • These steps can be applied one by one to virtually every activity you conduct on a project. • Identify • Build • Share • Make it continuous
When and How Should a Project Implement CI? • It is best to implement CI early in the project. • it is more difficult to implement CI late in a project • CI is not just a technical implementation; it is also an organizational and cultural implementation. • How? • At first the build can just compile the source code and package the binaries • Then, learn the testing tool • running these tests (and inspections) with every change.
2.4 Seven Practices • Commit code frequently • Don’t commit broken code • Fix broken builds immediately • Write automated developer tests • All tests and inspections must pass • Run private builds • Avoid getting broken code
2.5 Reducing Risks Using CI • Risk: Lack of Deployable Software • Risk: Late Discovery of Defects • Risk: Lack of Project Visibility • Risk: Low-Quality Software
It Works on My Machine • Eliminating tight coupling between your IDE and your build processes. • Use a separate machine solely for integrating the software.
Synching with the Database • Place all database artifacts in your version control repository. • Rebuild the database and data from your build script, by dropping and recreating your database and tables. Next, apply the stored procedures and triggers, and finally, insert the test data. • Test (and inspect) your database.
The Missing Click • automated the deployment process by adding it to the Ant build scripts that use the application server command-line options. • reduced the bottleneck of waiting for someone else to deploy the software and eliminated mistakes.
Regression Testing • Write test code for all of your source code (an xUnit framework is a good place to start). • Run tests from your build script (Ant or NAnt are the most common). • Run tests continuously as a part of your CI system so that they are executed at every checkin to the version control repository (using CruiseControl or a similar CI server).
Test Coverage • run a code coverage tool to assess the amount of source code that is actually executed by the tests. • Using CI can ensure this test coverage is always up to date.
“Did You Get the Memo?” • we installed and configured a CruiseControl CI server on our projects with the automated mechanism that sends e-mails to affected parties when a build fails. • we added SMS notifications so that we received text messages on our mobile phones
Inability to Visualize Software • we began generating diagrams of the design using the CI system. • we also chose to create a simple one- or two-page architecture document that described the software architecture, identifying the key components and interface for new developers.
Coding Standard Adherence • we created a onepage annotated class that contained all of the coding standards. • We enforced the coding standard by using automated inspection tools as a part of the build scripts initiated by CruiseControl. • used Checkstyle and PMD to report any lines of code that were not meeting the established standards.
Architectural Adherence • Add automated inspection tools to assess adherence to the project’s architectural standards.
Duplicate Code • Add automated inspection tools such as PMD’s CPD7 or the Simian8 static analysis tools to report duplicate source code. • Refactoring!!!
内容 • Automate Builds • Perform Single Command Builds • Separate Build Scripts from Your IDE • Centralize Software Assets • Create a Consistent Directory Structure • Fail Builds Fast • Build for Any Environment
内容 • Build Types and Mechanisms • Use a Dedicated Integration Build Machine • Use a CI Server • Run Manual Integration Builds • Run Fast Builds • Stage Builds
3.1 Automate Builds • By writing automated build scripts, you reduce the number of manual, repetitive, and error-prone processes performed on a software project. • the more processes added to a build, the slower the feedback. • if you are just trying out a couple of changes and do not intend to commit anything, you may choose to run a lighter-weight build that may only perform a compile and then execute a few unit tests. • Some of the most popular build tools include Ant for Java and NAnt for .NET.
3.2 Perform Single Command Builds • “Get everything you need into source control and get it so that you can build the whole system with a single command.” • The high-level steps for building your software go something like: 1. Create your build using a build scripting tool like NAnt, Rake, Ant, or Maven. Keep it simple at first; you can add more processes as you go. 2. Add each process (clean, compile, etc.) of the Integrate button within the build script. 3. Run the script from an IDE or the command line to build software.
Connexion au compte
Connectez-vous pour publier votre contenu sur SlideServe.