Share
Embed
Renovateで実現するライブラリの自動更新生活 / Automated Library Updates with Renovate
「iOSDC Japan 2023」での発表資料です #iosdc
- https://iosdc.jp/2023/
- https://fortee.jp/iosdc-japan-2023/proposal/8cd5ec9b-7131-458f-921a-9b918298d768
Sho Ikeda
September 03, 2023
Transcript
29 slides
-
RenovateͰ࣮ݱ͢Δ ϥΠϒϥϦͷ ࣗಈߋ৽ੜ׆ @ikesyo / Sho Ikeda iOSDC Japan 2023
2023-09-03 Sun #iosdc -
@ikesyo / Sho Ikeda • ͍͚͠ΐʔʗా ᠳ • גࣜձࣾͯͳ γχΞΤϯδχΞʢژʣ
• ϚϯΨΞϓϦνʔϜ • iOS (SwiftUI), Android (Jetpack Compose) • CI/CD (CircleCI, GitHub Actions, etc.) • RenovateίϯτϦϏϡʔλʔ • Valuable contributions • ۙͰPerlͷ cpanfile ରԠΛ࣮͠·ͨ͠ • @ikesyo • @ikesyo -
աڈͷiOSDC JapanͰͷొஃ 4ৼΓͰ͢ • 5ͰΘ͔ΔʂXcode 11͔Β͑ΔXCFrameworks by Sho Ikedaʢ͍͚ ͠ΐʔʣ
| τʔΫ | iOSDC Japan 2019 #iosdc - fortee.jp • The latest info of Carthage by Sho IKEDA | τʔΫ | iOSDC Japan 2018 #iosdc - fortee.jp • The latest info of ReactiveSwift and ReactiveCocoa | iOSDC Japan 2017 • ίϛολʔ͕ޠΔʂReactiveCocoa 5.0 | iOSDC Japan 2016 -
Renovate • https://github.com/renovatebot/renovateͰ։ൃ͞Ε͍ͯΔOSS • ϥΠηϯεAGPL • ఏڙܗଶ • SaaS (GitHub
App) • npmύοέʔδ • DockerΠϝʔδ • ηϧϑϗεςΟϯά൛ • https://www.mend.io/free-developer-tools/renovate/on-premises/ -
Why Renovate • ϥΠϒϥϦߋ৽Λࣗಈతʹݕͯ͠PRΛ࡞ͯ͘͠ΕΔ • ࣗͰߋ৽Λ୳͠ʹߦ͘ඞཁ͕ͳ͘ͳΔ • ʢऔಘͰ͖ΔൣғͰʣϦϦʔεϊʔτɾChangelogࡌͤͯ͘ΕΔ • ʢCI/ࣗಈςετ͕͋Εʣߋ৽ʹΑΔਖ਼ৗಈ࡞ίϯύΠϧΤ
ϥʔΛ֬ೝ͍͢͠ • όάमਖ਼ػೳՃΛ͔ʹऔΓೖΕΔ͜ͱ͕Ͱ͖Δ • → OSΞοϓσʔτʹै͘͢͠ͳΔ -
Why Renovate • iOSࢹ: CocoaPodsʢPodfileʣSwiftPMʢPackage.swiftʣʹରԠ͍ͯ͠ Δ • Dependabot࠷ۙSwiftPMʹରԠ͠·ͨ͠Ͷ: Swift Support
for Dependabot Updates - The GitHub Blog • Gradleʢbuild.gradle, Version CatalogʣʹରԠ͍ͯ͠ΔͷͰAndroidͰ ͑Δ • ʲॏཁʳతʹରԠ͍ͯ͠ͳ͍πʔϧɾϑΝΠϧͰਖ਼نදݱͰରԠ͕Մೳ • regex manager: https://docs.renovatebot.com/modules/manager/regex/ -
Why Renovate • άϧʔϐϯάػೳ • GradlenpmͰ1ͭͷϥΠϒϥϦ͕ෳͷϞδϡʔϧɾύοέʔδʹ ׂ͞Ε͍ͯΔ࣌ʹɺ1ͭͣͭPRΛ࡞Βͣʹ·ͱΊͯߋ৽͢Δ͜ͱ͕ Մೳ • iOSͰPodfileͰRxSwiftRxRelay,
RxCocoaͷߋ৽Λ1ͭͷPRʹ· ͱΊͨΓ • Dependabot࠷ۙʢͬͱʣରԠ͠·ͨ͠Ͷ: Grouped version updates for Dependabot are generally available - The GitHub Blog -
Why Renovate • ඇৗʹॊೈͳઃఆ߲ • https://docs.renovatebot.com/configuration-options/ • ઃఆͷϓϦηοτΛ࡞ͬͯͦΕΛڞ༗ͨ͠Γ֦ு͢Δ͜ͱͰ ͖Δ •
ͯͳͰ༻͍ͯ͠ΔRenovateͷઃఆϓϦηοτΛެ։͠· ͨ͠ - Hatena Developer Blog • https://github.com/hatena/renovate-config -
iOS։ൃͰͷRenovate πʔϧ ରԠঢ়گ උߟ CocoaPods ⭕ " Realm͕͋ΔͱNG1 XcodeGenͱซ༻͍ͯ͠ΔͱNG1 SwiftPM
# $ Package.resolvedͷߋ৽ͱɺXcode͔Β Swift PackageΛՃ͢Δ߹ʹඇରԠ2 XcodeGen (Swift Package) ❌ & regex managerΛ͏ Carthage ❌ & regex managerΛ͏ 2 https://github.com/renovatebot/renovate/issues/6924, https://github.com/renovatebot/renovate/issues/9735 1 https://ikesyo.hatenablog.com/entry/potatotips-77-renovate-for-ios -
update-package-resolved.yml: on: pull_request: paths: - Package.swift jobs: preupdate: runs-on: ubuntu-latest
outputs: files_changed: ${{ steps.file_changes.outputs.files }} steps: - uses: actions/checkout@v3 - id: file_changes uses: trilom/[email protected] update: runs-on: macos-latest needs: preupdate if: contains(fromJson(needs.preupdate.outputs.files_changed), 'Package.resolved') == false steps: - run: swift package resolve # `Package.resolved` Λߋ৽ͯ͠ - run: ... # ίϛοτˍϓογϡ͢Δ -
regex manager The regex manager is designed to allow users
to manually configure Renovate for how to find dependencies that aren't detected by the built-in package managers. • ΈࠐΈͰରԠ͍ͯ͠ͳ͍ͷͰɺਖ਼نදݱͰରͷϥΠ ϒϥϦ໊όʔδϣϯΛൈ͖ग़͠ɺࢦఆͨ͠σʔλιʔε͔Β ֘ͷϥΠϒϥϦͷߋ৽ΛνΣοΫͰ͖Δ • ਖ਼نදݱͰൈ͖ग़ͤͳ͍߲͕͋Δ߹ࢦఆͰ͖Δ -
regex manager - Dockerfileͷྫ Dockerfile: FROM node:12 ENV YARN_VERSION=1.19.1 RUN
curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version ${YARN_VERSION} -
regex manager - Dockerfileͷྫ renovate.json: { "regexManagers": [ { "fileMatch":
["^Dockerfile$"], "matchStrings": ["ENV YARN_VERSION=(?<currentValue>.*?)\\n"], "depNameTemplate": "yarn", "datasourceTemplate": "npm" } ] } -
regex manager - XcodeGen project.yml: packages: Quick: github: Quick/Quick version:
7.2.0 Nimble: github: Quick/Nimble version: 12.2.0 -
regex manager - XcodeGen renovate.json: { "regexManagers": [ { "fileMatch":
["^project.yml$"], "matchStrings": [ "github: (?<depName>.*?)\\s*version: ['\"]?(?<currentValue>[^'\"]+?)['\"]?\\s" ], "datasourceTemplate": "github-releases", "extractVersionTemplate": "^v?(?<version>.*)$" } ] } -
regex manager - Carthage renovate.json: { "regexManagers": [ { "fileMatch":
["^Cartfile(\\.(private|resolved))?$"], "matchStrings": ["github\\s\\"(?<depName>.*?)\\"\\s[\"~>=\\s]+(?<currentValue>[a-zA-Z0-9.]+)"], "datasourceTemplate": "github-tags" } ] } -
·ͱΊ • RenovateϥΠϒϥϦߋ৽Λࣗಈతʹݕͯ͠PRΛ࡞ͯ͘͠ΕΔ • ରԠݴޠʢύοέʔδϚωʔδϟʔɾσʔλιʔεʣ͕ඇৗʹଟ͍ • iOSͰAndroidͰʢFlutter/DartͰʣ͑Δ • άϧʔϐϯά͕ศར •
ඇৗʹॊೈͳઃఆ߲ • ϓϦηοτͷڞ༗֦ுʢνʔϜࣾͰઃఆΛҭͯΒΕΔʣ • regex managerͱ͍͏ඇৗʹڧྗͳػೳʢΤεέʔϓϋονʣ -
ࢀߟURL • https://www.mend.io/renovate/ • https://docs.renovatebot.com/configuration-options/ • https://docs.renovatebot.com/modules/manager/regex/ • ͯͳͰ༻͍ͯ͠ΔRenovateͷઃఆϓϦηοτΛެ։͠·ͨ͠ -
Hatena Developer Blog • RenovateΛiOSΞϓϦ։ൃʹಋೖͯ͠Έͨ - dely tech blog • Kyash iOSΞϓϦͷϥΠϒϥϦཧΛSwift Package ManagerશҠߦ͠·ͨ͠ - Kyash Product Blog • GitLab ͱ Renovate Ͱ iOS ͷϥΠϒϥϦΞοϓσʔτΛࣗಈԽ͢Δํ๏ (XcodeGen) - ΧΧ ΫίϜTechBlog -
ීஈϚϯΨΞϓϦΛ࡞͍ͬͯ·͢ • νʔϜϝϯόʔͷΞτϓοτ • ϚϯΨϏϡʔϫGigaViewer for AppsͰJetpack ComposeΛશ໘࠾༻ͯ͠Έͨ - Hatena
Developer Blog • GigaViewer for AppsͰ͍ͬͯΔศརSwiftUIίϯϙʔωϯτ̑࿈ൃʂ - Hatena Developer Blog