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
270
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
スクラム成熟度セルフチェックツールを作って得た学びとその活用法
coincheck_recruit
1
140
Amazon CloudWatch Network Monitor のススメ
yuki_ink
1
200
Can We Measure Developer Productivity?
ewolff
1
150
100 名超が参加した日経グループ横断の競技型 AWS 学習イベント「Nikkei Group AWS GameDay」の紹介/mediajaws202411
nikkei_engineer_recruiting
1
170
Why App Signing Matters for Your Android Apps - Android Bangkok Conference 2024
akexorcist
0
120
20241120_JAWS_東京_ランチタイムLT#17_AWS認定全冠の先へ
tsumita
2
230
TypeScript、上達の瞬間
sadnessojisan
46
13k
元旅行会社の情シス部員が教えるおすすめなre:Inventへの行き方 / What is the most efficient way to re:Invent
naospon
2
330
ハイパーパラメータチューニングって何をしているの
toridori_dev
0
140
地理情報データをデータベースに格納しよう~ GPUを活用した爆速データベース PG-Stromの紹介 ~
sakaik
1
150
これまでの計測・開発・デプロイ方法全部見せます! / Findy ISUCON 2024-11-14
tohutohu
3
360
ドメインの本質を掴む / Get the essence of the domain
sinsoku
2
150
Featured
See All Featured
Designing for humans not robots
tammielis
250
25k
Bash Introduction
62gerente
608
210k
How STYLIGHT went responsive
nonsquared
95
5.2k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
27
4.3k
Rebuilding a faster, lazier Slack
samanthasiow
79
8.7k
Gamification - CAS2011
davidbonilla
80
5k
Making the Leap to Tech Lead
cromwellryan
133
8.9k
A Philosophy of Restraint
colly
203
16k
Designing Experiences People Love
moore
138
23k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
246
1.3M
Testing 201, or: Great Expectations
jmmastey
38
7.1k
For a Future-Friendly Web
brad_frost
175
9.4k
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_ ͥͻօ͞ΜศརͳͷΛ࡞ͬͯڞ༗͍ͯͩ̇͘͠͞