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
Android の CI(GitHub Actions)の改善で、最近やったこと
Search
Hiroyuki Kusu
March 07, 2023
Technology
0
540
Android の CI(GitHub Actions)の改善で、最近やったこと
YUMEMI.grow Mobile #1 (
https://yumemi.connpass.com/event/272491/
) の資料
Hiroyuki Kusu
March 07, 2023
Tweet
Share
More Decks by Hiroyuki Kusu
See All by Hiroyuki Kusu
モノレポのプルリクエストに最近、導入したもの
hkusu
2
400
GitHub composite actions
hkusu
2
270
Android の静的解析における SARIF ファイルの活用
hkusu
0
4.1k
CI_でライブラリのバージョンの変化をレポートする.pdf
hkusu
0
280
Maestro を GitHub Actions で動かす 〜Android編〜
hkusu
0
1.2k
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
Platform Engineering for Software Developers and Architects
syntasso
1
510
VideoMamba: State Space Model for Efficient Video Understanding
chou500
0
190
Security-JAWS【第35回】勉強会クラウドにおけるマルウェアやコンテンツ改ざんへの対策
4su_para
0
170
エンジニア人生の拡張性を高める 「探索型キャリア設計」の提案
tenshoku_draft
1
120
インフラとバックエンドとフロントエンドをくまなく調べて遅いアプリを早くした件
tubone24
1
430
TypeScript、上達の瞬間
sadnessojisan
46
13k
Incident Response Practices: Waroom's Features and Future Challenges
rrreeeyyy
0
160
AWS Lambda のトラブルシュートをしていて思うこと
kazzpapa3
2
170
開発生産性を上げながらビジネスも30倍成長させてきたチームの姿
kamina_zzz
2
1.7k
初心者向けAWS Securityの勉強会mini Security-JAWSを9ヶ月ぐらい実施してきての近況
cmusudakeisuke
0
120
テストコード品質を高めるためにMutation Testingライブラリ・Strykerを実戦導入してみた話
ysknsid25
7
2.6k
Taming you application's environments
salaboy
0
180
Featured
See All Featured
Scaling GitHub
holman
458
140k
Code Reviewing Like a Champion
maltzj
520
39k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
44
6.8k
Building Adaptive Systems
keathley
38
2.3k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
33
1.9k
How To Stay Up To Date on Web Technology
chriscoyier
788
250k
Ruby is Unlike a Banana
tanoku
97
11k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
229
52k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
27
840
Unsuck your backbone
ammeep
668
57k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
6
410
KATA
mclloyd
29
14k
Transcript
Android ͷ CIʢGitHub Actionsʣ ͷվળͰɺ࠷ۙͬͨ͜ͱ 2023.3.7 YUMEMI.grow Mobile #1 Hiroyuki
Kusu ( @hkusu_ )
About me
1. ϓϧϦΫΤετʹΞϓϦΠϯετʔϧ༻ ͷ QR ίʔυΛίϝϯτ
https://github.com/marketplace/actions/s3-upload-action
- uses: actions/checkout@v 3 - uses: actions/setup-java@v 2 with
: java-version: 1 1 distribution: 'zulu ' - run: ./gradlew assembleDebu g - uses: hkusu/s3-upload-action@v 2 id: uploa d with : aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID } } aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY } } aws-region: 'ap-northeast-1 ' aws-bucket: ${{ secrets.AWS_BUCKET } } file-path: './app/build/outputs/apk/debug/app-debug.apk ' output-file-url: 'true ' content-type: 'application/vnd.android.package-archive ' output-qr-url: ‘true ' public: 'true ' - ... ͋ͱϚʔΫμϯܗࣜͷը૾ϦϯΫ ![QR](${{ steps.upload.outputs.qr-url }}) Λίϝϯτ͢ΕOK ※ ͋Β͔͡Ί Amazon S3 ͷ bucket Λͻͱͭ༻ҙ͓ͯ͘͠ඞཁ͕͋Γ·͢ apkϑΝΠϧμϯϩʔυ༻ͷHTTPϨεϙϯεϔομ
• ϨϏϡΞʔ͕खݩͷ࣮ػͰଈ࠲ʹಈ࡞ΛݟΔ͜ͱ͕Ͱ͖Δ • खݩͰίʔυΛνΣοΫΞτͯ͠Ϗϧυ͢Δख͕ؒͳ͍ • Slack ϝʔϧͰͷ URL ͷ௨ͱҧ͍ɺͲͷϓϧϦΫΤετͷͲͷίϛοτ
ʹରͯ͠Ϗϧυ͞ΕͨΞϓϦͳͷ͔͔Γ͍͢ • ͨͩ public ͳ URL Ͱ͋ΔͷͰར༻γʔϯʹ͍ͭͯҙ • ར༻͢Δ߹Ͱ URL ʹ༗ޮظݶઃ͚͓͍ͯͨํ͕Α͍ • S3 ͷϥΠϑαΠΫϧͷઃఆͰɺҰఆظؒͰ apk ϑΝΠϧΛࣗಈআ • ·ͨ S3 ͷ Presigned URL Λར༻ʢ͜ͷ Action ͷΦϓγϣϯͰར༻Մʣ • ༗ޮظݶ͕ΕͯϫʔΫϑϩʔΛ࠶࣮ߦ͢Ε QR ίʔυ࠶ੜ͞ΕΔ
2. larger runners ͷར༻
• runner Λز͔ͭ࡞ͬͯ group ʹͿΒԼ͛Δ • ୯ମͷ runner εέʔϧ͢Δ͕ɺ͍·ݱࡏ
εέʔϧʹ͕͔͔࣌ؒΔҝɺrunner Λͨ ͘͞Μ࡞Δ͜ͱͰෳϫʔΫϑϩʔɾδϣϒ ͔Βͷಉ࣌ར༻ʹඋ͑Δ
jobs : hoge : env : GRADLE_OPTS: ‘-Dorg.gradle.parallel=true -Dorg.gradle.jvmargs=-Xmx5120m
' runs-on : group: android-ci-ubuntu-22.0 4 steps : ... ࡞ͨ͠άϧʔϓΛࢦఆ • ڥม GRADLE_OPTS Ͱ Gradle ͷΦϓγϣϯΛࢦఆ • ΦϓγϣϯϓϩδΣΫτͷ Gradle ϑΝΠϧͰఆٛͯ͠Α͍͕ɺϩʔΧϧ։ൃͱ CI Ͱ͚ͨํ͕Αͦ͞͏ͳͷͰɺ͜ͷΑ͏ʹڥมͰࢦఆ͢Δͷ͕ศར • parallel ʹ͢Δ͜ͱͰɺlarger runners ͷ CPU ίΞΛ࠷େݶɺ׆༻ͤ͞Δ • larger runners ϝϞϦଟ͘ੵΜͰ͍ΔͷͰɺ5G Λࢦఆʢͬͱଟͯ͘Α͍͔ʣ
• ࠓճͷྫͰ 8 core ͷ runner Λར༻͍ͯ͠Δ͕ 4 core
Ͱे͔͠Ε ͳ͍ʢ࠷େ 64 coreʣ • larger runers core ʹൺྫͨ͠՝ֹۚͱͳΔ͕ɺେͷ Gradle λεΫ core Λ 2 ഒʹ͔ͨ͠Βͱ͍͕ͬͯ 1/2 ʹͳΔ༁Ͱͳ͍ • ίεύͱ͍͏ҙຯͰΑ͘ͳ͍ • ྫ͑ϓϧϦΫ࣌ͷϫʔΫϑϩʔͳͲɺΛ༏ઌ͍ͨ͠߹ͷΈར༻ ͢Δͷ͕Αͦ͞͏ • larger runners ແྉͷର֎ͳͷͰҙ
3. GradleϏϧυΩϟογϡͷར༻
jobs : hoge : env : GRADLE_OPTS: ‘-Dorg.gradle.daemon=false -Dorg.gradle.caching=true
' runs-on: ubuntu-22.0 4 steps : - uses: actions/checkout@v 3 - uses: actions/setup-java@v 2 with : java-version: 1 1 distribution: 'zulu ' - uses: actions/cache@v 3 with : path: | ~/.gradle/cache s ~/.gradle/wrappe r ~/.android/build-cach e key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle- wrapper.properties', '**/buildSrc/**/*.kt', '**/libs.versions.toml') } } restore-keys: ${{ runner.os }}-gradle - - ... Gradle ͷϏϧυΩϟογϡΛ༗ޮԽ actions/caches Λར༻͢ΔࡍσʔϞϯΛແޮԽ͓ͯ͘͜͠ͱ ͍ͭͰʹ Android ͷϏϧυΩϟογϡར༻ Gradle ͷϏϧυΩϟογϡґଘϥΠϒϥϦͷΩϟογϡͱڞʹ ͜ͷσΟϨΫτϦԼʹؚ·ΕΔ
• CI ͰޮՌΛಘΔͷ͍͠ʁฐࣾͰେ͖ͳޮՌײ͡ΒΕͳ͔ͬͨ • ಉ͡ίʔυ͔ͭಉ͡ Gradle λεΫΛ୯७ʹ࠶࣮ߦ͢Δ໘Ͱ͔ͨ͠ʹ͍ • ͨͩ
CI ͰΩϟογϡͨ࣌͠ͱར༻͢Δ࣌Ͱίʔυ͕มԽ͍ͯ͠Δ͜ͱ͕ຆͲ • ࣮ߦ͍ͨ͠ Gradle λεΫຖ·ͨશ෦ೖΓͷΩϟογϡΛ༻ҙ͓ͯ͘͠ͷ͕͍͠ • GitHub ͰΩϟογϡτʔλϧ 10 G ·Ͱͱ͍͏੍ݶ͋Δ • ϩʔΧϧ։ൃ࣌ͱҧ͍ɺ։ൃͰੵΈ্͕ͬͨΩϟογϡ͕ར༻Ͱ͖Δ༁Ͱͳ͍ • ͱ͍͑େ͖ͳσϝϦοτແ͍ͷͰɺؾ࣋ͪఔʹಋೖ͓͍ͯͯ͠Αͦ͞͏ • σϝϦοτΩϟογϡαΠζ͕গ͠େ͖͘ͳΔ͙Β͍ʁ • Ұճͷ Gradle λεΫͰ͋ͬͯɺλεΫ࣮ߦதͷՌͷ࠶ར༻͕ߦΘΕΔ
4. ࣦഊͨ͠ςετίʔυʹίϝϯτ͢Δ
https://speakerdeck.com/hkusu/github-actions-deyunitutotesutofalsejie-guo-worepotosuru
5. ϫʔΫϑϩʔͷڞ௨Խ
https://speakerdeck.com/hkusu/custom-github-actions-wozuo-tute-organization-nei-degong-you-suru
Thank you ! @hkusu_ ฐࣾ Android ΤϯδχΞΛ ઈࢍืूத Ͱ͢ʂ