給忙碌開發者的Android開發流程自動化簡介

 給忙碌開發者的Android開發流程自動化簡介

簡介開發者為什麼需要 Continuous Integration,以及在 Android 開發上需要實踐 Continuous Integration 的基本步驟 #JCConf2016

6427501df5c44488da4cae07055897fe?s=128

Elvis Lin

October 15, 2016
Tweet

Transcript

  1. 妔盜繓樄咳ᘏጱ Android樄咳窕纷ᛔ㵕玕墋Օ Elvis Lin 2016/10/15

  2. Agenda • 樄咳ᘏૡ֢碻䨝蝽کጱࢯ櫞 • 瞱媲褸౮ҁContinuous Integration҂101 • 禊蝄ℂ樄咳牏翥捌牏介手牏಑۱ጱ螂纷Ӿ牧ݱ圵ݢ 犥ֵአጱૡٍ蚤ᒽኼ •

    ٌ犢ፘ橕ጱૡٍ
  3. About Me Elvis Lin Mobile Application Developer • Github: https://github.com/elvismetaphor

    • Blog: http://blog.elvismetaphor.me
  4. 盜繓樄咳ᘏጱӞॠ • 狕硬纷ୗҁࢩ傶憒໒݈虋ԧ҂ • 翥捌०硻ҁࢩ傶֦㴄㴄狕硬ԧ纷ୗ҂ • ತ BUGҁࢩ傶֦㴄㴄狕硬ԧ纷ୗ҂ • ᯿蕦Ӥ蝄㵕֢

    • 奰ෝݢ犥樄ত䌃碝ۑ胼ԧ • ۑ胼䌃کӞ܎聲樿统簁ᥝ姴盪ڊӞ㮆粚๜ • ꔇꔇ
  5. 䌃嘨综ӣդ牧瞟恝藮Ӟኞ!?

  6. 樄咳ᘏጱ෭ଉ 憒㴟 樄咳 ୌᗝ 介手 咳㬙 粚๜ᓕቘ Issue Tracking
 翥捌

    戔ਧ
  7. 樄咳ᘏጱࢯह • ℂڡত䯤మک叨ߝ಑۱咳㬙ጱ窕纷盄裾 • Ԫ眐ፘ吚ጱ耆卓 • 樄咳ᘏጱԆᥝ犨率䛑扗ฎ樄咳碝ۑ胼

  8. But, 蝡ฎӞ㮆 Bot ጱ碻դ

  9. 䛑扗珿አૡٍ 褔犵樄咳ᘏጱ揗砾

  10. https://www.jitbit.com/alexblog/249-now-thats-what-i-call-a-hacker/

  11. Every time they got a problem they found that they

    were still repeating what they were doing. They would write a tool for it, automate it. — Edmond Lau
  12. 瞱媲碉ݳҁCI҂

  13. https://insights.sei.cmu.edu/devops/2015/01/continuous-integration-in-devops-1.html

  14. 樄咳

  15. ૡཿ珿ٌԪ牧஠ضڥٌ瑊

  16. 珿አ Android Studio • ԧ薹ଉአጱ盠ഠ棎 • 狕硬戔ਧ䲆䔶玕樄咳絑ह • 㶓ڊ戔ਧ䲆 •

    疥戔ਧ䲆硯獈粚๜ᓕቘ羬翄
  17. None
  18. 㶓獈膏㶓ڊSettings

  19. 粚๜矒ګ

  20. Git • 獤碂ୗጱ粚๜矒ګ羬翄 • Gitlab — ࣁᛔ૩ጱԆ秚Ӥ礍戔 Git Server •

    GitHub — 娄Ӥጱܻত嘨դᓕ๐率
  21. GitHub • 纷ୗ嘨ጱ粚๜ᓕቘ • ෈կ物۱ೡᛔ㵕ኞ౮ጱ牏䟖አ觊Markdown承᥺ጱREADME 䲆礯 • 㺔氂蝍擽羬翄ҁݶ碻ݢአෝۑ胼襑穩҂ • Wiki

    • 犨率ڜ蔭 • ኚ粬瑽
  22. Zenhub 疥 Github Issues 犥̿፡礂̀ොୗ ᓕቘ

  23. None
  24. None
  25. None
  26. 瞱媲碉ݳ๐率

  27. ଉ憎ጱ瞱媲碉ݳ๐率 • Jenkins — ࣁᛔ૩ጱԆ秚Ӥ礍戔瞱媲碉ݳ֑๐瑊 • Travis CI — 娄Ӥጱ瞱媲碉ݳ֑๐瑊ҁ犖磪㻌秚粚҂

  28. Jenkins • ݢ犥ਧ碻౲礬硁粬ਧ礿կጱ藉咳㬵䁆ᤈ粬ਧጱ犨率 • ᛔ㵕玕翥捌膏介手ጱ㵕֢ • 磪战ग़ plugins ݢ犥蚤ٌ犢๐率Ӟݶֵአ •

    磪 Web ጱ瑽୵玕戔ਧՕᶎ
  29. Travis CI

  30. ࣁ Travis CI 翥捌 Android

  31. ୌᗝ/翥捌

  32. Gradle • ℂ Command Line ک IDE ک CI Server

    ᮷磪ඪൔ • Groovy Script (चෝ Groovy 戔懯ጱ DSL) • Product Flavour • Powerful Dependencies Management
  33. ࣁ޸犤ڜ翥捌 Android • Windows
 > gradlew.bat assembleDebug • Mac
 $

    chmod +x gradlew
 $ ./gradlew assembleDebug • 䁆ᤈᛔ懪ጱ犨率
 $ ./gradlew tasks
  34. 介手

  35. FIRST • Fast • Independant • Repeatable • Self Validation

    • Timely
  36. The AAA Pattern • Arrange • Act • Assert

  37. ଉአጱ介手 Library • JUnit 4 • Android Test Support Library

    • Robolectric • Espresso • Mockito
  38. JUnit • 㻌ز介手 • ݝ胼朼䌘奈 Java ጱ API

  39. Android Testing Support Library • ൉׀ Android API ጱ介手 •

    襑ᥝࣁ䋿誢秚瑊౲秇硈瑊Ӥ䁆ᤈ
  40. Robolectric • 䁆ᤈ Android API ፘ橕ጱ㻌ز介手ࣁ襎脲Ӥ • 䁆ᤈ蝧ଶ斃盠

  41. Espresso • UI 介手ጱૡٍ • ݢ犥奾ݳ Cucumber 䁆ᤈ涢硩介手

  42. Mockito • Mock Framework

  43. Clean Architecture https://8thlight.com/blog/uncle-bob/2012/08/13/the-clean-architecture.html

  44. CleanӞ膢ฎ瞲牧դ嘨犥၇莡ጱ୵制狅硁 Ӟਧጱ狅蚅憒㳷ᤩ㴟獤傶ग़䍅物獉䍅䌘ෝ क़䍅Ӟ篷ಅᎣ牐蝡疰఺ޱ茐狅蚅ݝ胼ኧक़ ݻ獉牐

  45. 咳㬙

  46. Grade Play Publisher Plugin • Ӟ㮆 Gradle ጱ plugin牧޾翥捌螂纷碉ݳ臑অ •

    虏 APK Ӥ㯽ک Google Play ጱ螂纷ݢ犥㷢碍玕
  47. Crashlytic • 痀ෝ Fabric Mobile Development Kits ጱӞ蟂犩 • 蝍擽ֵአᘏ咳ኞጱ梊藮

    • 叨ኞ梊藮䁭ޞ • 朼䌘犋ݶጱ秚ࣳ牏碻樌牏纷ୗ嘨֖ᗝ֢ڊ獤觊
  48. None
  49. 者奾 • Ӟ㮆叨ߝکᥝݢ犥咳㬙妔ֵአᘏԏ獮牧ᛗ੝۱珀樄咳牏 ୌᗝ/翥捌牏介手ጱ㵕֢ • ᛔ㵕玕覍໐ஞጱૡ֢牧䌕ဳ樄咳ۑ胼 • 脻๜玕ྯ㮆㵕֢牧虏犋ݶጱ樄咳Ո㹓ݢ犥وՁፘݶጱ 戔ਧ

  50. 㷢ᘍ䨗罕

  51. 氎ܻێ纷ୗԏᐟ 膏֦ݶࣁ