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.4k
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
370
VueRouterとNuxtのルーティング/VueRouter and Nuxt Routing
kkznch
0
330
Vuexで何を管理する方が良い?/What is better to store in Vuex?
kkznch
1
710
Firestoreのルール設定 割と何でも出来てビビる/Firestore rule setting
kkznch
1
730
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
Semantic Kernelのネイティブプラグインで知識拡張をしてみる
tomokusaba
0
180
数十万行のプロジェクトを Scala 2から3に完全移行した
xuwei_k
0
270
Mermaid x AST x 生成AI = コードとドキュメントの完全同期への道
shibuyamizuho
0
160
Haze - Real time background blurring
chrisbanes
1
510
Cloudflare MCP ServerでClaude Desktop からWeb APIを構築
kutakutat
1
540
htmxって知っていますか?次世代のHTML
hiro_ghap1
0
330
競技プログラミングへのお誘い@阪大BOOSTセミナー
kotamanegi
0
360
ドメインイベント増えすぎ問題
h0r15h0
1
230
DevFest Tokyo 2025 - Flutter のアプリアーキテクチャ現在地点
wasabeef
5
900
複雑な仕様に立ち向かうアーキテクチャ
myohei
0
170
見えないメモリを観測する: PHP 8.4 `pg_result_memory_size()` とSQL結果のメモリ管理
kentaroutakeda
0
310
短期間での新規プロダクト開発における「コスパの良い」Goのテスト戦略」 / kamakura.go
n3xem
2
170
Featured
See All Featured
We Have a Design System, Now What?
morganepeng
51
7.3k
A Tale of Four Properties
chriscoyier
157
23k
Building an army of robots
kneath
302
44k
Learning to Love Humans: Emotional Interface Design
aarron
273
40k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
29
2k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
28
4.4k
jQuery: Nuts, Bolts and Bling
dougneiner
61
7.5k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
32
2.7k
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
656
59k
A Modern Web Designer's Workflow
chriscoyier
693
190k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
33
1.9k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
28
900
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ʹศརͳΞαʔττϨΠτ͕ ༻ҙ͞Ε͍ͯΔͨΊɺՄಡੑɾอकੑͷߴ͍ςετ͕
ॻ͚Δ