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
280
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
400
Android の静的解析における SARIF ファイルの活用
hkusu
0
4.1k
CI_でライブラリのバージョンの変化をレポートする.pdf
hkusu
0
280
Maestro を GitHub Actions で動かす 〜Android編〜
hkusu
0
1.2k
Android の CI(GitHub Actions)の改善で、最近やったこと
hkusu
0
540
Tauri Mobile で生成される Android のコードを見てみる
hkusu
0
1.2k
Custom GitHub Actions を作って Organization 内で共有する
hkusu
1
460
GitHub Actions でユニットテストの結果をレポートする
hkusu
0
3.2k
Android で Multiplatform Settings を使う
hkusu
0
880
Other Decks in Technology
See All in Technology
エンジニア人生の拡張性を高める 「探索型キャリア設計」の提案
tenshoku_draft
1
120
【Startup CTO of the Year 2024 / Audience Award】アセンド取締役CTO 丹羽健
niwatakeru
0
980
信頼性に挑む中で拡張できる・得られる1人のスキルセットとは?
ken5scal
2
530
リンクアンドモチベーション ソフトウェアエンジニア向け紹介資料 / Introduction to Link and Motivation for Software Engineers
lmi
4
300k
Terraform未経験の御様に対してどの ように導⼊を進めていったか
tkikuchi
2
430
B2B SaaSから見た最近のC#/.NETの進化
sansantech
PRO
0
750
第1回 国土交通省 データコンペ参加者向け勉強会③- Snowflake x estie編 -
estie
0
130
Introduction to Works of ML Engineer in LY Corporation
lycorp_recruit_jp
0
100
20241120_JAWS_東京_ランチタイムLT#17_AWS認定全冠の先へ
tsumita
2
250
AIチャットボット開発への生成AI活用
ryomrt
0
170
Shopifyアプリ開発における Shopifyの機能活用
sonatard
4
250
ExaDB-D dbaascli で出来ること
oracle4engineer
PRO
0
3.8k
Featured
See All Featured
How GitHub (no longer) Works
holman
310
140k
BBQ
matthewcrist
85
9.3k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
191
16k
Why You Should Never Use an ORM
jnunemaker
PRO
54
9.1k
It's Worth the Effort
3n
183
27k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
6
410
What's in a price? How to price your products and services
michaelherold
243
12k
A Philosophy of Restraint
colly
203
16k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
PRO
10
720
Adopting Sorbet at Scale
ufuk
73
9.1k
The Language of Interfaces
destraynor
154
24k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
27
840
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_ ͥͻօ͞ΜศརͳͷΛ࡞ͬͯڞ༗͍ͯͩ̇͘͠͞