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
120
地方カンファレンス主催のススメ
bumptakayuki
1
160
Laravelで敢えて試す脆弱性のある書き方
bumptakayuki
1
790
地方でのPHPエンジニア採用って実際どうなの?
bumptakayuki
0
530
沖縄観光、名物を一挙紹介!
bumptakayuki
2
540
Laravel ShiftでLaravelのバージョンアップしてみた話
bumptakayuki
1
1.8k
flutterでイベントアプリを作ってみた
bumptakayuki
0
110
オフショア開発の辛みと学んだ事
bumptakayuki
0
340
ChatGPTにStripeのサンプルコードを書かせてみた
bumptakayuki
1
170
Other Decks in Programming
See All in Programming
Make Impossible States Impossibleを 意識してReactのPropsを設計しよう
ikumatadokoro
0
270
Remix on Hono on Cloudflare Workers
yusukebe
1
300
카카오페이는 어떻게 수천만 결제를 처리할까? 우아한 결제 분산락 노하우
kakao
PRO
0
110
flutterkaigi_2024.pdf
kyoheig3
0
150
エンジニアとして関わる要件と仕様(公開用)
murabayashi
0
300
OSSで起業してもうすぐ10年 / Open Source Conference 2024 Shimane
furukawayasuto
0
110
What’s New in Compose Multiplatform - A Live Tour (droidcon London 2024)
zsmb
1
480
ふかぼれ!CSSセレクターモジュール / Fukabore! CSS Selectors Module
petamoriken
0
150
ヤプリ新卒SREの オンボーディング
masaki12
0
130
Functional Event Sourcing using Sekiban
tomohisa
0
100
型付き API リクエストを実現するいくつかの手法とその選択 / Typed API Request
euxn23
8
2.3k
Laravel や Symfony で手っ取り早く OpenAPI のドキュメントを作成する
azuki
2
120
Featured
See All Featured
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
31
2.7k
Designing the Hi-DPI Web
ddemaree
280
34k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
44
6.8k
What's new in Ruby 2.0
geeforr
343
31k
RailsConf 2023
tenderlove
29
900
Unsuck your backbone
ammeep
668
57k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
109
49k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
26
2.1k
Happy Clients
brianwarren
98
6.7k
Building Applications with DynamoDB
mza
90
6.1k
Product Roadmaps are Hard
iamctodd
PRO
49
11k
Automating Front-end Workflow
addyosmani
1366
200k
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ʹศརͳΞαʔττϨΠτ͕ ༻ҙ͞Ε͍ͯΔͨΊɺՄಡੑɾอकੑͷߴ͍ςετ͕
ॻ͚Δ