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
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
meil
December 03, 2020
Programming
210
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
クラシルの開発で使ってるGitHub Actions
https://bethesun.connpass.com/event/195125/
meil
December 03, 2020
More Decks by meil
See All by meil
プログラミング言語(?)を自作した話
meilcli
0
890
GitHub ActionsのActionを作る
meilcli
0
440
GitHub Actions入門
meilcli
0
460
Azure Pipelinesのすゝめ
meilcli
0
330
Other Decks in Programming
See All in Programming
AI 輔助遺留系統現代化的經驗分享
jame2408
1
1.1k
LLM本来の能力を解き放つサンドボックス技術とAI民主化への適用
yukukotani
3
4.7k
The ROI of Quarkus for Spring Boot Applications
hollycummins
0
150
才能?センス?知らん、 続けたもん勝ちだ。-- 結婚・出産・癌を越えてなお、私がプロダクトを創り続ける理由
16bitidol
2
620
エンジニア向け会社紹介/Findy Company Profile
findyinc
6
360k
Strategic Design in the Frontend: Moduliths & Micro Frontends @DDDEurope
manfredsteyer
PRO
0
140
TSKaigi Night Talks 2026_TypeScriptでサプライチェーンの整合性を型に閉じ込める
geekplus_tech
0
420
LaravelLive Japan の裏方のすべて — 第188回 PHP勉強会@東京 (2026-06-24)
suguruooki
2
140
Even G2とAWSで推しのエージェントを召喚しよう!
har1101
1
140
Oxcを導入して開発体験が向上した話
yug1224
4
370
キャリア迷子上等 ─ "ない道"は自分で作ればいい
16bitidol
3
2.7k
ランチタイムLT会3周年!ランチタイムLT会を3年間続けられたお話
y0hgi
1
120
Featured
See All Featured
Bash Introduction
62gerente
615
220k
Keith and Marios Guide to Fast Websites
keithpitt
413
23k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
333
23k
Become a Pro
speakerdeck
PRO
31
6k
Unlocking the hidden potential of vector embeddings in international SEO
frankvandijk
0
860
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
162
16k
Joys of Absence: A Defence of Solitary Play
codingconduct
1
410
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
659
62k
Test your architecture with Archunit
thirion
1
2.3k
YesSQL, Process and Tooling at Scale
rocio
174
15k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
234
17k
The Invisible Side of Design
smashingmag
301
52k
Transcript
クラシルの開発で使ってる GitHub Actions クラシル Tech Talk #3
自己紹介 • Twitter: @penguin_sharp • GitHub: MeilCli • Speaker Deck:
MeilCli ← 今日のスライドはこのアカウントで公開します • Skill: C#, Kotlin, Android, Azure Pipelines, GitHub Actions • Career: ◦ 新卒で入社した会社で Android・Xamarin.Androidアプリ開発を行う ◦ 2020/2にdelyに入社しクラシル、特にチラシ機能の開発に関わる
まえがき クラシルではCI/CDにさまざまなサービスを使ってます AWS CodeBuild, Bitrise, GitHub Actions
まえがき ぶっちゃけると主にAWS CodeBuild使ってます
まえがき 今回はMeilCliが今までに社内のCodeBuild派に抗って 導入してきたGitHub Actionsを紹介します
GitHub Actionsのなにがいいのか • OSSに優しい料金設計 • Windows, macOS, Linux環境 • MS資本
• RunnerがC#製 ◦ https://github.com/actions/runner https://github.com/features/actions
GitHub Actionsのなにがいいのか いろいろいいところあるけど やっぱりGitHubと親和性が高いのがいい CI/CDするだけならAzure Pipelinesで十分ですし…
GitHub Actionsを軽くおさらい GitHub RepositoryのTopにあるここからActionsをクリック
GitHub Actionsを軽くおさらい 最初はRepositoryから推測されたおすすめのWorkflowがサジェストされるので問題なさ そうならそれを活用する
GitHub Actionsを軽くおさらい Workflowの見かた • on: Workflowをトリガーするイベント定義 • jobs: 実行単位(Job)を定義 •
build: buildという名前のJobを定義 • steps: Jobで何をするかを定義 ポイント • stepsでActionやシェルを使い処理を連結
細かい所を説明すると時間が足りないの で何を使えば何ができるかを紹介します
PullRequestのマイルストーンチェック やりたいこと: PullRequestにマイルストーンを付ける運用にしているので忘れないようにしたい アプローチ: PullRequestにマイルストーンが付いていなかったらコメントする
PullRequestのマイルストーンチェック 解決策: octokit/request-actionを使ってGitHubのAPIを叩く jobs: check: runs-on: ubuntu-latest steps: - uses:
octokit/
[email protected]
if: # ここでWebhook Payload の値などを確認すれば良い with: route: POST /repos/:repository/pulls/:pull_number/reviews repository : ${{ github.repository }} pull_number : ${{ github.event.pull_request.number }} body: "PullRequest comment" env: GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
PullRequestのマイルストーンチェック 詳細なサンプルはこちらに公開しています https://github.com/MeilCli/actions/blob/master/.github/workflows/check-has-milestone.yml
ファイル生成の自動化 やりたいこと: ツールで自動生成するファイルの生成をCIで自動化したい アプローチ: CIでファイルを自動生成し、差分があればPullRequestを作成する
ファイル生成の自動化 解決策: peter-evans/create-pull-requestを使う jobs: check: runs-on: ubuntu-latest steps: - run:
echo "example" > message.txt - uses: peter-evans/create-pull-request@v3 with: commit-message : 'commit message' title: 'PR title' assignees : 'MeilCli' reviewers : 'MeilCli'
Slackへ通知 やりたいこと: CIのエラー通知や定期実行結果をSlackで見たい アプローチ: Slack Incoming Webhooksを使う ref: https://api.slack.com/messaging/webhooks
Slackへ通知 解決策: 8398a7/action-slackを使う & Webhook URLをGitHub ActionsのSecretに登録 jobs: notification :
runs-on: ubuntu-latest steps: - uses: 8398a7/action-slack@v3 with: status: custom custom_payload : | { text: 'Message from GitHub Actions' } env: SLACK_WEBHOOK_URL : ${{ secrets.SLACK_WEBHOOK_URL }}
GitHub Actionsの高速化 やりたいこと: ビルドに時間がかかるので早くしたい アプローチ: 依存物やビルド結果などをキャッシュする
GitHub Actionsの高速化 解決策: actions/cacheを使う jobs: build: runs-on: ubuntu-latest steps: -
uses: actions/checkout@v2 - uses: actions/setup-java@v1 with: java-version : 1.8 - uses: actions/cache@v2 with: path: ~/.gradle/caches key: ${{ runner.os }}-gradle-${{ hashFiles('build.gradle') }} restore-keys : | ${{ runner.os }}-gradle- - run: chmod +x gradlew - run: ./gradlew build
まとめ • クラシルでは以下のActionなどを活用しています ◦ octokit/request-action ◦ peter-evans/create-pull-request ◦ 8398a7/action-slack ◦
actions/cache • GitHub Marketplaceで良さげなActionを探すといいです • Actionがなければ自作することもできます