Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
DangerでスムーズなPRレビューを
Search
masakazu sano
September 12, 2017
Technology
1
360
DangerでスムーズなPRレビューを
2017/09/12 iOS社内勉強会 @OHAKO.inc にて公開したスライドです
masakazu sano
September 12, 2017
Tweet
Share
More Decks by masakazu sano
See All by masakazu sano
Manual DI with ReactorKit
kz56cd
1
670
CoreNFCファーストインプレッション(仮)
kz56cd
0
62
Other Decks in Technology
See All in Technology
Incident Response Practices: Waroom's Features and Future Challenges
rrreeeyyy
0
160
これまでの計測・開発・デプロイ方法全部見せます! / Findy ISUCON 2024-11-14
tohutohu
3
370
誰も全体を知らない ~ ロールの垣根を超えて引き上げる開発生産性 / Boosting Development Productivity Across Roles
kakehashi
1
230
EventHub Startup CTO of the year 2024 ピッチ資料
eventhub
0
120
生成AIが変えるデータ分析の全体像
ishikawa_satoru
0
170
OCI Security サービス 概要
oracle4engineer
PRO
0
6.5k
Zennのパフォーマンスモニタリングでやっていること
ryosukeigarashi
0
150
Lambdaと地方とコミュニティ
miu_crescent
2
370
強いチームと開発生産性
onk
PRO
35
11k
Introduction to Works of ML Engineer in LY Corporation
lycorp_recruit_jp
0
140
Engineer Career Talk
lycorp_recruit_jp
0
190
B2B SaaSから見た最近のC#/.NETの進化
sansantech
PRO
0
890
Featured
See All Featured
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
27
840
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
31
2.7k
Into the Great Unknown - MozCon
thekraken
32
1.5k
Designing the Hi-DPI Web
ddemaree
280
34k
The Straight Up "How To Draw Better" Workshop
denniskardys
232
140k
Build The Right Thing And Hit Your Dates
maggiecrowley
33
2.4k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
226
22k
GitHub's CSS Performance
jonrohan
1030
460k
Building Adaptive Systems
keathley
38
2.3k
Large-scale JavaScript Application Architecture
addyosmani
510
110k
A Philosophy of Restraint
colly
203
16k
The Art of Programming - Codeland 2020
erikaheidi
52
13k
Transcript
DangerͰ εϜʔζͳPRϨϏϡʔΛ 2017/09/12 iOSࣾษڧձ @OHAKO.inc Masakazu Sano (@kz56cd)
Dangerʁ
None
You can use Danger to codify your teams norms, leaving
humans to think about harder problems.
Dangerͱ νʔϜ։ൃͰࡉ͔ͳϧʔϧ͕ଘࡏ͢Δ
Dangerͱ νʔϜ։ൃͰࡉ͔ͳϧʔϧ͕ଘࡏ͢Δ • WIP͕͍ͭͨ··ϨϏϡʔʹճ͞ͳ͍Ͱʂ • ίʔυมߋͨ͠ΒCHANGELOGsߋ৽ͯ͠ʂ • PRͷ࡞ۀऀΛઃఆͯ͠ʂ • ಛघͳϑΝΠϧ͕ߋ৽͞Ε͍ͯΔͳΒࣄલʹڭ͑ͯ΄͍͠...
etc...
͜ΕΒΛʢਓؒͷΘΓʹʣ ࣄલνΣοΫͯ͘͠ΕΔͷ͕ Danger
Danger ͷछྨ
None
Danger ͷछྨ • ݱࡏ js൛ͱruby൛͕͋Δ • ࠷ۙ swift൛ʢ·ͩβͬΆ͍ʣ͕Ճ͞Εͨ! • iOS
11 / swift 4 ʹͯಈ࡞ • https://github.com/danger/danger-swift ※ ࠓճruby൛ͰΛਐΊ·͢
ಋೖํ๏
ಋೖํ๏ ༻ҙ͢Δͷ • Bundler • ԿΒ͔ͷCI (CircleCI , Bitrize ...)
• Danger௨༻ͷ bot • organization / private repoͷࡍඞཁʹͳΔ
ಋೖํ๏ ͓͓·͔ͳྲྀΕ 1. ϩʔΧϧڥʹDangerΛೖΕΔ 2. GithubʹbotΛઃఆ͢Δ 3. CI্ͰDangerFileΛධՁͰ͖ΔΑ͏ʹηοτ͢Δ
ಋೖํ๏ 1. ϩʔΧϧڥʹDangerΛೖΕΔ
ಋೖํ๏ 1. ϩʔΧϧڥʹDangerΛೖΕΔ • ϓϩδΣΫτԼʹ࣮ͯߦ $ bundle init
ಋೖํ๏ 1. ϩʔΧϧڥʹDangerΛೖΕΔ • ੜ͞ΕͨGemFileʹ gem "danger" Λه $ bundle
install ʢ࣮ߦ࣌ɺରܗࣜʹͯηοτΞοϓΛߦ͑Δ͕ɺͱΓ͋͑ͣ Enter࿈ଧͯ͠Α͍ʣ ➡ Πϯετʔϧޭ͢ΔͱDangerFile͕ੜ͞ΕΔ
ಋೖํ๏ 1. ϩʔΧϧڥʹDangerΛೖΕΔ • ϓϩδΣΫτ্ෆཁͳϑΝΠϧ.gitignoreʹه͓ͯ͘͠ ## danger(use bundler) .bundle/ vendor/
ಋೖํ๏ 2. GithubʹbotΛઃఆ͢Δ
ಋೖํ๏ 2. GithubʹbotΛઃఆ͢Δ
ಋೖํ๏ 2. GithubʹbotΛઃఆ͢Δ ʢOSSͷ߹͜ͷखॱল͍ͯΑ͍Ͱ͢!ʣ • Githubͷ߹machine userΛ༻ҙ͢Δ
ಋೖํ๏ 2. GithubʹbotΛઃఆ͢Δ • ن্ɺmachine user 1ͭͷ organization ʹ͖ͭ1ମͷΈ ͱͳ͍ͬͯΔͷͰҙ
• https://developer.github.com/v3/guides/managing- deploy-keys/#machine-users • machine userͷՃํ๏ • http://www.wikihow.com/Use-Deploy-Keys-on- Github#CreatingaMachineUsersub
ಋೖํ๏ 2. GithubʹbotΛઃఆ͢Δ ʢOSSͷ߹͜ͷखॱল͍ͯΑ͍Ͱ͢!ʣ • Ճ͍ͨ͠private repoʹcollaboratorͱͯ͠ɺbotΛՃ͢ Δ
ಋೖํ๏ 2. GithubʹbotΛઃఆ͢Δ ʢOSSͷ߹ࣗͷΞΧϯτͷtokenΛ࡞Γ·͠ΐ͏!ʣ • botʹDanger༻ͷprivate access tokenΛՃ͢Δ • botͰϩάΠϯ
• Setting -> Personal access tokens -> ʮGenerate new tokenʯԡԼ • ͦͷࡍɺtokenͷݖݶ repos શͯʹνΣοΫ͢Δ͜ͱ
ಋೖํ๏ 3. CI্ͰDangerFileΛධՁͰ͖ΔΑ ͏ʹηοτ͢Δ
ಋೖํ๏ 3. CI্ͰDangerFileΛධՁ Ͱ͖ΔΑ͏ʹηοτ͢Δ • bitriseͷ߹ • ֘ϓϩδΣΫτͷworkflow editorΛ։͘ •
ҙͷҐஔʹʮScriptʯstepΛ৽ نՃ • Script content ʹهड़ɿ
ಋೖํ๏ 3. CI্ͰDangerFileΛධՁ Ͱ͖ΔΑ͏ʹηοτ͢Δ • ઌʹ༻ҙͨ͠bot (OSSͷ߹ࣗ ͷ) ͷ private
access token Λη οτ͢Δ • workflow editorͷʮEnv Varsʯ λϒԡԼ • ʮAdd newʯԡԼ͠ɺ ʮDANGERGITHUBAPI_TOKENʯ ͱ͍͏໊শͰtokenొ
͋ͱɺpull requestΛ࡞ͯ͠ Dangerͷ௨͕ग़ΕOKͰ͢ʂ
None
DangerFileΛΧελϚ Πζ͢Δ
None
DangerFileΛΧελϚΠζ͢Δ • message / warn / fail ͷࡾछͰϢʔβʔʹνΣοΫ༰Λप Ͱ͖Δ •
markdownͰͷهड़Մɿ • markdown("## ࡞ۀதͰ͢") • ಛఆͷίʔυͷdiffΛදࣔ͢Δ͜ͱͰ͖Δ
DangerFileΛΧελϚΠζ͢Δ ڞ௨Ͱ͑ͦ͏ͳνΣοΫɿ # ϚΠϧετʔϯͷνΣοΫ message("ϚΠϧετʔϯ͕ະઃఆͰ͢") unless has_milestone # ࡞ۀऀͷνΣοΫ warn("࡞ۀऀΛΞαΠϯ͠·͠ΐ͏",
sticky: false) unless has_assignee # ϚʔδઌͷνΣοΫ warn("ϚʔδઌΛdevelopʹઃఆ͠·͠ΐ͏") if !github.branch_for_base == "develop" # ߦνΣοΫ warn("500ߦ͑ͯ·͢ɻׂͰ͖ΔͱϕλʔͰ͢Ͷ") if git.lines_of_code > 500
DangerFileΛΧελϚΠζ͢Δ iOS։ൃ༻్ͷνΣοΫɿ # App.xcodeproj/project.pbxproj ͷมߋνΣοΫ message ("`App.xcodeproj/project.pbxproj` ͕มߋ͞Ε͍ͯ·͢") if git.modified_files.include?
"App.xcodeproj/project.pbxproj" # Cartfile ͷมߋνΣοΫ message ("`Cartfile` ͕มߋ͞Ε͍ͯ·͢") if git.modified_files.include? "Cartfile" message ("`Cartfile.resolved` ͕มߋ͞Ε͍ͯ·͢") if git.modified_files.include? "Cartfile.resolved" # Podfile ͷมߋνΣοΫ message ("`Podfile` ͕มߋ͞Ε͍ͯ·͢") if git.modified_files.include? "Podfile" message ("`Podfile.lock` ͕มߋ͞Ε͍ͯ·͢") if git.modified_files.include? "Podfile.lock"
DangerFileΛΧελϚΠζ͢Δ LGTMɿ # add lgtm pic lgtm.check_lgtm • ʮwarn /
failͰͻ͔͔ͬΒͳ͍࣌ͷΈʯLGTM͞ΕΔ • ͻͱͰϨϏϡʔՄೳ͔Δʂ! • GemFileʹه͕ඞཁɿ gem "danger-lgtm"
DangerFileΛΧελϚΠζ͢Δ ʴα • ެࣜυΩϡϝϯτɺʮSHOW ME SOME DANGERFILESʯʹ ෳྫ͋Γɿ • http://danger.systems/ruby/
Danger Pluginͷಋೖ
Danger Pluginͷಋೖ • ઌͷʮdanger-lgtmʯϓϥάΠϯ • Gemfileʹهड़ͯ͠Πϯετʔϧ͢ΕOK • ެࣜαΠτͰଟհ͞ΕͯΔ • ʮPLUGINSʯͷ߲Λࢀরɿ
• http://danger.systems/ruby/
ྑͦ͞͏ͳDanger Plugin clorox • file header(ॺ໊)ͷܗࣜνΣοΫ • https://github.com/barbosa/danger-clorox todoist •
TODO/FIXMEͷهड़ʹର͠ࡉ͔ͳ௨͕Ͱ͖Δ • https://github.com/hanneskaeufler/danger-todoist
slather • ίʔυΧόϨοδͷՄࢹԽ • https://github.com/BrunoMazzo/Danger-Slather Rubocop • rubocopʹ४ڌͨ͠lintνΣοΫ • https://github.com/ashfurrow/danger-rubocop
DUPLICATELOCALIZABLESTRINGS • Localizable.strings ͷkeyॏෳνΣοΫ • https://github.com/AirHelp/danger- duplicatelocalizablestrings LGTM • https://github.com/leonhartX/danger-lgtm
! Ҏ্ !
ref • http://danger.systems/ • http://sssslide.com/speakerdeck.com/jp_pancake/ dangerwoshi-tuteprwozi-dong-de-nitietukusuru • https://www.slideshare.net/ShunsukeMaeda/dangerpull- request •
http://qiita.com/toshiya/items/589834d9b09c0dbe4c56