Continuous integration with Git & CI Joe
Upcoming SlideShare
Loading in...5
×
 

Like this? Share it with your network

Share

Continuous integration with Git & CI Joe

on

  • 7,405 views

 

Statistics

Views

Total Views
7,405
Views on SlideShare
7,404
Embed Views
1

Actions

Likes
5
Downloads
56
Comments
0

1 Embed 1

https://duckduckgo.com 1

Accessibility

Categories

Upload Details

Uploaded via as OpenOffice

Usage Rights

CC Attribution-NonCommercial-ShareAlike LicenseCC Attribution-NonCommercial-ShareAlike LicenseCC Attribution-NonCommercial-ShareAlike License

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Continuous integration with Git & CI Joe Presentation Transcript

  • 1.
      Simple Continuous Integration using Git and  CI Joe
      Shawn Price drupal.org: langworthy twitter: @sprice
  • 2.
      Continuous Integration Defined
      "Continuous Integration is a software development practice where members of a team integrate their work frequently..." "Many teams find that this approach leads to significantly reduced integration problems and allows a team to develop cohesive software more rapidly" - Martin Fowler
      martinfowler.com/articles/continuousIntegration.html
  • 3.
      Continuous Integration Defined
      Continuous Integration is a fancy term for “run your project’s tests after someone pushes to the repository and notify interested parties if they fail” - Chris Wanstrath
      github.com/blog/471-continuous-integration-spring-cleaning
  • 4.
      Components of Continuous Integration
      • Use a code repository
      • 5. Test your code
      • 6. Automate the testing
  • 7.
      Use a code repository
  • 8.
      Use a code repository
      In the beginning there was FTP.
  • 9.
      Use a code repository
      In the beginning there was FTP. And things were good.
  • 10.
      Use a code repository
      5 minutes later....
  • 11.
      Use a code repository
      5 minutes later.... Things were bad.
  • 12.
      Use a code repository
      5 minutes later.... Things were bad. "Who made that change?" "There's a bug, lets put the previous version of the file back" etc.
  • 13.
      Use a code repository
      Greetings Git!
  • 14.
      Use a code repository
      Greetings Git! A free & open source distributed version control system.
      • git-scm.com/
      • 15. progit.org/book/
      • 16. drupal.org/community-initiatives/git
  • 17.
      Use a code repository
      Using a code repository allows teams to:
      • track the history of changes
      • 18. use branches to manage feature integration
      • 19. efficiently deploy to production
      • 20. efficiently roll-back changes
  • 21.
      Use a code repository
      Meet the Amazing Module!
  • 22.
      Use a code repository
      DEMO time: 
      • Create a new git repository
      • 23. Include Drupal and the Amazing module
  • 24.
      Test your code
  • 25.
      Test your code
      Drupal 6: drupal.org/project/simpletest Simpletest is in Drupal 7 core.
  • 26.
      Test your code
      amazing.test
      <?php
      class AmazingTestCase extends DrupalWebTestCase {    public static function getInfo () {      return array (        'name' => t( 'Amazing functionality' ),        'description' => ( 'Test for amazingness' ),        'group' => t( 'Amazing' ),      );    }    function setUp () {      parent:: setUp ( 'amazing' );    }    public function testAmazingPageContent () {      $this -> drupalGet ( &quot;amazing&quot; );      $this -> assertResponse ( 200 );      $this -> assertText (t( 'Simply amazing!' ));    } }
  • 27.
      Test your code
      DEMO time:
      • running tests in the Drupal UI
      • 28. running tests with drush -  github.com/yhahn/drush_test
  • 29.
      Automate the testing
  • 30.
      Automate the testing
      Choosing a Continuous Integration server
  • 31.
      Automate the testing
      Choosing a Continuous Integration server
      • Hudson?
      • 32. Cruise Control?
      • 33. and more...
  • 34.
      Automate the testing
      Choosing a Continuous Integration server
      • Hudson? (Java)
      • 35. Cruise Control? (Java)
      • 36. and more... (many are tricky to install)
  • 37.
      Automate the testing
      Meet CI Joe! github.com/defunkt/cijoe
  • 38.
      Automate the testing
      CI Joe was created out of the desire to do CI simply
      • configure via git config
      • 39. $ git config --add cijoe.runner &quot;drush test MyTestCase&quot;
      • 40. use git hooks for notifications
      • 41. easy to install with few dependencies (Ruby)
      • 42. $ gem install cijoe
      • 43. $ git clone git://github.com/you/yourrepo.git
      • 44. $ cijoe yourrepo
  • 45.
      Automate the testing
      • CI Joe runs when it receives a POST
  • 46.
      Automate the testing
      • CI Joe runs when it receives a POST
      • 47. $ curl -d &quot;payload&quot; http://ci.example.com:4567
  • 48.
      Automate the testing
      • Notifications are sent via git hooks
  • 49.
      Automate the testing
      • Notifications are sent via git hooks
           .git/hooks/build-worked
      • #!/bin/bash
      • 50. EMAIL=&quot;me@example.com&quot;
      • 51. /usr/sbin/sendmail &quot;$EMAIL&quot; <<EOD
      • 52. To: $EMAIL
      • 53. Subject: Your tests passed
      • 54. From: Testbot <testbot@ci.example.com>
      • 55. The latest integrations are good. The tests passed.
      • 56. EOD
  • 57.
      Automate the testing
      • Notifications are sent via git hooks
           .git/hooks/build-failed
      • #!/bin/bash
      • 58. EMAIL=&quot;me@example.com&quot;
      • 59. /usr/sbin/sendmail &quot;$EMAIL&quot; <<EOD
      • 60. To: $EMAIL
      • 61. Subject: Your tests failed
      • 62. From: Testbot <testbot@ci.example.com>
      • 63. The latest integrations are bad. The tests failed. Better luck next time.
      • 64. EOD
  • 65.
      Bringing it all together
      • push changes to remote git repository
  • 66.
      Bringing it all together
      • push changes to remote git repository
      • 67. Post-Receive URL triggers a POST to CI Joe
  • 68.
      Bringing it all together
      • push changes to remote git repository
      • 69. Post-Receive URL triggers a POST to CI Joe
      • 70. CI Joe runs tests
  • 71.
      Bringing it all together
      • push changes to remote git repository
      • 72. Post-Receive URL triggers a POST to CI Joe
      • 73. CI Joe runs tests
      • 74. CI Joe sends notification via git hook
  • 75.
      Bringing it all together
      DEMO TIME!
  • 76.
      Questions?
  • 77.
      Thank You.