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
はてなにおけるGitHub Actions活用事例 / GitHub Actions in H...
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
papix
January 26, 2021
Technology
2.8k
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
750
YAPC::Kyotoの「全て」 / All of "YAPC::Kyoto"
papix
0
1.7k
イベントの中の人 / Inside the Events
papix
0
360
2022年に始めるPerlでWebサービス開発(趣味)
papix
0
630
ワーケーションに関する考察
papix
3
2.3k
(今更)Amplifyさっくり体験
papix
0
930
ミススペルを発見するmisspellのご紹介 / Introduce misspell
papix
0
1.3k
「知らなかった」を聞きに行く 〜海外カンファレンス参加のススメ〜 / builderscon 2019
papix
0
380
Other Decks in Technology
See All in Technology
Claude Codeをどのように キャッチアップしているか
oikon48
13
8.6k
AWS Security Agent といっしょに脅威モデリングをやってみよう
amarelo_n24
1
180
[AWS Summit Japan 2026]迷っているあなたへ_小さな一歩が、やがて自分を助けてくれる
sh_fk2
1
170
SONiCのLinuxベースを活かしたZabbix監視
sonic
0
230
SONiCで構築・運用する生成AI向けパブリッククラウドネットワーク ~実装編~
sonic
0
280
不要なレビューをAIにまかせて AIコーディングの環境改善を加速した
shoota
1
230
ぼっちではじめた登壇が「51名」「241件」の発信に化けた
subroh0508
1
240
【NRUG vol.18】KubernetesにおけるNew Relicデータ取得量削減の考え方
nrug_member
0
170
[チョークトーク資料]AWS DevOps Agent を使いこなす / AWS Dev Ops Agent Chalk Talk AWS Summit Japan 2026
kinunori
3
570
「勝手に広まる」人気 AI エージェントを爆速で作ろう!(AWS Summit Japan 2026講演資料)
minorun365
PRO
9
2k
Agile and AI Redmine Japan 2026
hiranabe
3
290
Oracle Cloud Infrastructure:2026年6月度サービス・アップデート
oracle4engineer
PRO
0
130
Featured
See All Featured
Beyond borders and beyond the search box: How to win the global "messy middle" with AI-driven SEO
davidcarrasco
3
160
[RailsConf 2023] Rails as a piece of cake
palkan
59
6.7k
Claude Code のすすめ
schroneko
67
230k
Hiding What from Whom? A Critical Review of the History of Programming languages for Music
tomoyanonymous
2
860
Designing for Timeless Needs
cassininazir
1
260
What Being in a Rock Band Can Teach Us About Real World SEO
427marketing
0
260
Building Better People: How to give real-time feedback that sticks.
wjessup
370
20k
Bash Introduction
62gerente
615
220k
We Are The Robots
honzajavorek
0
250
4 Signs Your Business is Dying
shpigford
187
22k
Done Done
chrislema
186
16k
Building the Perfect Custom Keyboard
takai
2
800
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