Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
はてなにおけるGitHub Actions活用事例 / GitHub Actions in H...
Search
papix
January 26, 2021
Technology
2.9k
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
はてなにおけるGitHub Actions活用事例 / GitHub Actions in Hatena
papix
January 26, 2021
More Decks by papix
See All by papix
Houtou.pm #1
papix
0
1.9k
Perl歴約10年のエンジニアがフルスタックTypeScriptに出会ってみた
papix
1
780
YAPC::Kyotoの「全て」 / All of "YAPC::Kyoto"
papix
0
1.7k
イベントの中の人 / Inside the Events
papix
0
370
2022年に始めるPerlでWebサービス開発(趣味)
papix
0
650
ワーケーションに関する考察
papix
3
2.4k
(今更)Amplifyさっくり体験
papix
0
940
ミススペルを発見するmisspellのご紹介 / Introduce misspell
papix
0
1.3k
「知らなかった」を聞きに行く 〜海外カンファレンス参加のススメ〜 / builderscon 2019
papix
0
390
Other Decks in Technology
See All in Technology
2026-09-10 【Snowflake World Tour Tokyo 2026】dbt Core と Snowflake で実現する多層的なデータガバナンス / Multi-Layered Data Governance Powered by dbt Core and Snowflake
civitaspo
0
250
AI時代におけるプロダクト横断勉強会の設計
zozotech
PRO
0
170
生成AIのテナント制御とシャドーMCP対策 | AIを"止めずに"、情報を守る
yukun
0
140
なぜSRE・セキュリティは評価されないのか?守りの組織を事業成長エンジンに変えた実践
cscengineer
PRO
3
2.4k
【視聴者参加型!】AWSセキュリティアンチパターンクイズ
syoshie
0
460
20260903 Tokyo Jazug Night #62 | Azure エンジニアよ、 その環境は本当にセキュアか?
olivia_0707
1
640
コスト最適化の「めんどくさい」を AWS FinOps Agent でチョット楽にする
classmethod_kaz
0
280
Nav2、Nav3 ... はたまた自作?〜 作って理解する Nav3 の設計意図 〜 / Nav2, Nav3 ... or Build Your Own? — Understanding Nav3's design intent by building it from scratch
yanzm
0
260
目の前の楽しいが人生を変える - コミュニティの螺旋の歩き方と楽しむコツ / change your life
soudai
PRO
3
170
AI-DLCって実際どう? 〜聞きたいこと全部聞いてみる〜
news_it_enj
0
240
Driving AI Adoption Using In-House GPUs to Serve Qwen
po3rin
2
470
Amazon Quick on DesktopがIAM Identity Centerで動かない理由
yukiogawa
0
120
Featured
See All Featured
Kristin Tynski - Automating Marketing Tasks With AI
techseoconnect
PRO
0
510
How to Think Like a Performance Engineer
csswizardry
28
2.8k
Keith and Marios Guide to Fast Websites
keithpitt
413
23k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
31
2.9k
Navigating Team Friction
lara
192
16k
Chasing Engaging Ingredients in Design
codingconduct
0
300
How to Build an AI Search Optimization Roadmap - Criteria and Steps to Take #SEOIRL
aleyda
1
2.2k
A Soul's Torment
seathinner
7
3.6k
We Have a Design System, Now What?
morganepeng
55
8.3k
Intergalactic Javascript Robots from Outer Space
tanoku
273
27k
Fantastic passwords and where to find them - at NoRuKo
philnash
52
3.8k
How to Align SEO within the Product Triangle To Get Buy-In & Support - #RIMC
aleyda
2
1.8k
Transcript
ͯͳͰͷ GitHub Actions׆༻ࣄྫ CI/CD׆༻ࣄྫˍTIPSൃදձ id:papix (גࣜձࣾͯͳ)
ࣗݾհ • papix (id:papix / @__papix__) • גࣜձࣾͯͳ WebΞϓϦέʔγϣϯΤϯδχΞ (2017ʙ)
• ϒϩάMediaνʔϜ → ϚϯΨνʔϜ • Ұൠࣾஂ๏ਓJapan Perl Associationཧࣄ • ϒϩά: https://papix.hatena(blog.(com|jp)|diary.jp)
ࠓ͢͜ͱ • ňͯͳͰͷGitHub Actions׆༻ࣄྫʼn • 2ͭͷαʔϏεΛࡐʹͯ͠, ҎԼʹ͍ͭͯ͠·͢: • GitHub ActionsͷҠߦ,
ͦͷதͷ, ίετܭࢉ • GitHub ActionsͷϝϦοτ/σϝϦοτ • ͓͠ΖςΫ
ࡐ
ͯͳϒϩά
ͯͳϒϩάMedia
GigaViewer • ࣾͰ։ൃ͍ͯ͠ΔϚϯΨϏϡʔϫ • ϒϥβͰອըΛಡΉͨΊͷػೳΛఏڙ • Ϗϡʔϫ / τοϓϖʔδ /
ݕࡧը໘ / ཧը໘ ... • ग़൛༷͚ࣾʹఏڙ • 11ࣾ / 13ͷαΠτͰ࠾༻
গδϟϯϓʴ גࣜձࣾूӳ༷ࣾ (https://shonenjumpplus.com/)
ίϛοΫDAYS גࣜձࣾߨஊ༷ࣾ (https://comic-days.com/)
ίϛοΫϒγϩʔυ WEB גࣜձࣾϒγϩʔυϝσΟΞ༷ (https://comicbushi-web.com/)
͜Ε·Ͱͷ͋Β͢͡
ैདྷͷCIڥ • EC2্ʹߏஙͨ͠Jenkins • ։ൃʹؾΛऔΒΕͯ, Ͳ͏ͯ͠อकཧ͕ޙճ͠ʹ͞Ε͕ͪ.. • ྺ࢙తܦҢʹΑΓ, ಉ࣌ʹ࣮ߦͰ͖ͳ͍ςετ •
ಉ࣌ʹͨ͘͞Μͷpush͕ߦΘΕΔͱ, ςετ͕ऴΘΔ·Ͱे ͭඞཁ...
GitHub.comԽͱGitHub Actionsͷొ • ͦͷࠒ, GitHub EnterpriseΛGitHub.comʹஔ͖͑Δಈ͖͕͋ͬͨ • ͦͷྲྀΕͷதͰ, GitHub Actionsొ͖ͯͨ͠
• ň͜Ε͏͔͠ͳ͍!!!ʼn • ...ͱ͍͏͜ͱͰ, ࠷େͷωοΫͩͬͨňςετʼnͷGitHub ActionsԽ ͔ΒऔΓΉ͜ͱʹͨ͠
GitHub Actionsͱ?
GitHub Actions • GitHub͕ఏڙ͢ΔCI/CDڥ • Linux, macOS, WindowsڥʹରԠ • GitHub
ActionsͰͷॲཧϫʔΫϑϩʔΛॻ͘ࣄͰఆٛ • ϦϙδτϦͷ .github/work f l ow σΟϨΫτϦʹYAMLͰهड़
GitHub Actions • GitHubͱ"ྑ͍ҙຯͰ"ີ݁߹͍ͯ͠Δ • pushͨ͠Βଈ࠲ʹॲཧΛ࣮ߦͯ͘͠ΕΔ • ྉۚ • Linuxͷ߹,
1͋ͨΓ $0.008 • GitHub Enterprise CloudͳΒ݄50,000ͷແྉ͋Γ
ςετͷGitHub ActionsԽ
։ൃڥͷDockerԽ • ࠷ॳʹ։ൃڥΛDockerԽ͓͖ͯ͠·͠ΐ͏ • ࣗͷPCͰςετ͕DockerͰ݁͢Ε, GitHub ActionsͰ ςετͪΌΜͱಈͣ͘! •
docker-compose.yml ʹඞཁͳϛυϧΣΞͳͲͷఆٛΛॻ͍ͯ, docker-compose run ͰςετΛ࣮ߦͰ͖ΔΑ͏ʹ͢Δ
ϫʔΫϑϩʔͷߏங • ։ൃڥͷDockerԽ͕͍ྃͯ͠Ε, ͦ͏͘͠ͳ͍ͣ • ΠϝʔδΛϏϧυͯ͠, docker-compose runͰςετΛ࣮ߦͯ͠...
GitHub ActionsԽ ʙʙ
...ͱ, ؆୯ʹ͍͔ͳ͍ • ͍Ζ͍Ζߟ͑Δࣄ͕͋Δ! • ςετͷ࣌ؒΛͳΔ͘͘͢Δ • ίετͷࢼࢉ • Jenkins͔Βͷஔ͖͑࡞ઓ
• etc...
࣮ߦ࣌ؒͷݮ
DockerͷΠϝʔδϏϧυ͠ͳ͍ • ňͦΓΌͦ͏ͩ!ʼnͱ͍͏ײ͡Ͱ͕͢... • ։ൃڥͷdocker imageΛECRʹొͯ͠, ςετ͢Δ͝ͱʹ pull͢Δͱ͍͏࡞ઓ͕͑Δ
ECR͔Β pull͢Δྫ name: tes t on : pull_request : jobs
: test : - uses: actions/
[email protected]
. 4 - name: Configure AWS Credential s uses: aws-actions/configure-aws-
[email protected]
. 5 with: .. . - name: Login to Amazon EC R uses: aws-actions/
[email protected]
. 1 - name: Pull from EC R run: docker pull ...
ςετͦͷͷʹ͕͔͔࣌ؒΔ • GitHub ActionsAzureͷStandard_DS2_v2্Ͱಈ࡞͢Δ • εϖοΫvCPU 2, ϝϞϦ 7GB •
ී௨ʹςετΛճ͢ͱ, 1࣌ؒܦաͯ͠ऴΘΒͳ͍...
࡞ઓ • ͦ͜Ͱ, ࣍ͷΑ͏ͳ࡞ઓΛߟ͑·ͨ͠: • self-hosted runnerΛ͏ • AWS CodeBuildΛ͏
self-hosted runner • ͕ࣗ࡞ͬͨڥͰGitHub ActionsͷॲཧΛ࣮ߦͰ͖ΔΈ • ඞཁͳڥΛߏஙͯ͠, GitHubʹొ͢Δͱར༻Ͱ͖Δ • ϦϙδτϦ/Organization/EnterpriseͷϨϕϧͰڞ༗Ͱ͖Δ
• ੲϦϙδτϦ୯ҐͰ͔͠ొ͕ग़དྷͳ͔ͬͨهԱ͕͋Δ
self-hosted runner • self-hosted runnerجຊతʹىಈͬ͠ͺͳ͠ • = ॲཧΛ͍ͯ͠ͳͯ͘ίετ͕͔͔Δ • self-hosted
runner 1ʹ͖ͭ1ͭͷॲཧ͔͠ग़དྷͳ͍ • ෳͷॲཧΛ͚ͨ͠Ε, ෳͷself-hosted runner͕ඞཁ
AWS CodeBuild • AWS CodeBuildͳΒ, vCPU 32, ϝϞϦ144GBͷڥ͕͋Δ! • self-hosted
runnerͱҧ͍, ࣮ߦ/՝ۚ • ͨͩ, ňGitHub Actions͔ΒAWS CodeBuildΛىಈʼnͲ͏ͳͷ͔? • ͩͬͨΒňJenkins͔ΒAWS CodeBuildΛىಈʼnͰྑ͘ͳ͍? • ߋʹݴ͑ňAWS CodePipelineʼnͰྑ͘ͳ͍???
͏1ͭͷબࢶ • ňTravisCI ͰૈࡶʹςετΛׂ࣮ߦ͢Δʼn • https://ssig33.com/text/distributed_test_on_TravisCI • ͭ·ΓͲ͏͍͏͜ͱ͔ͱݴ͏ͱ...
ςετΛ16ׂ!!!!!
ϏϧυϚτϦοΫεͷ׆༻ • GitHub ActionsʹňϏϧυϚτϦοΫεʼnͱ͍͏֓೦͕͋Δ • ຊདྷ, Perlͷ5.32ܥ, 5.30ܥ, 5.28ܥ... ͷΑ͏ʹ,
ෳͷڥͰಉ࣌ ʹςετΛ࣮ߦ͢ΔͨΊͷͷ • ͜ΕΛͬͯ, ςετΛ16ׂ࣮ͯ͠ߦ͢Δ!!! • ίετવ16ഒ͕ͩ, ͦͷૉૣ͘ऴΘΔͷͰेʹϖΠ͢Δ
ϏϧυϚτϦοΫεͷ׆༻ • ϏϧυϚτϦοΫεͱͯ͠࿈൪Λࢦఆ • = ࿈൪ͷ͚ͩςετΛׂ࣮ͯ͠ߦ͢Δ • ྫ͑1͔Β16·Ͱͷ࿈൪ͳΒ, 16ׂ •
f i ndΛͬͯςετରͷҰཡΛऔಘ → splitͰׂ → ࣮ߦ • ҙͱͯ͠, ςετΛׂ͢Δ݁ՌႈͰͳ͚ΕͳΒͳ͍
ϫʔΫϑϩʔͷ ༷ࢠ jobs : test : strategy : # ׂͨ͠ςετͷ͏ͪ,
1͕ͭίέͯଞͷશͯΛcancel͠ͳ͍Α͏ʹ͢Δ fail-fast: fals e matrix : test_id: ["01", "02", "03"] # ࿈൪Λࢦఆ steps : ... ॾʑͷ४උ .. . # findͱsplitΛͬͯ, ςετରͱͳΔϑΝΠϧ໊͕ॻ͔Εͨ # test01, test02, test03 ͱ͍͏ϑΝΠϧΛ࡞ - name: Split tests into chunk s run: | find t -name "*.t" -not -type d > test_files.tx t split -n r/${{ strategy.job-total }} \ --numeric-suffixes=1 \ --elide-empty-files test_files.txt tes t # ↑Ͱ࡞ͬͨ test01, test02, test03ͷ͍ͣΕ͔Λରͱͯ͠ # ςετΛ࣮ߦ͢Δ - name: tes t run: | docker-compose run --rm --no-deps app \ carton exec -- prove < test${{ matrix.test_id }} ※ 3ׂͷྫ
prepareδϣϒͷ༻ҙ • ςετΛ࣮ߦ͢Δʹ͋ͨͬͯඞཁͳॲཧprepareδϣϒʹԡ͠ࠐΉ • 16ׂͨ͠ςετͦΕͧΕͰ࣮ߦ͢ΔͱඇޮͳͨΊ • ςετprepareϑΣΠζޙʹ࣮ߦ͢ΔΑ͏ʹ͢Δ • prepareδϣϒͰ༻ҙͨ͠ϑΝΠϧ, ଞͷδϣϒͰͦͷ··͑ͳ͍
• ͋Δδϣϒͱผͷδϣϒ, ผͷڥͰॲཧ͕࣮ߦ͞ΕΔͨΊ • prepareδϣϒͰΩϟογϡͯ͠, ͦΕΛར༻͢ΔΑ͏ʹ͢Δ
ϫʔΫϑϩʔͷ ༷ࢠ jobs : prepare : runs-on: ubuntu-20.0 4 steps
: - uses: actions/
[email protected]
. 4 - name: Configure AWS Credential s uses: aws-actions/configure-aws-
[email protected]
. 5 with: .. . # path-to-cache ͱ͍͏ϑΝΠϧΛ # Ωϟογϡ͢Δྫ - uses: papix/
[email protected]
. 3 env: .. . with : bucket: ${{ env.cache-bucket } } key: ${{ hashFiles('path-to-cache') } } path: path-to-cach e
ϫʔΫϑϩʔͷ ༷ࢠ jobs : prepare : ... prepareͷॲཧ .. .
test : needs: prepare # needs Ͱ prepare ʹґଘ͢Δ͜ͱΛఆٛ strategy : fail-fast: fals e matrix : id: ["01", "02", "03" ] steps : ... ςετͷॲཧ ...
actions/cache • ΩϟογϡपΓެࣜͷactions/cache͕͋Δ • ͦͦ͜͜ͷසͰΩϟογϡͷऔಘʹࣦഊ͢Δ͜ͱ͕͋ͬͨ • 16ׂ͍ͯ͠Δͱ, ݁ߏͳ֬Ͱऔಘʹࣦഊ͢Δ • ߋʹ,
ň16ׂͨ͠͏ͪͷࣦഊͨ͠1ͭʼnΛ࣮ߦ͢ΔͷෆՄೳ • 16ׂશͯ࠶࣮ߦ͠ͳ͚ΕͳΒͳ͍...
papix/action-cache-s3 • https://github.com/papix/action-cache-s3 • ͦ͜Ͱ, S3Λར༻ͨ͠ΩϟογϡͷΈΛ࡞ͬͨ • ͜ΕͰ, ΩϟογϡΛऔಘग़དྷͣʹࣦഊ͢Δྫ͍ͩͿݮͬͨ
͜͏ͯ͠... • ϒϩάͷςετpush͔ͯ͠Β7ʙ10Ͱऴྃ͢ΔΑ͏ʹͳΓ·ͨ͠ • ͔͠, GitHub Actionsͷδϣϒεέʔϧ͢ΔͷͰ, ෳͷpush͕ ͋ͬͯৗʹಉ࣌ʹͬͯ͘ΕΔ! •
΄΅ϝϯςφϯεϑϦʔͰ, ։ൃମݧ͕େ෯ʹ্!!! • Jenkins࣌ͱൺΔͱ, ࢼࢉͰίετ2/3ʹͳΓ·ͨ͠ • ※ ແྉΛߟྀ͠ͳ͍߹
σϝϦοτ • ϫʔΫϑϩʔactionͷσόοά͕͍͠ • JenkinsͷΑ͏ʹ, ࣮ࡍʹαʔόʔʹೖͬͯڍಈΛݟΔ... ͱ͍͏ͷ͕ ͍͠ • σόοάϩΪϯάΛݩʹ,
ϩά͔Βௐࠪ͢Δඞཁ͕͋Δ • tmuxͷηογϣϯΛੜ͢tmateͱaction-tmateΛͬͯ SSHଓ͢Δ͜ͱՄೳ͕ͩ...
GitHub Actions ͓͠ΖςΫ
Linter/Formatter + reviewdog • reviewdog • https://github.com/reviewdog/reviewdog • GitHubͳͲͷίʔυʹίϝϯτΛ͢͜ͱ͕Ͱ͖Δ •
Linterͷ݁ՌΛ͢ͱ, ܯࠂΛग़ͯ͘͠ΕΔ • ྫ rubocop: https://github.com/reviewdog/action-rubocop • work f l ow commandͰΞϊςʔγϣϯΛ͚Δํ๏͋Γ·͢
Perl::Critic + reviewdog • Perl::Critic • PerlͷߏจΛղੳ͠, ฆΒΘ͍͠ߏจΛࢦఠͯ͘͠ΕΔπʔϧ • Perl::CriticʹରԠͨ͠reviewdogͷactionଘࡏ͠ͳ͍͕...
• Perl::Criticͷग़ྗΛreviewdogʹରԠͨ͠ͷʹมߋ͢ΕOK
Perl::Critic + reviewdog • ৄ͘͠... • ňreviewdog x perlcritic x
Jenkins Ͱ࠷ߴͷ GitHub ϨϏϡʔϥΠ ϑʼn • https://tech.mirrativ.stream/entry/reviewdog-perlcritic-jenkins-for-github-reviewing
GitHub ActionsͰ Perl::CriticΛ͏ name: criti c on : pull_request :
critic : runs-on: ubuntu-lates t steps : - uses: actions/
[email protected]
. 4 - name: Setup reviewdo g uses: reviewdog/
[email protected]
. 2 - name: Criticiz e run: | perlcritic --profile .perlcriticrc --verbose '%f:%l:%c:**%m**, near <code>%r</code>.<br>(Ref: [%p] (https://metacpan.org/pod/Perl::Critic::Policy::%p))\n' lib t | reviewdog -efm=%f:%l:%c:%m -name=perlcritic -reporter=github-pr-review
Perl::Critic + reviewdog
misspell + reviewdog • misspell: https://github.com/client9/misspell • GoͰॻ͔Εͨ, ϛεεϖϧΛൃݟͯ͘͠ΕΔπʔϧ •
ίʔυதͷtypoΛڭ͑ͯ͘ΕΔ • reviewdog/action-misspell • Pull Requestʹࣗಈతʹίϝϯτͯ͘͠ΕΔ
GitHub ActionsͰ misspellΛ͏ name: misspel l on : pull_request :
jobs : misspell : runs-on: ubuntu-lates t steps : - uses: actions/
[email protected]
. 4 - name: misspel l uses: reviewdog/
[email protected]
. 0 with : reporter: 'github-pr-review '
reviewdog/action-misspell
ϥϕϧͷνΣοΫ • Pull RequestʹϥϕϧΛ͚ͭΔӡ༻ϑϩʔ • ྫ: ϦϦʔεʹΑͬͯϢʔβʔͷӨڹ͕͋Δ࣌ňӨڹ͋Γʼn, ͦ͏Ͱͳ͍࣌ňӨڹͳ͠ʼnͷϥϕϧΛ͚ͭΔ •
GitHub ActionsͰ, ϥϕϧͷ͚ͭΕʹܯࠂ͢Δ͜ͱՄೳ • https://github.com/danielchabr/pr-labels-checker
ϥϕϧͷ ࣗಈνΣοΫ name: label-chec k on : pull_request : jobs
: check-labels : runs-on: ubuntu-lates t steps : - uses: danielchabr/pr-labels-checker@v2. 2 with : hasSome: Өڹ͋Γ,Өڹͳ͠
·ͱΊ
·ͱΊ • ͯͳͰͷGitHub Actionsͷ׆༻ࣄྫΛհ͠·ͨ͠ • Jenkins͔ΒGitHub ActionsʹҠߦ͢Δ͜ͱͰ, ϝϯςφϯεϑϦʔ ͳCIڥΛैདྷΑΓίετͰ࣮ݱग़དྷΔΑ͏ʹͳΓ·ͨ͠ •
GitHub ActionsͷศརͳactionΛ׆༻͢Δ͜ͱͰ, ༷ʑͳޮԽΛ ࣮ݱ͢Δ͜ͱՄೳͰ͢
We are hiring! ͯͳͰ, CI/CD, ͦͯࣗ͠ಈԽʹڵຯͷ͋Δ ΤϯδχΞΛืू͍ͯ͠·͢!!!! https://hatenacorp.jp/recruit/engineer