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
ずっと昔に Star をつけたはずの思い出せない GitHub リポジトリを見つけたい!
rokuosan
0
150
どちらを使う?GitHub or Azure DevOps Ver. 24H2
kkamegawa
0
750
Amazon VPC Lattice 最新アップデート紹介 - PrivateLink も似たようなアップデートあったけど違いとは
bigmuramura
0
190
Opcodeを読んでいたら何故かphp-srcを読んでいた話
murashotaro
0
230
Fanstaの1年を大解剖! 一人SREはどこまでできるのか!?
syossan27
2
170
[Ruby] Develop a Morse Code Learning Gem & Beep from Strings
oguressive
1
160
小学3年生夏休みの自由研究「夏休みに Copilot で遊んでみた」
taichinakamura
0
150
株式会社ログラス − エンジニア向け会社説明資料 / Loglass Comapany Deck for Engineer
loglass2019
3
32k
複雑性の高いオブジェクト編集に向き合う: プラガブルなReactフォーム設計
righttouch
PRO
0
110
LINEヤフーのフロントエンド組織・体制の紹介【24年12月】
lycorp_recruit_jp
0
530
10分で学ぶKubernetesコンテナセキュリティ/10min-k8s-container-sec
mochizuki875
3
330
5分でわかるDuckDB
chanyou0311
10
3.2k
Featured
See All Featured
The Cult of Friendly URLs
andyhume
78
6.1k
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
2
170
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
PRO
10
810
Understanding Cognitive Biases in Performance Measurement
bluesmoon
26
1.5k
The Power of CSS Pseudo Elements
geoffreycrofte
73
5.4k
Building Flexible Design Systems
yeseniaperezcruz
327
38k
We Have a Design System, Now What?
morganepeng
51
7.3k
Producing Creativity
orderedlist
PRO
341
39k
Gamification - CAS2011
davidbonilla
80
5.1k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
6
520
The MySQL Ecosystem @ GitHub 2015
samlambert
250
12k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
127
18k
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_ ͥͻօ͞ΜศརͳͷΛ࡞ͬͯڞ༗͍ͯͩ̇͘͠͞