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
Search
yuki
January 13, 2022
Programming
0
310
脱初心者のための GitHub Actions
「GitHub Actionsって聞いたことあるけど、よく理解していない」
「知ってるけど使ったことない」
という方向けの内容です。
yuki
January 13, 2022
Tweet
Share
More Decks by yuki
See All by yuki
誰のためのコメント? / comments-for-whom
yyykms123
0
59
今年の抱負 2024/Aspirations for 2024
yyykms123
0
140
Vercel Ship まとめ「2023/5/1-5」
yyykms123
0
110
プロジェクト管理で失敗したこと
yyykms123
0
37
プロジェクトをリリースするまでのプロセス
yyykms123
0
37
実務で使えるGitコマンド
yyykms123
4
1.1k
過去の自分へ送るLT!
yyykms123
0
83
Other Decks in Programming
See All in Programming
サーバーゆる勉強会 DBMS の仕組み編
kj455
1
210
Jaspr Dart Web Framework 박제창 @Devfest 2024
itsmedreamwalker
0
140
Stackless и stackful? Корутины и асинхронность в Go
lamodatech
0
1.2k
責務を分離するための例外設計 - PHPカンファレンス 2024
kajitack
9
2.3k
LLM Supervised Fine-tuningの理論と実践
datanalyticslabo
8
1.8k
テストケースの名前はどうつけるべきか?
orgachem
PRO
1
180
React 19でお手軽にCSS-in-JSを自作する
yukukotani
5
530
快速入門可觀測性
blueswen
0
480
月刊 競技プログラミングをお仕事に役立てるには
terryu16
1
1.1k
数十万行のプロジェクトを Scala 2から3に完全移行した
xuwei_k
0
970
PHPで作るWebSocketサーバー ~リアクティブなアプリケーションを知るために~ / WebSocket Server in PHP - To know reactive applications
seike460
PRO
2
720
見えないメモリを観測する: PHP 8.4 `pg_result_memory_size()` とSQL結果のメモリ管理
kentaroutakeda
0
900
Featured
See All Featured
It's Worth the Effort
3n
183
28k
Adopting Sorbet at Scale
ufuk
74
9.1k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
248
1.3M
The Straight Up "How To Draw Better" Workshop
denniskardys
232
140k
Visualization
eitanlees
146
15k
Stop Working from a Prison Cell
hatefulcrawdad
267
20k
Unsuck your backbone
ammeep
669
57k
A Philosophy of Restraint
colly
203
16k
GitHub's CSS Performance
jonrohan
1030
460k
Being A Developer After 40
akosma
89
590k
Git: the NoSQL Database
bkeepers
PRO
427
64k
The MySQL Ecosystem @ GitHub 2015
samlambert
250
12k
Transcript
ॳ৺ऀͷͨΊͷ GitHub Actions ϛϥΠτσβΠϯ / ϖνΦϒ 2021.08.12 / Yukimasa Ikeda
ࣗݾհ • ా ༗ًক / Yukimasa Ikeda • 1994ੜ·Ε ਆಸݝԣࢢग़
• 2015/04ʙ2018/12 ધһ • 2019/06ʙ2021/08 ΤϯδχΞ • Rails, iOS, Android, Laravel, React, Next.js
ࠓճͷର • GitHub Actionsͬͯฉ͍ͨ͜ͱ͋Δ͚Ͳɺ Α͘ཧղ͍ͯ͠ͳ͍ • GitHub ActionsͬͯΔ͚Ͳͬͨ͜ͱ͕ ͳ͍
͢༰ 1. GitHub Actionsͱʁ 2. GitHub Actionsͷ͍ํ 3. ࣮ࡍʹಈ͔ͯ֬͠ೝͯ͠ΈΔ
GitHub Actionsͱʁ
GitHub Actionsͱʁ 6 • CI/CDͷαʔϏε • ϦϙδτϦͱ࿈ܞ͠ɺϏϧυɾ ςετɾσϓϩΠΛࣗಈԽͤ͞Δ •
GitHubͷϑΝʔετύʔςΟ ͳͷͰIssuePRͱͷ࿈ܞ͕Մೳ GitHub Actionsͷಛ
GitHub Actionsͱʁ 7 GitHub Actionsͷྉۚ
GitHub Actionsͱʁ 8 GitHub Actionsͷྉۚ
ΫϥυܕCI/CDαʔϏεͷਓؾͷൺֱ
GitHub Actionsͷ͍ํ
GitHub Actionsͷ͍ํ ϫʔΫϑϩʔΛઃఆ͢Δ
GitHub Actionsͷ͍ํ 12 ϫʔΫϑϩʔͱʁ • ϏϧυɾςετɾσϓϩΠͳͲɺͦͷଞϦϙδτϦͰԿ͔͠Βࣗಈ Խ͞Εͨϓϩηε • pushPRɺWebhookΛ༻ͨ͠֎෦ΠϕϯτͳͲΛτϦΨʔʹಈ࡞ ͢Δ
• Կ͔͠ΒͷλεΫΛ࣮ߦ͢Δδϣϒ͔Βߏ͞ΕΔ • YAMLܗࣜͰઃఆϑΝΠϧΛ࡞͢Δ
GitHub Actionsͷ͍ํ 13 ϫʔΫϑϩʔͷ࡞ • ϦϙδτϦʹ .github/workflows ͱ͍͏σΟϨΫτϦΛ࡞͠ɺ ͦͷԼʹ .yml
͔ .yaml ͱ͍͏֦ுࢠͰϫʔΫϑϩʔͷઃఆϑΝ ΠϧΛ࡞ • ϑΝΠϧ໊ࣗ༝ • ϫʔΫϑϩʔ͝ͱʹෳϑΝΠϧΛ࡞͢Δ͜ͱՄೳ
name: learn-github-actions on: [push ] jobs : check-bats-version : runs-on:
ubuntu-latest steps : - uses: actions/checkout@v2 - uses: actions/setup-node@v1 - run: npm install -g bats - run: bats -v GitHub Actionsެࣜͷαϯ ϓϧͷϫʔΫϑϩʔ GitHub Actionsͷ͍ํ ެࣜͷwork fl ow
name: learn-github-actions on: [push ] jobs : check-bats-version : runs-on:
ubuntu-latest steps : - uses: actions/checkout@v2 - uses: actions/setup-node@v1 - run: npm install -g bats - run: bats -v GitHubϦϙδτϦʹදࣔ͞ ΕΔϫʔΫϑϩʔͷ໊લɻ লུՄೳͰɺলུ͢Δͱ૬ ରύε໊͕લͱͳΔɻ GitHub Actionsͷ͍ํ name:
name: learn-github-actions on: [push ] jobs : check-bats-version : runs-on:
ubuntu-latest steps : - uses: actions/checkout@v2 - uses: actions/setup-node@v1 - run: npm install -g bats - run: bats -v ඞਢ τϦΨʔͱͳΔΠϕϯτͷ ໊લɻ 1ͭͷΠϕϯτ͘͠ෳ ͷΠϕϯτΛࢦఆ͢Δ͜ͱ ͕Ͱ͖Δɻ GitHub Actionsͷ͍ํ on:
name: learn-github-actions on: [push, pull_request ] jobs : check-bats-version :
runs-on: ubuntu-latest steps : - uses: actions/checkout@v2 - uses: actions/setup-node@v1 - run: npm install -g bats - run: bats -v ෳͷ߹ྻͰࢦఆ͢ Δ͜ͱ͕Մೳɻ GitHub Actionsͷ͍ํ on:
name: learn-github-actions on : push : branches : - main
pull_request : branches : - main jobs : check-bats-version : runs-on: ubuntu-latest steps : - uses: actions/checkout@v2 - uses: actions/setup-node@v1 - run: npm install -g bats - run: bats -v Πϕϯτ͝ͱʹઃఆΛߦ͏ ߹ɺͦΕͧΕͷΠϕϯ τʹରͯ͠ઃఆ͢Δඞཁ͕ ͋Δɻ ઃఆ͕ͳ͍ΠϕϯτؚΊ ίϩϯʢ:ʣΛՃ͢Δ GitHub Actionsͷ͍ํ on:
name: learn-github-actions on: [push ] jobs : check-bats-version : runs-on:
ubuntu-latest steps : - uses: actions/checkout@v2 - uses: actions/setup-node@v1 - run: npm install -g bats - run: bats -v ϫʔΫϑϩʔϑΝΠϧͰ࣮ ߦ͞ΕΔશͯͷδϣϒΛά ϧʔϓԽ͢Δɻ sampleͰ check-bats-versio n ͱ͍͏໊લͷJobΛ1͚ͭͩ ఆ͍ٛͯ͠Δɻ GitHub Actionsͷ͍ํ jobs:
name: learn-github-actions on: [push ] jobs : check-bats-version : runs-on:
ubuntu-latest steps : - uses: actions/checkout@v2 - uses: actions/setup-node@v1 - run: npm install -g bats - run: bats -v ඞਢ ԾϚγϯͷࢦఆɻ sanpleͰUbuntu LinuxͰ ࣮ߦ͢ΔΑ͏ʹઃఆΛͯ͠ ͍Δ GitHub Actionsͷ͍ํ run-on:
αϙʔτ͞Ε͍ͯΔԾϚγϯ
name: learn-github-actions on: [push ] jobs : check-bats-version : runs-on:
ubuntu-latest steps : - uses: actions/checkout@v2 - uses: actions/setup-node@v1 - run: npm install -g bats - run: bats -v ίϚϯυΛ࣮ߦͰ͖Δλε Ϋɻ Կ͔͠ΒͷίϚϯυΛ࣮ߦ ͢Δ͔ɺԿ͔͠ΒͷΞΫ γϣϯΛݺͼग़͢ɻ usesΞΫγϣϯɺ runίϚϯυΛࢦఆ͢Δɻ GitHub Actionsͷ͍ํ steps:
GitHub Actionsͷ͍ํ 23 Action • StepΛߏ͢Δ࠷খ୯ҐͰɺԿ͔͠ΒͷॲཧͷմΛද͢ • GitHub Actions͕ఏڙ͍ͯͨ͠ΓɺಠࣗͷΞΫγϣϯΛ࡞͢Δ͜ͱ͕Ͱ ͖Δ
• ύϒϦοΫϦϙδτϦDockerϨδετϦͰެ։͞ΕͨΞΫγϣϯΛ࣮ߦ ͢Δ͜ͱ͕Ͱ͖Δ
name: learn-github-actions on: [push ] jobs : check-bats-version : runs-on:
ubuntu-latest steps : - name: First step uses: actions/checkout@v 2 - name: Setup node uses: actions/setup-node@v 1 - name: Install bats run: npm install -g bat s - name: Bats version run: bats -v stepGitHubͰදࣔ͞ΕΔ ໊લΛ͚ͭΔ͜ͱ͕Ͱ͖ Δɻ GitHub Actionsͷ͍ํ steps:
GitHubͷActionsͰ֬ೝ͢Δͱ໊લ͕͍͍ͭͯΔ
࣮ࡍʹαϯϓϧΛ࣮ߦͯ͠ΈΑ͏ʂ
ϦϙδτϦΛ࡞࣮ͯ͠ࡍʹ֬ೝͯ͠ΈΔ # ϦϙδτϦΛ࡞ $ mkdir github-actions-sampl e $ cd github-actions-sampl
e # ࢦఆͷσΟϨΫτϦΛ࡞ $ mkdir -p .github/workflow s # ϫʔΫϑϩʔΛ࡞ $ vi .github/workflows/learn-github-actions.ym l # pushͯ͠ActionsΛ֬ೝ͢Δ $ git ini t $ git add . $ git commit -m "Initial commit " $ git remote add origin [ϦϙδτϦurl ] $ git push -u origin main name: learn-github-actions on: [push ] jobs : check-bats-version : runs-on: ubuntu-latest steps : - uses: actions/checkout@v2 - uses: actions/setup-node@v1 - run: npm install -g bats - run: bats -v
·ͱΊ
·ͱΊ 29 GitHub Actionsͱʁ • ϦϙδτϦͱ࿈ܞͯ͠ɺϏϧυɾςετɾσϓϩΠͳͲͦͷଞ༷ʑͳ ϓϩηεΛࣗಈԽͤ͞ΔCI/CDͷαʔϏε • όϒϦοΫϦϙδτϦແྉɺϓϥΠϕʔτϦϙδτϦҰ෦ແྉͰ ༻Մೳ
• YAMLܗࣜͷϫʔΫϑϩʔΛ࡞͢Δ͚ͩͰ࣮ߦՄೳ
Thank you! yukimasa @yyykms123