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
Laravel5.5的 継続的インテグレーション / Laravel 5.5 Continu...
Search
kkznch
August 07, 2018
Programming
3
3.3k
Laravel5.5的 継続的インテグレーション / Laravel 5.5 Continuous Integration
レガシーコード改革!UT/CIでWebサービスの技術的負債を解消する取り組み
登壇枠で使用
参考URL
https://base.connpass.com/event/94476/
kkznch
August 07, 2018
Tweet
Share
More Decks by kkznch
See All by kkznch
黒い画面へようこそ/Hello, black screen
kkznch
0
360
VueRouterとNuxtのルーティング/VueRouter and Nuxt Routing
kkznch
0
320
Vuexで何を管理する方が良い?/What is better to store in Vuex?
kkznch
1
700
Firestoreのルール設定 割と何でも出来てビビる/Firestore rule setting
kkznch
1
720
LaraCSVで手軽にCSVを出力する/Easily generate CSV by LaraCSV
kkznch
0
1.6k
自社サービス チャット機能にFirebaseが導入されてた/Firebase was introduced to the chat function of our service
kkznch
0
1.1k
SPA開発未経験者によるNuxt.jsを使った自社サービス開発 / Development of own service using Nuxt.js by inexperienced SPA development
kkznch
3
3.1k
Laravel Telescopeが便利そうな気がする/Laravel Telescope seems to be convenience
kkznch
1
1.1k
Laravel Novaはなんだかいい感じらしい/Laravel Nova seems to be nice
kkznch
0
610
Other Decks in Programming
See All in Programming
リアーキテクチャxDDD 1年間の取り組みと進化
hsawaji
1
190
詳細解説! ArrayListの仕組みと実装
yujisoftware
0
540
タクシーアプリ『GO』のリアルタイムデータ分析基盤における機械学習サービスの活用
mot_techtalk
4
230
JaSST 24 九州:ワークショップ(は除く)実践!マインドマップを活用したソフトウェアテスト+活用事例
satohiroyuki
0
380
3rd party scriptでもReactを使いたい! Preact + Reactのハイブリッド開発
righttouch
PRO
1
590
「今のプロジェクトいろいろ大変なんですよ、app/services とかもあって……」/After Kaigi on Rails 2024 LT Night
junk0612
4
1.9k
Outline View in SwiftUI
1024jp
1
280
RailsのPull requestsのレビューの時に私が考えていること
yahonda
5
2.7k
PHP でアセンブリ言語のように書く技術
memory1994
PRO
1
160
Generative AI Use Cases JP (略称:GenU)奮闘記
hideg
0
190
推し活の ハイトラフィックに立ち向かう Railsとアーキテクチャ - Kaigi on Rails 2024
falcon8823
6
2.6k
受け取る人から提供する人になるということ
little_rubyist
0
180
Featured
See All Featured
Become a Pro
speakerdeck
PRO
25
5k
Optimising Largest Contentful Paint
csswizardry
33
2.9k
Fashionably flexible responsive web design (full day workshop)
malarkey
404
65k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
226
22k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
169
50k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
26
2.1k
Thoughts on Productivity
jonyablonski
67
4.3k
How to train your dragon (web standard)
notwaldorf
88
5.7k
No one is an island. Learnings from fostering a developers community.
thoeni
19
3k
Making Projects Easy
brettharned
115
5.9k
Being A Developer After 40
akosma
86
590k
Ruby is Unlike a Banana
tanoku
96
11k
Transcript
Copyright Re:Build.inc All Rights Reserved. Laravel5.5的 ܧଓ的インテグレʔション 嘉侑起 2018/08/07 3F#VJME
Copyright Re:Build.inc All Rights Reserved. "HFOEB ձࣾɾࣗݾհ (JU-BC$*Λಋೖ͢ΔϝϦοτ (JU-BC$*ͷಋೖํ๏ -BSBWFM1)16OJUͷϝϦοτ
Copyright Re:Build.inc All Rights Reserved. ձࣾɾࣗݾհ
Copyright Re:Build.inc All Rights Reserved. ࣗݾհ ◆໊લ ླ ೭(Suzuki Takayuki)
◆ࣗݾհ ɾ1990ɺਆಸݝੜ·Εɻ ɾࣾձਓʹͳ͔ͬͯΒɺϓϩάϥϛϯάΛ࢝ΊΔɻ ɾ2015ʹϑϧεϐʔυʹೖࣾ͠ɺ2017ʹ ϑϦʔϥϯεΛͬͨޙʹ201711݄ʹԭೄͰىۀɻ ◆झຯ ίεϓϨɺԻָϥΠϒɺϚϥιϯେձʹग़Δɺٿ؍ઓ ◆εΩϧ ɾPHP, Symfony2,CakePHP3,Laravel5, ɾJavaScript, backbone.js,Angular4
Copyright Re:Build.inc All Rights Reserved. ࣗݾհ ◆໊લ Յ ါى(Kakazu Yuki)
@kkznch ◆ࣗݾհ ɾ1990ɺԭೄݝੜ·Ε ɾ2016ʹԭిάϩʔόϧγεςϜζגࣜձࣾʹೖࣾɺ2018 ʹגࣜձࣾRe:Buildస৬ͯ͠ݱࡏʹࢸΔ ɾࠃॎஅ͍ͨ͠ ◆झຯ όϨʔϘʔϧɺϐΞϊɺήʔϜɺΧϑΣ८Γ ◆εΩϧ ɾPHPɺJavaScriptɺC/C++ɺPythonɺRuby ɾΠϯϑϥશൠɺηΩϡϦςΟগʑ
Copyright Re:Build.inc All Rights Reserved. ձࣾհ ◆ձ໊ࣾ גࣜձࣾRe:Build ◆ॅॴ ԭೄݝԭೄࢢதԝ̍ஸ̍̒−̕
◆ࣄۀ༰ ɾۀʹ͓͍ͯͷϑʔυϩεΛແ͘͢ ࣗࣾWEBαʔϏεͷاըɾ։ൃɻ ɾडୗ։ൃ ◆ࣾһ 4໊ ◆ΤϯδχΞͷಇ͖ํ ϦϞʔτϫʔΫՄೳͳࣗ༝ͳಇ͖ํΛਪͯ͠·͢ʂ
ɾαʔϏε໊ temite ɾγεςϜ֓ཁ ECϓϥοτϑΥʔϜ ΫϨδοτܾࡁ ΞϑΟϦΤΠτ ͳͲ ɾ͍ͬͯΔٕज़ ݴޠ :
PHP,JavaScript ϑϨʔϜϫʔΫ: laravel5,Vue.js,JQueryͳͲ ։ൃதͷαʔϏε
ϑϩϯταΠυ αʔόαΠυ Ϗϧυπʔϧ DB
৫ମ੍ ϓϩμΫτΦʔφʔ ։ൃϦʔμʔ νʔϜϝϯόʔ ▪ϓϩδΣΫτߏ ɾϓϩμΫτΦʔφʔɿ1໊ ɾ։ൃϦʔμʔɿ1໊ ɾνʔϜϝϯόʔɿ3໊ ※σβΠφʔ΄΅ແ͠
Copyright Re:Build.inc All Rights Reserved. (JU-BC$*Λಋೖ͢ΔϝϦοτ
GitLabͱʁ
GitLabͱʁ GitHubͬΆౕ͍
GitLabͷΞΠίϯ
GitLabͷΞΠίϯʢچʣ ͳΜ͔ා͍
GitLabͷΞΠίϯ ॏͶͯΈͨ
GitLabͷػೳ
GitLabͷػೳ ͜͜ΒΜΑ͘͏
‣ GitLabఏڙͷܧଓతΠϯςάϨʔγϣϯπʔϧ ‣ ϦϙδτϦ͕Push͞ΕͨλΠϛϯάͰಈ࡞͢Δ ‣ ಈ͔ͨ͢Ίʹ৭ʑͱ͝ʹΐ͝ʹΐ͢Δඞཁ͋Γ GitLab CIͱʁ
‣ PHPStan(PHP Static Analysis Tool)Ͱ੩తղੳ ‣ PHPUnitͰ୯ମςετɾ݁߹ςετ ‣ εςʔδϯάڥͷσϓϩΠ GitLab
CIͰฐ͕ࣾͬͯΔ͜ͱ
PHPStanͰ੩తղੳ
PHPUnitͰ୯ମςετɾ݁߹ςετ
εςʔδϯάڥͷσϓϩΠ ※اۀൿີͷͨΊ͓ݟͤͰ͖·ͤΜ
2 3 GitLab CIΛಋೖ͢ΔϝϦοτ ѹత҆৺ײ ͷ֫ಘ ॲཧͷࣗಈԽʹΑ ΓޮΞοϓ ࣭Λ୲อ 1
2 3
Copyright Re:Build.inc All Rights Reserved. (JU-BC$*ͷಋೖํ๏
(1)PUSH (2)GitLab CI࣮ߦ (3)ίϯςφىಈ Gitlab (6)Envoy࣮ߦ ςετ࣮ߦ ίϯςφ σϓϩΠ࣮ߦ ίϯςφ
(5)ίϯςφىಈ (4)UnitTest࣮ߦ (7)Pull ຊ൪ڥ or εςʔδϯάڥ ϦϙδτϦ GiaLab CI ࣮ߦϑϩʔ
‣ SSHଓ༻ͷ伴Λ࡞ɾొ͢Δ ‣ DockerΠϝʔδΛ࡞ɾొ͢Δ ‣ GitLabϥϯφʔཧ༻ϑΝΠϧΛ࡞͢Δ ‣ σϓϩΠλεΫϥϯφʔཧ༻ϑΝΠϧΛ࡞͢Δ GitLab CIಋೖखॱ
‣SSHଓ༻ͷ伴Λ࡞ɾొ͢Δ ‣ DockerΠϝʔδΛ࡞ɾొ͢Δ ‣ GitLabϥϯφʔཧ༻ϑΝΠϧΛ࡞͢Δ ‣ σϓϩΠλεΫϥϯφʔཧ༻ϑΝΠϧΛ࡞͢Δ GitLab CIಋೖखॱ
(1)PUSH (2)GitLab CI࣮ߦ (3)ίϯςφىಈ Gitlab (6)Envoy࣮ߦ ςετ࣮ߦ ίϯςφ σϓϩΠ࣮ߦ ίϯςφ
(5)ίϯςφىಈ (4)UnitTest࣮ߦ (7)Pull ຊ൪ڥ or εςʔδϯάڥ ϦϙδτϦ GitLab CI͔ΒσϓϩΠઌ σϓϩΠΛ࣮ߦ͢ΔͨΊʹ SSHଓ༻ͷ伴͕ඞཁ ެ։伴Λઃஔ ൿີ伴Λઃஔ
(1)PUSH (2)GitLab CI࣮ߦ (3)ίϯςφىಈ Gitlab (6)Envoy࣮ߦ ςετ࣮ߦ ίϯςφ σϓϩΠ࣮ߦ ίϯςφ
(5)ίϯςφىಈ (4)UnitTest࣮ߦ (7)Pull ຊ൪ڥ or εςʔδϯάڥ ϦϙδτϦ σϓϩΠઌͷαʔό͔Β GitLabͷϦϙδτϦΛPull͢ΔͨΊʹ SSHଓ༻ͷ伴͕ඞཁ ൿີ伴Λઃஔ ެ։伴Λઃஔ
‣ SSHଓ༻ͷ伴Λ࡞ɾొ͢Δ ‣DockerΠϝʔδΛ࡞ɾొ͢Δ ‣ GitLabϥϯφʔཧ༻ϑΝΠϧΛ࡞͢Δ ‣ σϓϩΠλεΫϥϯφʔཧ༻ϑΝΠϧΛ࡞͢Δ GitLab CIಋೖखॱ
(1)PUSH (2)GitLab CI࣮ߦ (3)ίϯςφىಈ Gitlab (6)Envoy࣮ߦ ςετ࣮ߦ ίϯςφ σϓϩΠ࣮ߦ ίϯςφ
(5)ίϯςφىಈ (4)UnitTest࣮ߦ (7)Pull ຊ൪ڥ or εςʔδϯάڥ ϦϙδτϦ ςετɾσϓϩΠͷ࣮ߦΛߦ͏ ίϯςφͷݩͱͳΔ DockerΠϝʔδ͕ඞཁ ϩʔΧϧͰ࡞ͨ͠DockerΠϝʔδΛ GitLab Container Registryʹొ
‣ SSHଓ༻ͷ伴Λ࡞ɾొ͢Δ ‣ DockerΠϝʔδΛ࡞ɾొ͢Δ ‣GitLabϥϯφʔཧ༻ϑΝΠϧΛ࡞͢Δ ‣ σϓϩΠλεΫϥϯφʔཧ༻ϑΝΠϧΛ࡞͢Δ GitLab CIಋೖखॱ
(1)PUSH (2)GitLab CI࣮ߦ (3)ίϯςφىಈ Gitlab (6)Envoy࣮ߦ ςετ࣮ߦ ίϯςφ σϓϩΠ࣮ߦ ίϯςφ
(5)ίϯςφىಈ (4)UnitTest࣮ߦ (7)Pull ຊ൪ڥ or εςʔδϯάڥ ϦϙδτϦ Push͞ΕͨλΠϛϯάͰϦϙδτϦʹ .gitlab-ci.ymlͱ͍͏ϑΝΠϧ͕͋Ε ͦͷதʹهࡌ͞Εͨδϣϒ͕࣮ߦ͞ΕΔ .gitlab-ci.ymlΛ࡞
.gitlab-ci.yml σϓϩΠ࣮ߦίϯςφ ͷॲཧ༰Λهड़ ςετ࣮ߦίϯςφͰ ༻͢ΔαʔϏε ॲཧ༰Λهड़ ༻͢ΔDockerΠϝʔδ envoyίϚϯυʂ
‣ SSHଓ༻ͷ伴Λ࡞ɾొ͢Δ ‣ DockerΠϝʔδΛ࡞ɾొ͢Δ ‣ GitLabϥϯφʔཧ༻ϑΝΠϧΛ࡞͢Δ ‣σϓϩΠλεΫϥϯφʔཧ༻ϑΝΠϧΛ࡞͢Δ GiLlab CIಋೖखॱ
(1)PUSH (2)GitlabCI࣮ߦ (3)ίϯςφىಈ Gitlab (6)Envoy࣮ߦ ςετ࣮ߦ ίϯςφ σϓϩΠ࣮ߦ ίϯςφ (5)ίϯςφىಈ
(4)UnitTest࣮ߦ (7)Pull ຊ൪ڥ or εςʔδϯάڥ ϦϙδτϦ σϓϩΠ࣮ߦίϯςφͰenvoyίϚϯυ ͕࣮ߦ͞ΕɺEnvoy.blade.phpʹهड़ͨ͠ ॲཧ͕࣮ߦ͞ΕΔ Envoy.blade.phpΛ࡞
Envoy.blade.php ෳͷσϓϩΠઌΛهड़Մೳ EnvoyͷதͰ༻͢Δ άϩʔόϧมతͳͷΛఆٛ ۩ମతͳॲཧΛ৭ʑͱهड़ @serversσΟϨΫςΟϒͰࢦఆͨ͠ϗετʹSSHଓ͠ɺ ͦͷ෦Ͱ@storyσΟϨΫςΟϒͷॲཧ͕࣮ߦ͞ΕΔ
͜͜·Ͱͬͯ GitLab CI͕ಈ͖·͢ʢଟʣ
ৄࡉʹ͍ͭͯฐࣾͷϒϩά͔ ՅݸਓͷϒϩάΛࢀর͍ͩ͘͞ ※ࢀߟ ʮגࣜձࣾRe:Buildͷϒϩάʯ ʮ͚͚ͣΜηϧϑϋοΩϯάʯ
Copyright Re:Build.inc All Rights Reserved. -BSBWFM1)16OJUͷϝϦοτ
4 1 LaravelͰςετ͢ΔϝϦοτ Merit ᶃςετ༻ͷget,postϝιου͕͋Δ ᶄϨεϙϯεͷΞαʔτ͕๛ ᶅςετ༻ͷτϨΠτ͕ศར ᶆϞοΫԽͷΈ͕ศར
getϝιουͷྫ
postϝιουͷྫ
ϨεϙϯεͷΞαʔτ͕๛
ςετ༻τϨΠτ͕ศར ‣ RefreshDatabaseɿ - ̍ͭͷςετ͕ऴΘΔͨͼʹDBΛϦϑϨογϡ͢Δ ‣ DatabaseTransactionsɿ - ̍ͭͷςετ͕ऴΘΔͨͼʹDBΛςετ։࢝લͷঢ়ଶ ·ͰϩʔϧόοΫ͢Δ
‣ WithoutMiddlewareɿ - ֻ͚ΒΕ͍ͯΔMiddlewareΛແࢹ
ɾۄͶ͗ͷΑ͏ͳߏͰϦΫΤετͱ Ϩεϙϯεͷؒʹ༷ʑͳॲཧΛڬΈࠐ Έ͍͢ ɾόϦσʔγϣϯͳͲ୯ҰͷΤϯςΟ ςΟʹґଘ͢ΔͷͰͳ͘ɺForm୯ ҐͰ࣮Ͱ͖Δ MiddleWareͷྫ ೝ ূ ν
Σ ο Ϋɺ ό Ϧ σ ʔ γ ϣ ϯɺ CSRFτʔΫϯͷνΣοΫ [ิ] Middlewareͱʁ
ϞοΫԽͷΈ͕ศར
ϞοΫԽ͢Δલ Mail Class Router Controller SMTPαʔόʔ
ϞοΫԽͨ͋͠ͱ Router Controller SMTPαʔόʔ Mail Class SMTPαʔόʔʹϝʔϧΛૹ৴ͨ͜͠ͱ ʹͯ͘͠ΕΔʢ࣮ࡍʹૹ৴͠ͳ͍ʣ
Copyright Re:Build.inc All Rights Reserved. ·ͱΊ
5 1 ·ͱΊ ᶃ GitLab CIͰςετٴͼσϓϩΠॲཧΛࣗಈԽ͢Δ͜ ͱʹΑΓɺ࡞ۀΛޮԽ࣭ͭͭ͠ͷ୲อ͕Ͱ͖Δ ᶄ LaravelͷPHPUnitʹศརͳΞαʔττϨΠτ͕ ༻ҙ͞Ε͍ͯΔͨΊɺՄಡੑɾอकੑͷߴ͍ςετ͕
ॻ͚Δ