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
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
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
2k
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
What the customer really needed
kawaguti
PRO
2
170
20260912_スクラムにジェネラリストは必要か
ryugen04
0
420
DEFCON34-Write-up_HYCu-MYCu
daikiokazaki
0
160
登壇の自信を奪う3匹のオバケ / 3 Ghosts That Rob You of Your Confidence in Public Speaking
pauli
8
920
白金鉱業Meetup Vol.25 アウトカムが二値のデータに対するCausal Impact
brainpadpr
0
200
アプリログインとWeb認証基盤をつなぐ ASWebAuthenticationSession 作法
shimastripe
1
320
AIを活用するために決めた "やらないこと" - 価値に注目する / Not betting on AI
soudai
PRO
1
520
顧客に向き合う開発組織へ。リアーキテクチャとフィーチャーチーム化で挑む組織改革
safie
0
1.9k
「守り」で活用するオンデバイスLLM 〜写ってはいけないを総力戦で防ぐ〜 / iOSDC Japan 2026
nakamuuu
0
160
絵ではじめるKubernetesセキュリティ
aoi1
3
560
Genieを崇めよ
kameitomohiro
0
130
[2026-09-11]SREは誰のもの?運用エンジニアが始める 「SRE領域への越境」とチームの進化の軌跡 〜Road to NEXT CRE
tosite
0
240
Featured
See All Featured
The #1 spot is gone: here's how to win anyway
tamaranovitovic
4
1.2k
The Anti-SEO Checklist Checklist. Pubcon Cyber Week
ryanjones
0
240
Evolving SEO for Evolving Search Engines
ryanjones
0
290
Primal Persuasion: How to Engage the Brain for Learning That Lasts
tmiket
0
450
Sam Torres - BigQuery for SEOs
techseoconnect
PRO
0
540
Getting science done with accelerated Python computing platforms
jacobtomlinson
2
480
Google's AI Overviews - The New Search
badams
0
1.6k
Rails Girls Zürich Keynote
gr2m
96
14k
A designer walks into a library…
pauljervisheath
211
25k
SEO in 2025: How to Prepare for the Future of Search
ipullrank
3
3.8k
Paper Plane (Part 1)
katiecoart
PRO
2
11k
Designing for humans not robots
tammielis
254
26k
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