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的継続的インテグレーション
Search
Takayuki
August 08, 2018
Programming
1
63
Laravel5.5的継続的インテグレーション
Laravel5.5的継続的インテグレーション
Takayuki
August 08, 2018
Tweet
Share
More Decks by Takayuki
See All by Takayuki
エンジニアのキャリア論
bumptakayuki
0
130
地方カンファレンス主催のススメ
bumptakayuki
1
170
Laravelで敢えて試す脆弱性のある書き方
bumptakayuki
1
840
地方でのPHPエンジニア採用って実際どうなの?
bumptakayuki
0
550
沖縄観光、名物を一挙紹介!
bumptakayuki
2
560
Laravel ShiftでLaravelのバージョンアップしてみた話
bumptakayuki
1
1.9k
flutterでイベントアプリを作ってみた
bumptakayuki
0
120
オフショア開発の辛みと学んだ事
bumptakayuki
0
350
ChatGPTにStripeのサンプルコードを書かせてみた
bumptakayuki
1
180
Other Decks in Programming
See All in Programming
useSyncExternalStoreを使いまくる
ssssota
6
1k
なまけものオバケたち -PHP 8.4 に入った新機能の紹介-
tanakahisateru
1
120
SymfonyCon Vienna 2025: Twig, still relevant in 2025?
fabpot
3
1.2k
Итераторы в Go 1.23: зачем они нужны, как использовать, и насколько они быстрые?
lamodatech
0
720
Semantic Kernelのネイティブプラグインで知識拡張をしてみる
tomokusaba
0
180
menu基盤チームによるGoogle Cloudの活用事例~Application Integration, Cloud Tasks編~
yoshifumi_ishikura
0
110
Symfony Mapper Component
soyuka
2
730
クリエイティブコーディングとRuby学習 / Creative Coding and Learning Ruby
chobishiba
0
3.9k
PHPとAPI Platformで作る本格的なWeb APIアプリケーション(入門編) / phpcon 2024 Intro to API Platform
ttskch
0
160
ゆるやかにgolangci-lintのルールを強くする / Kyoto.go #56
utgwkk
1
370
CSC305 Lecture 25
javiergs
PRO
0
130
Zoneless Testing
rainerhahnekamp
0
120
Featured
See All Featured
A Tale of Four Properties
chriscoyier
157
23k
Fashionably flexible responsive web design (full day workshop)
malarkey
405
66k
Agile that works and the tools we love
rasmusluckow
328
21k
Music & Morning Musume
bryan
46
6.2k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
8
1.2k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
29
2.3k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
127
18k
Measuring & Analyzing Core Web Vitals
bluesmoon
4
170
Writing Fast Ruby
sferik
628
61k
Building Flexible Design Systems
yeseniaperezcruz
327
38k
Bootstrapping a Software Product
garrettdimon
PRO
305
110k
Facilitating Awesome Meetings
lara
50
6.1k
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ʹศརͳΞαʔττϨΠτ͕ ༻ҙ͞Ε͍ͯΔͨΊɺՄಡੑɾอकੑͷߴ͍ςετ͕
ॻ͚Δ