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 composite actions
Search
Hiroyuki Kusu
March 13, 2024
Technology
2
290
GitHub composite actions
YUMEMI.grow Mobile #11 (
https://yumemi.connpass.com/event/311373/
) の資料
Hiroyuki Kusu
March 13, 2024
Tweet
Share
More Decks by Hiroyuki Kusu
See All by Hiroyuki Kusu
モノレポのプルリクエストに最近、導入したもの
hkusu
2
410
Android の静的解析における SARIF ファイルの活用
hkusu
0
4.6k
CI_でライブラリのバージョンの変化をレポートする.pdf
hkusu
0
290
Maestro を GitHub Actions で動かす 〜Android編〜
hkusu
0
1.2k
Android の CI(GitHub Actions)の改善で、最近やったこと
hkusu
0
550
Tauri Mobile で生成される Android のコードを見てみる
hkusu
0
1.3k
Custom GitHub Actions を作って Organization 内で共有する
hkusu
1
480
GitHub Actions でユニットテストの結果をレポートする
hkusu
0
3.2k
Android で Multiplatform Settings を使う
hkusu
0
900
Other Decks in Technology
See All in Technology
How to be an AWS Community Builder | 君もAWS Community Builderになろう!〜2024 冬 CB募集直前対策編?!〜
coosuke
PRO
2
2.8k
株式会社ログラス − エンジニア向け会社説明資料 / Loglass Comapany Deck for Engineer
loglass2019
3
31k
ゼロから創る横断SREチーム 挑戦と進化の軌跡
rvirus0817
2
260
GitHub Copilot のテクニック集/GitHub Copilot Techniques
rayuron
23
11k
非機能品質を作り込むための実践アーキテクチャ
knih
2
630
Snowflake女子会#3 Snowpipeの良さを5分で語るよ
lana2548
0
220
【re:Invent 2024 アプデ】 Prompt Routing の紹介
champ
0
140
watsonx.ai Dojo #5 ファインチューニングとInstructLAB
oniak3ibm
PRO
0
160
Turing × atmaCup #18 - 1st Place Solution
hakubishin3
0
470
プロダクト開発を加速させるためのQA文化の築き方 / How to build QA culture to accelerate product development
mii3king
1
250
20241214_WACATE2024冬_テスト設計技法をチョット俯瞰してみよう
kzsuzuki
3
440
なぜCodeceptJSを選んだか
goataka
0
150
Featured
See All Featured
Facilitating Awesome Meetings
lara
50
6.1k
Adopting Sorbet at Scale
ufuk
73
9.1k
The Language of Interfaces
destraynor
154
24k
Visualization
eitanlees
146
15k
The MySQL Ecosystem @ GitHub 2015
samlambert
250
12k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
17
2.2k
Statistics for Hackers
jakevdp
796
220k
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
2
160
How GitHub (no longer) Works
holman
311
140k
Become a Pro
speakerdeck
PRO
26
5k
A Modern Web Designer's Workflow
chriscoyier
693
190k
Making the Leap to Tech Lead
cromwellryan
133
9k
Transcript
GitHub composite actions 2024.3.13 YUMEMI.grow Mobile #11 Hiroyuki Kusu (
@hkusu_ )
About me
composite actions ?
composite actions ? • GitHub custom actions ͷ࡞Γํͷ1ͭ •
ଞʹ Docker container actions ͱ JavaScript actions ͕͋Δ • ෳͷ step Λ 1ͭͷ action ʹ·ͱΊΒΕΔ • ެ։͞Ε͍ͯΔطଘͷ action ར༻Ͱ͖Δ • ීஈ GitHub Actions ͷϫʔΫϑϩʔͷ YAML Λॻ͘ײ֮Ͱ࡞ΕΔ • ϩδοΫ෦ओʹ Shell script Ͱॻ͘͜ͱʹͳΔ • େ͖ͳػೳͷ։ൃʹ͔ͳͦ͏ uses: actions/setup-java@v4 custom actions ͷར༻ྫ
name: "Setup Java - Gradle" description: "A GitHub Action
that sets up a Java and Gradle environment." author: "YUMEMI Inc." branding: icon: "box" color: "blue" inputs: java-version: description: "Java version to use." required: false default: "17" // ... kotlin-compiler-report: description: "Whether to apply Kotlin compiler Problem Matchers." required: false default: "true" runs: using: "composite" steps: - name: Setup Java uses: actions/setup-java@v4 with: distribution: ${{ inputs.java-distribution }} java-version: ${{ inputs.java-version }} - name: Setup Gradle uses: gradle/actions/setup-gradle@v3 with: cache-disabled: ${{ inputs.cache-disabled }} cache-read-only: ${{ inputs.cache-read-only }} gradle-home-cache-cleanup: ${{ inputs.gradle-home-cache-cleanup }} add-job-summary: ${{ inputs.gradle-build-report }} - name: Setup Problem Matchers if: inputs.kotlin-compiler-report != 'false' uses: yumemi-inc/problem-matchers/kotlin-gradle@v1 composite action ͷதͷྫ https://github.com/yumemi-inc/setup-java-gradle action.yml ͱͯ͠ϦϙδτϦʹอଘ͢Ε ผϦϙδτϦͷϫʔΫϑϩʔ͔Β uses Ͱ ར༻Ͱ͖ΔʢಉҰϦϙδτϦͷϫʔΫϑ ϩʔ͔Βར༻͢ΔͷՄʣ
͜Ε·Ͱࢲ͕࡞ͨ͠ composite action
͜Ε·Ͱࢲ͕࡞ͨ͠ composite action • Ұൠެ։Ͱ͖Δͷࣾͷ public ϦϙδτϦʹஔ͍ͯ͋Δ • Խࢧԉͱ͍͏ۀͷੑ্࣭ɺࣾ֎ͷ
GitHub organization Ͱར༻ Ͱ͖ΔΑ͏ʹ • GitHub Marketplace Ͱެ։ • Marketplace Ͱެ։͠ͳͯ͘ར༻Ͱ͖Δ͕ɺͰ͖Δ͚ͩ෯͍ਓʹ ͬͯΒ͏ҝʹ • ୯७ʹ OSS తͳߩݙͷత • ͱ͍͑Ұൠެ։Ͱ͖ͳ͍ͷ͚ࣾͩͰ͏ͷ private ϦϙδτϦͰ
Gradle Dependency Diff Report https://github.com/yumemi-inc/gradle-dependency-diff-report
Gradle Dependency Diff Report • 1ͭͷϥΠϒϥϦͷόʔδϣϯΛม͑ͨΒҶͮΔࣜʹผͷϥΠϒϥϦͷόʔ δϣϯมΘͬͯ͠·͏ • Renovate
Dependabot લऀͷ1ͭͷϥΠϒϥϦͷ͜ͱҎ֎ڭ͑ͯ ͘Εͳ͍ • ͳͷͰϥΠϒϥϦͷґଘؔͷมԽΛ Job Summaries Ϩϙʔτ͢Δ action Λ࡞ͬͨ • ϨϏϡʔ࣌ʹ׆༻
Comment Pull Request https://github.com/yumemi-inc/comment-pull-request
Comment Pull Request • ϓϧϦΫίϝϯτΛߘ͢Δ action • աڈͷίϝϯτΛফͨ͠ΓӅͨ͠ΓͰ͖Δ •
ςετ݁ՌͷϨϙʔτߘͳͲɺ࠷ޙͷίϛοτʹର͢Δ CI ͷ݁ՌͷΈ ʹؔ৺͕͋ΔΑ͏ͳέʔεͰར༻
Changed Files https://github.com/yumemi-inc/changed- fi les
• ࢦఆͨ͠ύεύλʔϯͷϑΝΠϧ͕ϓϧϦΫҙͷίϛοτͷࠩʹؚ· ΕΔ͔ఆ͢Δ action • step ୯ҐͷॲཧͷذεΩοϓ͕ՄೳͱͳΔ • ಛʹϞϊϨϙɺϚϧνϓϥοτϑΥʔϜܥͷϦϙδτϦͰ༗༻ʁ
Changed Files
Path Filter https://github.com/yumemi-inc/path- fi lter
Path Filter • ઌఔͷ Changed Files ɺGitHub API Λར༻͍ͯ͠Δ͜ͱʹΑΔ੍͕
͋ͬͨʢREADME ʹͦͷࢫΛهࡌࡁΈʣͷͰɺগ͠ػೳΛল͖ͭͭ GitHub API Λར༻͠ͳ͍ํࣜͰ࣮ͨ͠͠ • ͍ͣΕল͍ͨػೳΛऔΓࠐΜͰɺ͜ͷ Path Filter ʹ̍ຊԽ͢Δ༧ఆ
Problem Matchers for Kotlin - Gradle https://github.com/yumemi-inc/problem-matchers
Problem Matchers for Kotlin - Gradle • Kotlin ίϯύΠϧ࣌ͷϫʔχϯά/ΤϥʔΛ
annotation ͱͯ͠ϓϧϦΫͷม ߋϑΝΠϧλϒͱ Job Summaries දࣔ • Kotlin 1.7 Ҏલͱ 1.8 Ҏ߱ͷ྆ϑΥʔϚοτʹରԠ • GitHub ͷ੍ʹΑΓɺannotation ͷʹݶΓ͕͋Δ
Setup Java - Gradle https://github.com/yumemi-inc/setup-java-gradle
Setup Java - Gradle • Gradle λεΫ࣮ߦલͷ֤छηοτΞοϓΛ 1 step Ͱॻ͚ΔΑ͏ʹͨ͠ͷ
• ෦Ͱ༻͍ͯ͠Δ gradle/gradle-build-action Λͦͷ··Կߟ͑ͣ͏ ͱσϑΥϧτϒϥϯνʹແҙຯʹΩϟογϡ͕େྔʹ࡞͞ΕͨΓɺٯʹϓ ϧϦΫͰΩϟογϡ͕Ұ hit ͠ͳ͔ͬͨΓ͢ΔͷͰɺΩϟγϡ࡞جຊ off ͷܗͰϥοϓ͠ɺREADME ͰΩϟγϡͷӡ༻ʹ͍ͭͯิͨ͠
ॴײ Tips ͳͲ
ॴײ Tips ͳͲ • σϑΥϧτͰར༻Ͱ͖Δ jq GitHub CLI ͕ศར
• GitHub CLI GraphQL ୟ͚Δ • Ҏલ؆୯ͳ custom action Ͱ JavaScriptʢJavaScript actionsʣͰ࡞ͬ ͍͕ͯͨɺఆظతʹ Node.js ͷόʔδϣϯ੬ऑੑͷ͋ΔϥΠϒϥϦͷߋ ৽͕ඞཁͩͬͨͷͰɺͦͷख͕ؒͳ͍ • ͨͩෳࡶͳͷΛ࡞Ζ͏ͱ͢Δͱ Shell script ྗ͕ΘΕΔ͔ʁ
JavaScript طଘͷ npm ͷύοέʔδΛ͍͍ͨ߹ • actions/github-script action Λར༻ͯ͠ JavaScript ͕ॻ͚Δ
• npm ͷύοέʔδΛར༻͢Δྫɺઌ΄Ͳհͨ͠ Path Filterʢyumemi- inc/path- fi lterʣͷίʔυதʹ͋Γ·͢ • @vercel/ncc Ͱόϯυϧͨ͠ͷΛ require() ͰಡΈࠐΜͰ͍Δ
̏ͭͷ runner OS ͷߟྀ • GitHub-hosted runner ͷ OS ̏ͭʢUbuntuɺmacOSɺWindowsʣ͋Δ
• Shell script Λ Bash Ͱॻ͘ݶΓɺಉ͡ॻ͖ํͰ͍͍ͩͨΑ͍͕ɺԼهͷ ҧ͍͕͋Δ͜ͱʹҙ • Windows OS ͷվߦίʔυ • OS ʹΑͬͯଘࡏ͠ͳ͍ɾڍಈ͕ҟͳΔίϚϯυ͕͋Δ • ։ൃ࣌ͷ CI Λ̏ͭͷ OS Ͱճ͢ͱΑ͍ • public ϦϙδτϦͳΒແྉͳͷͰ࣌ؒΛؾʹͤͣճͤΔ
Thank you ! @hkusu_ ͥͻօ͞ΜศརͳͷΛ࡞ͬͯڞ༗͍ͯͩ̇͘͠͞