Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Continuous Integration on my work

587 views

Published on

Published in: Technology
  • Be the first to comment

Continuous Integration on my work

  1. 1. Continuous Integration on my work Kewang
  2. 2. Agenda ● What is Continuous Integration ? ● CI software ● CI integrate 3rd-party software ● How to apply CI to my work ? ● Live DEMO ● CI Principles ● TODO list 2
  3. 3. What is Continuous Integration ?
  4. 4. Continuous Integration is ... ● CI ● An important role at Agile & TDD 4
  5. 5. Continuous Integration should have ● Split source code to small & easy-maintain snippets ● Test snippets ● Commit source code to VCS frequently ● Auto checkout latest source code & run all tests 5
  6. 6. Case Study
  7. 7. Case Study 1 7
  8. 8. Case Study 2 8
  9. 9. Case Study 3 9
  10. 10. CI software
  11. 11. Travis CI 11
  12. 12. Hudson / Jenkins 12
  13. 13. CI integrate 3rd-party software
  14. 14. 3rd-party software includes ... ● Version Control System (i.e. Git / SVN / others) ● Redmine ● Maven ● Pandoc ● more & more ...... 14
  15. 15. Git ● git clone ● git push ● git add ● git branch ● git rm ● git checkout ● git commit ● git merge ● git pull 15
  16. 16. Redmine ● Project management ● Issue tracking ● Wiki ● Forum ● File management 16
  17. 17. Maven ● Making the build process easy ● Providing a uniform build system ● Convention over Configuration (CoC) ● Dependency management 17
  18. 18. Pandoc ● ● ● It can convert markup file to many format documents. Markup file, like Markdown, HTML, LaTeX, Wiki, or other markup language. Artifact has more format, like Markdown, HTML, docx, EPUB, PDF, ......etc. 18
  19. 19. How to apply CI to my work ?
  20. 20. Example ● Auto-deploy backend program ● Auto-publish API spec 20
  21. 21. Auto-deploy backend program
  22. 22. Step by step 1.Check out the latest source code 2.Compile it to jar file 3.Upload to backend 22
  23. 23. Step by step 1.Check out the latest source code from `dev` 2.Compile it to jar file 3.Merge `dev` to `master` 4.Upload to backend 23
  24. 24. Step by step 1.Check out the latest source code from `dev` 2.Compile it to jar file 3.Merge `dev` to `master` 4.Upload to backend 1. Stop backend 24
  25. 25. Step by step 1.Check out the latest source code from `dev` 2.Compile it to jar file 3.Merge `dev` to `master` 4.Upload to backend 1. Stop backend 2. Copy jar & its dependency files to backend 25
  26. 26. Step by step 1.Check out the latest source code from `dev` 2.Compile it to jar file 3.Merge `dev` to `master` 4.Upload to backend 1. Stop backend 2. Copy jar & its dependency files to backend 3. Start backend 26
  27. 27. Step by step 1.Check out the latest source code from `dev` 2.Compile it to jar file 3.Merge `dev` to `master` 4.Upload to backend 1. Stop backend 2. Copy jar & its dependency files to backend 3. Start backend 5.Send mail to all RD 27
  28. 28. Step by step 1.Check out the latest source code from `dev` 2.Compile it to jar file 3.Merge `dev` to `master` 4.Upload to backend 1. Stop backend 2. Copy jar & its dependency files to backend 3. Start backend 5.Send mail to all RD 1. Send mail to backend RD if failure 28
  29. 29. Auto-publish API spec
  30. 30. Step by step 1.Check out the latest Markdown 2.Convert Markdown to PDF 3.Upload PDF to Redmine 30
  31. 31. Step by step 1.Check out the latest Markdown from `dev` 2.Convert Markdown to PDF 3.Upload PDF to Redmine 4.Merge `dev` to `master` 31
  32. 32. Step by step 1.Check out the latest Markdown from `dev` 2.Convert Markdown to PDF 3.Upload PDF to Redmine 1. Call RESTful API to upload PDF file to Redmine 4.Merge `dev` to `master` 32
  33. 33. Step by step 1.Check out the latest Markdown from `dev` 2.Convert Markdown to PDF 3.Upload PDF to Redmine 1. Call RESTful API to upload PDF file to Redmine 2. Send file id to Redmine 4.Merge `dev` to `master` 33
  34. 34. Step by step 1.Check out the latest Markdown from `dev` 2.Convert Markdown to PDF 3.Upload PDF to Redmine 1. Call RESTful API to upload PDF file to Redmine 2. Send file id to Redmine 3. Place the file into Files at Redmine 4.Merge `dev` to `master` 34
  35. 35. Step by step 1.Check out the latest Markdown from `dev` 2.Convert Markdown to PDF 3.Upload PDF to Redmine 1. Call RESTful API to upload PDF file to Redmine 2. Send file id to Redmine 3. Place the file into Files at Redmine 4.Merge `dev` to `master` 5.Send file link at Redmine to all RD 35
  36. 36. Live DEMO
  37. 37. CI Principles
  38. 38. Principles for Developers 1.Commit code frequently 38
  39. 39. Principles for Developers 1.Commit code frequently 2.Don't commit broken code 39
  40. 40. Principles for Developers 1.Commit code frequently 2.Don't commit broken code 3.Fix broken builds immediately 40
  41. 41. Principles for Developers 1.Commit code frequently 2.Don't commit broken code 3.Fix broken builds immediately 4.Write automated developers tests 41
  42. 42. Principles for Developers 1.Commit code frequently 2.Don't commit broken code 3.Fix broken builds immediately 4.Write automated developers tests 5.All tests and inspections must pass 42
  43. 43. Principles for Developers 1.Commit code frequently 2.Don't commit broken code 3.Fix broken builds immediately 4.Write automated developers tests 5.All tests and inspections must pass 6.Run private builds 43
  44. 44. Principles for Developers 1.Commit code frequently 2.Don't commit broken code 3.Fix broken builds immediately 4.Write automated developers tests 5.All tests and inspections must pass 6.Run private builds 7.Avoid getting broken code 44
  45. 45. Principles for CI Engineers 1.Automate builds 45
  46. 46. Principles for CI Engineers 1.Automate builds 2.Perform single command builds 46
  47. 47. Principles for CI Engineers 1.Automate builds 2.Perform single command builds 3.Separate build scripts from your IDE 47
  48. 48. Principles for CI Engineers 1.Automate builds 2.Perform single command builds 3.Separate build scripts from your IDE 4.Centralize software assets 48
  49. 49. Principles for CI Engineers 1.Automate builds 2.Perform single command builds 3.Separate build scripts from your IDE 4.Centralize software assets 5.Create a consistent directory structure 49
  50. 50. Principles for CI Engineers 1.Automate builds 2.Perform single command builds 3.Separate build scripts from your IDE 4.Centralize software assets 5.Create a consistent directory structure 6.Fail builds fast 50
  51. 51. Principles for CI Engineers 1.Automate builds 2.Perform single command builds 3.Separate build scripts from your IDE 4.Centralize software assets 5.Create a consistent directory structure 6.Fail builds fast 7.Build for any environment 51
  52. 52. Principles for CI Engineers 1.Automate builds 2.Perform single command builds 3.Separate build scripts from your IDE 4.Centralize software assets 5.Create a consistent directory structure 6.Fail builds fast 7.Build for any environment 8.Use a dedicated CI machine and a CI server 52
  53. 53. Principles for CI Engineers 1.Automate builds 2.Perform single command builds 3.Separate build scripts from your IDE 4.Centralize software assets 5.Create a consistent directory structure 6.Fail builds fast 7.Build for any environment 8.Use a dedicated CI machine and a CI server 9.Run fast builds 53
  54. 54. Principles for CI Engineers 1.Automate builds 2.Perform single command builds 3.Separate build scripts from your IDE 4.Centralize software assets 5.Create a consistent directory structure 6.Fail builds fast 7.Build for any environment 8.Use a dedicated CI machine and a CI server 9.Run fast builds 10.State builds 54
  55. 55. TODO list
  56. 56. TODO list 1.Run unit tests 56
  57. 57. TODO list 1.Run unit tests 2.Every commit build 57
  58. 58. TODO list 1.Run unit tests 2.Every commit build 3.Static code analysis 58
  59. 59. TODO list 1.Run unit tests 2.Every commit build 3.Static code analysis 4.Multi-environment deployment 59
  60. 60. References ● ● ● 開發人員應遵循的七項持續整合要領 持續整合工程師應遵循的十項要領(上)、( 下) 當 Branch 遇到持續整合( 1)、( 2)、( 3 )、( 4) 60

×