Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Renovateで実現するライブラリの自動更新生活 / Automated Library U...

Sho Ikeda
September 03, 2023

Renovateで実現するライブラリの自動更新生活 / Automated Library Updates with Renovate

Sho Ikeda

September 03, 2023
Tweet

More Decks by Sho Ikeda

Other Decks in Programming

Transcript

  1. @ikesyo / Sho Ikeda • ͍͚͠ΐʔʗ஑ా ᠳ • גࣜձࣾ͸ͯͳ γχΞΤϯδχΞʢژ౎ʣ

    • ϚϯΨΞϓϦνʔϜ • iOS (SwiftUI), Android (Jetpack Compose) • CI/CD (CircleCI, GitHub Actions, etc.) • RenovateίϯτϦϏϡʔλʔ • Valuable contributions • ௚ۙͰ͸Perlͷ cpanfile ରԠΛ࣮૷͠·ͨ͠ • @ikesyo • @ikesyo
  2. աڈͷ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
  3. Renovate • https://github.com/renovatebot/renovateͰ։ൃ͞Ε͍ͯΔOSS • ϥΠηϯε͸AGPL • ఏڙܗଶ • SaaS (GitHub

    App) • npmύοέʔδ • DockerΠϝʔδ • ηϧϑϗεςΟϯά൛ • https://www.mend.io/free-developer-tools/renovate/on-premises/
  4. 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/
  5. Why Renovate • άϧʔϐϯάػೳ • Gradle΍npmͰ1ͭͷϥΠϒϥϦ͕ෳ਺ͷϞδϡʔϧɾύοέʔδʹ ෼ׂ͞Ε͍ͯΔ࣌ʹɺ1ͭͣͭPRΛ࡞Βͣʹ·ͱΊͯߋ৽͢Δ͜ͱ͕ Մೳ • iOSͰ΋PodfileͰRxSwift΍RxRelay,

    RxCocoaͷߋ৽Λ1ͭͷPRʹ· ͱΊͨΓ • Dependabot΋࠷ۙʢ΍ͬͱʣରԠ͠·ͨ͠Ͷ: Grouped version updates for Dependabot are generally available - The GitHub Blog
  6. Why Renovate • ඇৗʹॊೈͳઃఆ߲໨ • https://docs.renovatebot.com/configuration-options/ • ઃఆͷϓϦηοτΛ࡞ͬͯͦΕΛڞ༗ͨ͠Γ֦ு͢Δ͜ͱ΋Ͱ ͖Δ •

    ͸ͯͳͰ࢖༻͍ͯ͠ΔRenovateͷઃఆϓϦηοτΛެ։͠· ͨ͠ - Hatena Developer Blog • https://github.com/hatena/renovate-config
  7. 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
  8. 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: ... # ίϛοτˍϓογϡ͢Δ
  9. 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. • ૊ΈࠐΈͰ͸ରԠ͍ͯ͠ͳ͍΋ͷͰ΋ɺਖ਼نදݱͰର৅ͷϥΠ ϒϥϦ໊΍όʔδϣϯΛൈ͖ग़͠ɺࢦఆͨ͠σʔλιʔε͔Β ֘౰ͷϥΠϒϥϦͷߋ৽ΛνΣοΫͰ͖Δ • ਖ਼نදݱͰൈ͖ग़ͤͳ͍߲໨͕͋Δ৔߹͸௚઀ࢦఆ΋Ͱ͖Δ
  10. 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}
  11. regex manager - Dockerfileͷྫ renovate.json: { "regexManagers": [ { "fileMatch":

    ["^Dockerfile$"], "matchStrings": ["ENV YARN_VERSION=(?<currentValue>.*?)\\n"], "depNameTemplate": "yarn", "datasourceTemplate": "npm" } ] }
  12. regex manager - XcodeGen renovate.json: { "regexManagers": [ { "fileMatch":

    ["^project.yml$"], "matchStrings": [ "github: (?<depName>.*?)\\s*version: ['\"]?(?<currentValue>[^'\"]+?)['\"]?\\s" ], "datasourceTemplate": "github-releases", "extractVersionTemplate": "^v?(?<version>.*)$" } ] }
  13. regex manager - Carthage renovate.json: { "regexManagers": [ { "fileMatch":

    ["^Cartfile(\\.(private|resolved))?$"], "matchStrings": ["github\\s\\"(?<depName>.*?)\\"\\s[\"~>=\\s]+(?<currentValue>[a-zA-Z0-9.]+)"], "datasourceTemplate": "github-tags" } ] }
  14. ·ͱΊ • Renovate͸ϥΠϒϥϦߋ৽Λࣗಈతʹݕ஌ͯ͠PRΛ࡞੒ͯ͘͠ΕΔ • ରԠݴޠʢύοέʔδϚωʔδϟʔɾσʔλιʔεʣ͕ඇৗʹଟ͍ • iOSͰ΋AndroidͰ΋ʢFlutter/DartͰ΋ʣ࢖͑Δ • άϧʔϐϯά͕ศར •

    ඇৗʹॊೈͳઃఆ߲໨ • ϓϦηοτͷڞ༗΍֦ு΋ʢνʔϜ΍ࣾ಺ͰઃఆΛҭͯΒΕΔʣ • regex managerͱ͍͏ඇৗʹڧྗͳػೳʢΤεέʔϓϋονʣ
  15. ࢀߟ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
  16. ීஈ͸ϚϯΨΞϓϦΛ࡞͍ͬͯ·͢ • νʔϜϝϯόʔͷΞ΢τϓοτ • ϚϯΨϏϡʔϫGigaViewer for AppsͰJetpack ComposeΛશ໘࠾༻ͯ͠Έͨ - Hatena

    Developer Blog • GigaViewer for AppsͰ࢖͍ͬͯΔศརSwiftUIίϯϙʔωϯτ̑࿈ൃʂ - Hatena Developer Blog