JavaScript + Jenkins = Winning!

  • 49,476 views
Uploaded on

How to build and analyze Javascript projects and integrate that with Jenkins CI

How to build and analyze Javascript projects and integrate that with Jenkins CI

More in: Technology
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
No Downloads

Views

Total Views
49,476
On Slideshare
0
From Embeds
0
Number of Embeds
24

Actions

Shares
Downloads
229
Comments
4
Likes
76

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. © 2011 @eriwen
  • 2. Eric WendelinBlog: eriwen.comTwitter: @eriwenCode: git.io/eric
  • 3. ( °□° ɐpuǝƃV• Tools that help your JS not suck• How to create a build for your client-side code• Automation with Jenkins• The hard part• Unicorns
  • 4. The Situation
  • 5. Programmers are expensiveMust prevent them from doing things below their pay grade
  • 6. How do you do that?Automate tasks that dontrequire mental participation
  • 7. Programmers are clever Must force them to writecode for the next engineer
  • 8. Better for the next engineer?Must enforce conventions that make the code more understandable
  • 9. ?
  • 10. First things firstWe need automation tools
  • 11. Static Analysis
  • 12. JSHintjshint file.js --config config.json jshint.org
  • 13. CSSLintcsslint --rules=rule,rule2 file.css csslint.net
  • 14. Testing
  • 15. Unit-testing• Jasmine (pivotal.github.com/jasmine)• QUnit (docs.jquery.com/QUnit)• YUI Test (yuilibrary.com/yui/docs/test)• Mocha (visionmedia.github.com/mocha)• Lots of others...
  • 16. PhantomJSphantomjs your-runner.js file.html phantomjs.org
  • 17. Xvfb
  • 18. JsTestDriverjava -jar JsTestDriver.jar --tests allcode.google.com/p/js-test-driver/
  • 19. Functional testing• Selenium (seleniumhq.org)• CasperJS (github.com/n1k0/casperjs)• zombie.js (zombie.labnotes.org)
  • 20. Documentation
  • 21. jsduckjsduck src/js --output target/docsgithub.com/senchalabs/jsduck
  • 22. Page Speed
  • 23. Closure Compiler java -jar compiler.jar --js file.js --js_output_file file.min.jscode.google.com/closure/compiler
  • 24. YUI Compressor java -jar yuicompressor.jar -o .css$:-min.css *.cssdeveloper.yahoo.com/yui/compressor
  • 25. Combine and gzipcat file1.js file2.js >> combined.jsgzip combined.jsmv combined.js{.gz,}
  • 26. ?
  • 27. The Build
  • 28. Build Steps• Static Analysis• File Optimization (for production)• Automated Testing• Documentation• Report Results
  • 29. Gradle
  • 30. Dont have a build?
  • 31. html5boilerplate.com
  • 32. Introducing the Gradle Web Suite
  • 33. git.io/gradlejsgit.io/gradlecssgit.io/gradlehtml
  • 34. jenkins-ci.org
  • 35. Crazy Simple Setupwget http://mirrors.jenkins-ci.org/war/latest/jenkins.warjava -jar jenkins.war
  • 36. Source Control Plugins• Git• Mercurial• Bazaar• Subversion• CVS• Lots more...
  • 37. Build System Plugins• Gradle• Maven• Ant• Rake• Lots more...
  • 38. Runs pretty much everything• Ruby• Python• NodeJS• Groovy• Shell• Lots more...
  • 39. Build Health Plugins• Violations Plugin• Selenium Plugin• Cobertura Plugin• Task Scanner Plugin• ...and, of course, Chuck Norris Plugin
  • 40. The really hard part
  • 41. 5 Stages of JS CI• No build server• Pulls from source control and runs metrics• Runs unit tests and fails build if necessary. One button push to staging/production env• Unit and acceptance tests run. Metrics affect build stability• Code deployed on every push that passes the build
  • 42. Helpful Tweeters@ariyahidayat works on #phantomjs@gseguin helped me with QUnit/Phantom@builddoctor general CI advocate/guru@jfroma does cool #jsci on Windows@jamescarr couldve given this talk well
  • 43. One more thing...
  • 44. LCOV to Cobertura converter git.io/ltc
  • 45. Code at: git.io/ericBlog: eriwen.comTwitter: @eriwen