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
370
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
760
CoreNFCファーストインプレッション(仮)
kz56cd
0
70
Other Decks in Technology
See All in Technology
2時間で300+テーブルをデータ基盤に連携するためのAI活用 / FukuokaDataEngineer
sansan_randd
0
160
結局QUICで通信は速くなるの?
kota_yata
7
7.2k
AI時代の大規模データ活用とセキュリティ戦略
ken5scal
0
150
アカデミーキャンプ 2025 SuuuuuuMMeR「燃えろ!!ロボコン」 / Academy Camp 2025 SuuuuuuMMeR "Burn the Spirit, Robocon!!" DAY 1
ks91
PRO
0
150
Amazon S3 Vectorsは大規模ベクトル検索を低コスト化するサーバーレスなベクトルデータベースだ #jawsugsaga / S3 Vectors As A Serverless Vector Database
quiver
2
720
Lambda management with ecspresso and Terraform
ijin
2
170
✨敗北解法コレクション✨〜Expertだった頃に足りなかった知識と技術〜
nanachi
1
740
Strands Agents & Bedrock AgentCoreを1分でおさらい
minorun365
PRO
8
350
Eval-Centric AI: Agent 開発におけるベストプラクティスの探求
asei
0
130
形式手法特論:位相空間としての並行プログラミング #kernelvm / Kernel VM Study Tokyo 18th
ytaka23
3
1.4k
AI関数が早くなったので試してみよう
kumakura
0
320
プロダクトエンジニアリングで開発の楽しさを拡張する話
barometrica
0
190
Featured
See All Featured
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
36
2.5k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
31
2.5k
Facilitating Awesome Meetings
lara
54
6.5k
How GitHub (no longer) Works
holman
314
140k
Typedesign – Prime Four
hannesfritz
42
2.8k
Done Done
chrislema
185
16k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
332
22k
The Art of Programming - Codeland 2020
erikaheidi
54
13k
Measuring & Analyzing Core Web Vitals
bluesmoon
8
550
Dealing with People You Can't Stand - Big Design 2015
cassininazir
367
26k
Bootstrapping a Software Product
garrettdimon
PRO
307
110k
Become a Pro
speakerdeck
PRO
29
5.5k
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