23
Continuous integration -Case Study- Hudson Munteanu Liviu Andrei TIE - an 2

Hudson

Embed Size (px)

DESCRIPTION

Continuous integration with Hudson

Citation preview

Page 1: Hudson

Continuous integration

-Case Study- Hudson

Munteanu Liviu AndreiTIE - an 2

Page 2: Hudson

Content1. What`s CI ?2. Prerequisites 3. Hudson Benefits4. Plugins5. Special Study – Eclipse

Plugins6. Lessons Learned7. Conclusions8. Demo

Page 3: Hudson

What’s Continuous Integration?

•Martin Fowler sez:Continuous Integration is 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.

Page 4: Hudson

How Developers Code

while ( not done ) { write some code; test by poking at it tediously; fix the bugs you see;}deploy;cross your fingers nobody finds new bugs;return;

Page 5: Hudson

Continuous Integration: Some Free Systems

• Cruise Control - Java-based framework for a continuous build process

• BuildBot - Open Source Python system to automate the compile/test cycle

to validate code 

• Hudson -  a continuous integration tool written in Java

Page 6: Hudson

Basic Continuous Integration

• Check the code repo for changes every few minutes• Build or compile the code• Run your tests: unit, regresssion, etc

• of course you have to have tests to run!• Alert if problems

Page 7: Hudson

Prerequisites:Automated Build

• No human intervention allowed• ant, maven• setup.py, pip, buildout (every

language has one)Code that Tests Your Code

• Can run without firing up the whole stack (web framework, security, ...)

• unit tests: junit, nose, ...• functional tests: selenium,

abott, ...• Run locally before checking in:

“don’t break the build”

Page 8: Hudson

Hudson Benefits

• Never gets bored doing builds and tests• Catches problems fast• Alerts developers while code is fresh in their minds• Prevents bugs from propagating downstream• Cheaper to fix bugs earlier, before QA or Deployment

Page 9: Hudson

Helpful PluginsSource code managementBuild triggersBuild toolsSlave launchers and controllersBuild reportsExternal site/tool integrationsUI pluginsAuthentication and user managementCluster management and distributed buildCLI extensions

Page 10: Hudson

Helpful Plugins• Subversion: code repo checkout • Cobertura: test coverage reporter• Maven: many plugins available• JDepend: Java package dependency analyzer => design quality metrics.• PMD: open source static code analysis tool looking for possible bugs • Checkstyle:  static code analysis tool checking source code compliance

with coding rules• Selenium: functional, click-testing• Monitor for Android: status on your phone• Chuck Norris: motivational help :-)

Page 11: Hudson

Eclipse PluginsPrerequisites• A running instance of Hudson CI Server• The Buckminster Plugin for Hudson

Buckminster• frameworks and tools for automating build, assemble & deploy (BA&D) development processes  • creates an update site containing all the plugins, features and binary artifacts. • the build script will then utilize the p2 director application to create the actual product from the update site's content.• To make this action known to Buckminster a CSPECX is required

Page 12: Hudson

Eclipse PluginsBuilding a Target Platform

• Target Platform contains the set of features and plugins that your source is build against. • For required features create CQUERYs and MSPECs.

Creating the Hudson Job• Start with a new Free-Style project that will create and publish the target platform for the App. • The job needs two build steps: Execute Shell and Run Buckminster. The execute shell step will delete the directory where the target platform is materialized to ensure a clean build every time.• In the Run Buckminster build step you need to import the two MSPECs defined above.• The last thing that needs to be done in the target platform is archiving the build result and publishing it. So activate the post build action "Archive and publish an Eclipse Target Platform", set the directory to the value of ${targetPlatformPath} and name the resulting artifact.

Page 13: Hudson

Lessons learned

• Automate your build• Write tests for every piece of code• Have code metrics• Plan for a continuous integration from start

Page 14: Hudson

Conclusions

• Hudson watches the code repo for commits• Checks out code• Builds it with your build ‘script’• Runs your tests• Reports problems by email and IM• Tracks metrics, if available

Page 15: Hudson

References • http://www.martinfowler.com/articles/continuousIntegration.html• http://hudson-ci.org/• http://en.wikipedia.org/wiki/Hudson_(software)• http://wiki.eclipse.org/Building_an_RCP_application_with_hudson_(Buckminster)

Page 16: Hudson

Danger! Live Demo

Page 17: Hudson

Danger! Live Demo

Page 18: Hudson

Danger! Live Demo

Page 19: Hudson

Danger! Live Demo

Page 20: Hudson

Danger! Live Demo

Page 21: Hudson

Danger! Live Demo

Page 22: Hudson

Danger! Live Demo

Page 23: Hudson

Danger! Live Demo