Unity開発現場を支えるJenkins

510ec964f5d26c2724c883fd7b671e3d?s=47 Cygames
November 30, 2015

 Unity開発現場を支えるJenkins

2015/11/15 Cygames Tech Fes

510ec964f5d26c2724c883fd7b671e3d?s=128

Cygames

November 30, 2015
Tweet

Transcript

  1. None
  2. 自己紹介 • ݹֶؓ ΤϯδχΞ • ήʔϜۀք೥ • ωΠςΟϒΞϓϦͷݱ৔ʹೖΓ௚઀αϙʔτɻ ΫϥΠΞϯτϝΠϯɻαʔόʔ΋؀ڥߏங΋ϦʔμʔͰ΋ ඞཁͰ͋Ε͹ԿͰ΋ɻ

    • ࠷ۙ͸िҰࣾ಺ษڧձͱ͔։͍ͨΓ $POGJEFOUJBM $PQZSJHIU ˜$ZHBNFT *OD "MM3JHIUT3FTFSWFE   
  3. アジェンダ • ੩తղੳ • ςετ • ·ͱΊ $POGJEFOUJBM $PQZSJHIU ˜$ZHBNFT

    *OD "MM3JHIUT3FTFSWFE   
  4. アジェンダ • ੩తղੳ • ςετ • ·ͱΊ $POGJEFOUJBM $PQZSJHIU ˜$ZHBNFT

    *OD "MM3JHIUT3FTFSWFE   
  5. 静的解析って? ίϯϐϡʔλͷιϑτ΢ΣΞͷղੳख๏ͷҰछͰ͋Γɺ ࣮ߦϑΝΠϧΛ࣮ߦ͢Δ͜ͱͳ͘ղੳΛߦ͏͜ͱ ιʔείʔυʹରͯ͠ߦΘΕΔ͜ͱ͕ଟ͍ XJLJQFEJBΑΓ $POGJEFOUJBM $PQZSJHIU ˜$ZHBNFT *OD "MM3JHIUT3FTFSWFE

      
  6. 静的解析って? ίϯϐϡʔλͷιϑτ΢ΣΞͷղੳख๏ͷҰछͰ͋Γɺ ࣮ߦϑΝΠϧΛ࣮ߦ͢Δ͜ͱͳ͘ղੳΛߦ͏͜ͱ ιʔείʔυʹରͯ͠ߦΘΕΔ͜ͱ͕ଟ͍ ૣظʹજࡏతͳΤϥʔ΍όάͷൃݟ͕Ͱ͖Δ XJLJQFEJBΑΓ $POGJEFOUJBM $PQZSJHIU ˜$ZHBNFT *OD

    "MM3JHIUT3FTFSWFE   
  7. 静的解析のきっかけ • ਓͷίʔυϨϏϡʔͰͷݟམͱ͠ɺଐਓԽ • πʔϧͷࢦఠͳΒɺݏͳإΛ͞ΕΔͷͰ͸ ͳ͍͔ͱؾʹ͔͚Δࣄ͕ແ͍ • DPDPTEYϓϩδΣΫτͰ੩తղੳͷಋೖ͕ ੒ޭͨ͠ͷͰɺ6OJUZͰ΋΍Γ͔ͨͬͨ $POGJEFOUJBM

    $PQZSJHIU ˜$ZHBNFT *OD "MM3JHIUT3FTFSWFE   
  8. 付属の静的解析ツール ίϯύΠϥ ੩తղੳπʔϧ DTDFYF 'Y$PQ NDT (FOEBSNF ジャンダルム $POGJEFOUJBM $PQZSJHIU

    ˜$ZHBNFT *OD "MM3JHIUT3FTFSWFE   
  9. 付属の静的解析ツール ίϯύΠϥ ੩తղੳπʔϧ DTDFYF 'Y$PQ NDT (FOEBSNF ジャンダルム εΫϦϓτΤϯδϯͰ࢖༻͍ͯ͠Δ.POP੡Λ࢖༻ $POGJEFOUJBM

    $PQZSJHIU ˜$ZHBNFT *OD "MM3JHIUT3FTFSWFE   
  10. Gendarme ルール w (FOEBSNF3VMFT#BE1SBDUJDF w (FOEBSNF3VMFT$PODVSSFODZ w (FOEBSNF3VMFT$PSSFDUOFTT w (FOEBSNF3VMFT%FTJHO

    w (FOEBSNF3VMFT%FTJHO(FOFSJD w (FOEBSNF3VMFT%FTJHO-JOR w (FOEBSNF3VMFT&YDFQUJPOT w (FOEBSNF3VMFT*OUFSPQFSBCJMJUZ w (FOEBSNF3VMFT.BJOUBJOBCJMJUZ w (FOEBSNF3VMFT/BNJOH w (FOEBSNF3VMFT1FSGPSNBODF w (FOEBSNF3VMFT1PSUBCJMJUZ w (FOEBSNF3VMFT4FDVSJUZ w (FOEBSNF3VMFT4FDVSJUZ$BT w (FOEBSNF3VMFT4FSJBMJ[BUJPO w (FOEBSNF3VMFT4NFMMT w (FOEBSNF3VMFT6J http://www.mono-­‐project.com/docs/tools+libraries/tools/gendarme/ ɾόουϓϥΫςΟε ɾϝϯςφϯεੑ ɾύϑΥʔϚϯεੑͳͲ Ҏ্ͷϧʔϧʂ 大カテゴリ $POGJEFOUJBM $PQZSJHIU ˜$ZHBNFT *OD "MM3JHIUT3FTFSWFE   
  11. PreferStringIsNullOrEmptyRule Bad QVCMJDCPPM4FOE.FTTBHF TUSJOHNFTTBHF \ JG NFTTBHFOVMM cc NFTTBHF-FOHUI \

    SFUVSOGBMTF ^ SFUVSO4FOE.FTTBHF &ODPEF NFTTBHF  ^ QVCMJDCPPM4FOE.FTTBHF TUSJOHNFTTBHF \ JG 4USJOH*T/VMM0S&NQUZ NFTTBHF \ SFUVSOGBMTF ^ SFUVSO4FOE.FTTBHF &ODPEF NFTTBHF  ^ Maintainability 4USJOHͷ/VMMۭνΣοΫ͕޷·͘͠ͳ͍ Good $POGJEFOUJBM $PQZSJHIU ˜$ZHBNFT *OD "MM3JHIUT3FTFSWFE   
  12. AvoidUncalledPrivateCodeRule Bad QVCMJDDMBTT.Z$MBTT\ QSJWBUFWPJE.BLF4VGG \  ^ QVCMJDWPJE.FUIPE \ $POTPMF8SJUF-JOF

    'PP  ^ ^ QVCMJDDMBTT.Z$MBTT\ QVCMJDWPJE.FUIPE \ $POTPMF8SJUF-JOF 'PP  ^ ^ QSJWBUFͳͷʹݺ͹Ε͍ͯͳ͍ Performance Good $POGJEFOUJBM $PQZSJHIU ˜$ZHBNFT *OD "MM3JHIUT3FTFSWFE   
  13. Gendarme for Unity ެࣜϑΥʔϥϜ $POGJEFOUJBM $PQZSJHIU ˜$ZHBNFT *OD "MM3JHIUT3FTFSWFE 

     
  14. Gendarme for Unity w (FOEBSNF3VMFT#BE1SBDUJDF w (FOEBSNF3VMFT$PODVSSFODZ w (FOEBSNF3VMFT$PSSFDUOFTT w

    (FOEBSNF3VMFT%FTJHO w (FOEBSNF3VMFT%FTJHO(FOFSJD w (FOEBSNF3VMFT%FTJHO-JOR w (FOEBSNF3VMFT&YDFQUJPOT w (FOEBSNF3VMFT*OUFSPQFSBCJMJUZ w (FOEBSNF3VMFT.BJOUBJOBCJMJUZ w (FOEBSNF3VMFT/BNJOH w (FOEBSNF3VMFT1FSGPSNBODF w (FOEBSNF3VMFT1PSUBCJMJUZ w (FOEBSNF3VMFT4FDVSJUZ w (FOEBSNF3VMFT4FDVSJUZ$BT w (FOEBSNF3VMFT4FSJBMJ[BUJPO w (FOEBSNF3VMFT4NFMMT w (FOEBSNF3VMFT6J https://github.com/fderudder/unity-­‐gendarme w 6OJUZ3VMFT1FSGPSNBODF w 6OJUZ3VMFT.BJOUBJOBCJMJUZ ベースルール Unity独自ルール $POGJEFOUJBM $PQZSJHIU ˜$ZHBNFT *OD "MM3JHIUT3FTFSWFE   
  15. AvoidEmptyComponentsMethodsRule QVCMJDDMBTT.Z$MBTT.POP#FIBWJPVS\ WPJE"XBLF \ ^ WPJE4UBSU \ %FCVH-PH l4UBSU 

    ^ ^ QVCMJDDMBTT.Z$MBTT.POP#FIBWJPVS\ WPJE4UBSU \ %FCVH-PH l4UBSU  ^ ^ Unity.Rules.Performance .POP#FIBWJPVSͷۭϝιουݺͼग़͠ Bad Good $POGJEFOUJBM $PQZSJHIU ˜$ZHBNFT *OD "MM3JHIUT3FTFSWFE    Φʔόʔϔου͕͔͔Δ
  16. AvoidUsingFindObjectInUpdateRule Bad QVCMJDDMBTT.Z$MBTT.POP#FIBWJPVS\ WPJE6QEBUF \ (BNF0CKFDUSPPU(BNF0CKFDU'JOE lNBJOSPPUz  ^ ^

    Good QVCMJDDMBTT.Z$MBTT.POP#FIBWJPVS\ WPJE6QEBUF \ (BNF0CKFDUSPPU@SPPU ^ ^ 'JOE0CKFDUܥ͸6QEBUFܥͰݺ͹ͳ͍ํ͕ྑ͍ Unity.Rules.Performance $POGJEFOUJBM $PQZSJHIU ˜$ZHBNFT *OD "MM3JHIUT3FTFSWFE    'JOE0CKFDUܥ͸଎౓ʹ೉͋Γ
  17. ࢖༻ϓϥάΠϯɿ リリース直前のプロジェクトに試験導入 参考:[Unite  Japan  2013]Unity  × Jenkins:一歩進んだ使い方 https://vimeo.com/64378910 8BSOJOHT1MVHJO 7JPMBUJPOTQMVHJO

    $POGJEFOUJBM $PQZSJHIU ˜$ZHBNFT *OD "MM3JHIUT3FTFSWFE   
  18. 結果 ղੳʹ͔͔ͬͨओͳ΋ͷ • ະ࢖༻QSJWBUFϝιου • /6--νΣοΫ͕ແ͍ • 4ZTUFN4USJOHͱ 4ZTUFN$IBSͷ࿈݁ $POGJEFOUJBM

    $PQZSJHIU ˜$ZHBNFT *OD "MM3JHIUT3FTFSWFE   
  19. 結果 ղੳʹ͔͔ͬͨओͳ΋ͷ ༗ྉΞηοτ͕݁ߏͻ͔͔ͬΔ • ະ࢖༻QSJWBUFϝιου • /6--νΣοΫ͕ແ͍ • 4ZTUFN4USJOHͱ 4ZTUFN$IBSͷ࿈݁

    $POGJEFOUJBM $PQZSJHIU ˜$ZHBNFT *OD "MM3JHIUT3FTFSWFE    *HOPSFࢦఆΛؤுΔʜ
  20. 目に見えた成果は出なかった… ɾϦϦʔεޙʹΫϦςΟΧϧͰͳ͍΋ͷΛ௚͢ͷ͸ϦεΫ ɾن໿ʹຒ΋ΕͯΫϦςΟΧϧͳॴΛݟམͱ͕ͪ͠ʹ 成果として $POGJEFOUJBM $PQZSJHIU ˜$ZHBNFT *OD "MM3JHIUT3FTFSWFE 

     
  21. 目に見えた成果は出なかった… ɾϦϦʔεޙʹΫϦςΟΧϧͰͳ͍΋ͷΛ௚͢ͷ͸ϦεΫ ɾن໿ʹຒ΋ΕͯΫϦςΟΧϧͳॴΛݟམͱ͕ͪ͠ʹ 成果として ࠓޙͷίʔσΟϯάϧʔϧΛఆٛ͢Δ༻్ʹ͸ ඇৗʹ࢖͑Δ とはいえ ৽نҊ݅ʹ͸औΓೖΕ͍ͯ͘Α͏ల։த $POGJEFOUJBM $PQZSJHIU

    ˜$ZHBNFT *OD "MM3JHIUT3FTFSWFE   
  22. アジェンダ • ੩తղੳ • ςετ • ·ͱΊ $POGJEFOUJBM $PQZSJHIU ˜$ZHBNFT

    *OD "MM3JHIUT3FTFSWFE   
  23. テストのきっかけ • νΣοΫ؀ڥ͕ଟͯ͘ਏ͍ ։ൃɺεςʔδϯάɺຊ൪ɺJ04ɺ"OESPJEɺFUD • Ϗϧυ͸௨Δ͕ɺىಈ͠ͳ͍ࣄ͕͋Δ ֬ೝෆ଍ɺؼΓࡍͷQVTI $POGJEFOUJBM $PQZSJHIU ˜$ZHBNFT

    *OD "MM3JHIUT3FTFSWFE   
  24. テストのきっかけ • νΣοΫ؀ڥ͕ଟͯ͘ਏ͍ ։ൃɺεςʔδϯάɺຊ൪ɺJ04ɺ"OESPJEɺFUD • Ϗϧυ͸௨Δ͕ɺىಈ͠ͳ͍ࣄ͕͋Δ ֬ೝෆ଍ɺؼΓࡍͷQVTI ΠʔδʔϛεʹΑΔ࡞ۀޮ཰ͷ௿Լ $POGJEFOUJBM $PQZSJHIU

    ˜$ZHBNFT *OD "MM3JHIUT3FTFSWFE   
  25. スモークテスト ίϯύΠϧ΍Ϗϧυͨ͠௚ޙʹͦͷιϑτ΢ΣΞ͕ ಈ͘ࣄΛ֬ೝ͢Δ ʮىಈ͢Δʯʮجຊػೳ͕ಈ࡞͢Δʯ ͳͲͷ؆қςετ $POGJEFOUJBM $PQZSJHIU ˜$ZHBNFT *OD "MM3JHIUT3FTFSWFE

      
  26. 生成物の作成 GitHub ①pull ②ビルド apk $POGJEFOUJBM $PQZSJHIU ˜$ZHBNFT *OD "MM3JHIUT3FTFSWFE

      
  27. 監視スクリプトの起動 ؂ࢹεΫϦϓτ ᶅεΫϦϓτىಈ GitHub ˞QZUIPOҎ֎Ͱ΋ $POGJEFOUJBM $PQZSJHIU ˜$ZHBNFT *OD "MM3JHIUT3FTFSWFE

      
  28. ④インストール genymotion インストール&起動 インストール :  adb  install  app.apk 起動 :

     adb  shell  am  start  -­‐n  {packagename}/{mainActivity} ⑤起動 GitHub $POGJEFOUJBM $PQZSJHIU ˜$ZHBNFT *OD "MM3JHIUT3FTFSWFE   
  29. ⑤ログの書き出し .log ログ :  adb  logcat  Unity:V  *:S  >  output.log

      logcat ؂ࢹεΫϦϓτ͔ΒMPHDBUͰϩάΛॻ͖ग़͢ ϩάͷதʹIFBSUCFBUΛ࢓ࠐΈɺ؂ࢹεΫϦϓτͰݕ஌͢Δ heart beat GitHub heartbeatの検知 $POGJEFOUJBM $PQZSJHIU ˜$ZHBNFT *OD "MM3JHIUT3FTFSWFE   
  30. jenkinsへの通知 ᶈ੒ޭɿIFBSUCFBU͕ಧ͍ͨ ࣦഊɿҰఆ࣌ؒಧ͔ͳ͍ GitHub $POGJEFOUJBM $PQZSJHIU ˜$ZHBNFT *OD "MM3JHIUT3FTFSWFE 

     
  31. テストまとめ • KFOLJOT͔Βੜ੒෺ͷ࡞੒ • ؂ࢹ༻εΫϦϓτΛ্ཱͪ͛ɺੜ੒෺Λ Πϯετʔϧ͠ΤϛϡϨʔλʔͰىಈ • ϩάʹ͸ಛఆͷจࣈྻ͕࢓ࠐ·Ε͍ͯΔ ৗறͰ6QEBUF͕૸ΔΑ͏ͳ.BOBHFSܥʹ࢓ࠐΜͰ͍Δ •

    ؂ࢹεΫϦϓτ͔ΒಛఆͷจࣈྻΛݕ஌͠௨஌ $POGJEFOUJBM $PQZSJHIU ˜$ZHBNFT *OD "MM3JHIUT3FTFSWFE   
  32. 失敗通知 • ࣾ಺4/4΁౤ߘ • BGQMBZͰԻΛ໐Β͢ • CMJOL  Ͱ-&%ΛޫΒͨ͠Γ •

    "SVEVJOPͰ૊ΜͰΈͨΓ ざわ…ざわ… $POGJEFOUJBM $PQZSJHIU ˜$ZHBNFT *OD "MM3JHIUT3FTFSWFE   
  33. 今後やりたい事 • ֤γʔϯͷΤʔδϯά ɾ IFBSUCFBUͷ࢓૊ΈΛྲྀ༻͢Δͱ͔ • ϞϯΩʔςετ ɾBECͰΩʔΠϕϯτͱ͔ ɾNPOLFZSVOOFSΛ࢖༻͢Δͱ͔ $POGJEFOUJBM

    $PQZSJHIU ˜$ZHBNFT *OD "MM3JHIUT3FTFSWFE   
  34. まとめ • ඼࣭ͷվળʹ͸࣮֬ʹܨ͕Δ ɾ ίʔυϨϏϡʔͷෛ୲ܰݮ ɾ Πʔδʔϛεͷ௿Լ ɾ ݟ͑ΔԽͰ཰ઌͯ͠௚͕ͨ͠Δਓ΋ग़Δ •

    ҰͭͰ΋֬ೝ࡞ۀΛࣗಈԽͰݮΒ͢ ɾ ࡞ͬͯྑ͔ͬͨͱࢥ͏͕࣌ඞͣདྷΔ $POGJEFOUJBM $PQZSJHIU ˜$ZHBNFT *OD "MM3JHIUT3FTFSWFE   
  35. ご清聴ありがとうございました $POGJEFOUJBM $PQZSJHIU ˜$ZHBNFT *OD "MM3JHIUT3FTFSWFE