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

RenovateによるiOSライブラリーの自動更新

 RenovateによるiOSライブラリーの自動更新

「potatotips #77 iOS/Android開発Tips共有会」での発表資料です #potatotips

https://potatotips.connpass.com/event/236238/

7ddcca09c00a2744b983974225447d19?s=128

Sho Ikeda

March 24, 2022
Tweet

More Decks by Sho Ikeda

Other Decks in Programming

Transcript

  1. RenovateʹΑΔ iOSϥΠϒϥϦʔͷ ࣗಈߋ৽ @ikesyo / Sho Ikeda potatotips #77 2022-03-24

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

    • ϚϯΨΞϓϦνʔϜ • iOS / Android / React Native • Swiftίϛολʔ • swift-corelibs-foundation • Quick/Nimbleͷϝϯςφʔ • https://twitter.com/ikesyo • https://github.com/ikesyo
  3. ੵۃ࠾༻தͰ͢ https://open.talentio.com/r/1/c/hatena/pages/28838

  4. RenovateʹΑΔ iOSϥΠϒϥϦʔͷ ࣗಈߋ৽

  5. Renovate • https://renovatebot.com/ • ෳ਺ͷύοέʔδϚωʔδϟʔʢ਺ेʂʣ΍ϓϥοτϑΥʔ ϜʢGitHub, GitLab, Bitbucket, etcʣʹରԠͨ͠ϥΠϒϥϦʔ ͷࣗಈߋ৽πʔϧʢແྉʣ

    • ಉछͷπʔϧʹ͸GitHubʹ౷߹͞ΕͨDependabotͳͲ΋͋ Γ·͢
  6. Why Renovate • iOSࢹ఺: CocoaPodsʢPodfileʣ΍SwiftPMʢPackage.swiftʣʹରԠ ͍ͯ͠Δ • Gradleʢbuild.gradle, Version CatalogʣʹରԠ͍ͯ͠ΔͷͰ

    AndroidͰ΋࢖͑Δ • ௚઀తʹରԠ͍ͯ͠ͳ͍πʔϧɾϑΝΠϧͰ΋ਖ਼نදݱͰରԠ͕Մೳ ʢॏཁʣ • regex manager: https://docs.renovatebot.com/modules/manager/ regex/
  7. Why Renovate • άϧʔϐϯάػೳ • Gradle΍npmͰ1ͭͷϥΠϒϥϦ͕ෳ਺ͷϞδϡʔϧɾ ύοέʔδʹ෼ׂ͞Ε͍ͯΔ࣌ʹɺ1ͭͣͭPRΛ࡞Βͣʹ ·ͱΊͯߋ৽͢Δ͜ͱ͕Մೳ • iOSͰ΋PodfileͰRxSwift΍RxRelay,

    RxCocoaͷߋ৽Λ1 ͭͷPRʹ·ͱΊͨΓ
  8. None
  9. Why Renovate • ඇৗʹॊೈͳઃఆ߲໨ • https://docs.renovatebot.com/configuration-options/ • ઃఆͷϓϦηοτΛ࡞ͬͯͦΕΛڞ༗ͨ͠Γ֦ு͢Δ͜ͱ ΋Ͱ͖Δ •

    ͸ͯͳͰ࢖༻͍ͯ͠ΔRenovateͷઃఆϓϦηοτΛެ։͠ ·ͨ͠ - Hatena Developer Blog
  10. iOS։ൃͰͷRenovate πʔϧ ରԠঢ়گ උߟ CocoaPods ⭕ " Realm͕͋ΔͱNG1 XcodeGenͱซ༻͍ͯ͠ΔͱNG2 SwiftPM

    # $ Package.resolvedͷߋ৽ͱɺXcode͔Β Swift PackageΛ௥Ճ͢Δ৔߹ʹ͸ඇରԠ3 Carthage ❌ & regex managerΛ࢖͏ XcodeGen (Swift Package) ❌ & regex managerΛ࢖͏ 3 https://github.com/renovatebot/renovate/issues/6924, https://github.com/renovatebot/renovate/issues/9735 2 Renovateͷ࣮ߦ࣌ʹ.xcodeproj͕ଘࡏͤͣɺpod install͕ࣦഊ͢ΔͨΊ 1 https://github.com/renovatebot/renovate/issues/6588
  11. SwiftPM • Package.resolvedͷߋ৽ʹඇରԠ • PRʹࣗ෼Ͱ௥͍ίϛοτΛ͢Δ͔ɺ΋͘͠͸ • CIͰʢྫ͑͹GitHub ActionsͰʣߋ৽͢ΔϫʔΫϑϩʔΛ ༻ҙ͢Δ

  12. update-package-resolved.yml: on: pull_request: paths: - Package.swift jobs: precheck: runs-on: ubuntu-latest

    outputs: files_changed: ${{ steps.file_changes.outputs.files }} steps: - uses: actions/checkout@v3 - id: file_changes uses: trilom/file-changes-action@v1.2.4 update: runs-on: macos-latest needs: precheck if: contains(fromJson(needs.precheck.outputs.files_changed), 'Package.resolved') == false steps: - ...
  13. 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. • ૊ΈࠐΈͰ͸ରԠ͍ͯ͠ͳ͍΋ͷͰ΋ɺਖ਼نදݱͰର৅ͷϥΠ ϒϥϦ໊΍όʔδϣϯΛൈ͖ग़͠ɺࢦఆͨ͠σʔλιʔε͔Β ֘౰ͷϥΠϒϥϦͷߋ৽ΛνΣοΫͰ͖Δ • ਖ਼نදݱͰൈ͖ग़ͤͳ͍߲໨͕͋Δ৔߹͸௚઀ࢦఆ΋Ͱ͖Δ
  14. 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}
  15. regex manager - Dockerfileͷྫ renovate.json: { "regexManagers": [ { "fileMatch":

    ["^Dockerfile$"], "matchStrings": ["ENV YARN_VERSION=(?<currentValue>.*?)\\n"], "depNameTemplate": "yarn", "datasourceTemplate": "npm" } ] }
  16. regex manager - Carthage Cartfile.private: github "Quick/Quick" "v4.0.0" github "Quick/Nimble"

    "v9.2.1"
  17. regex manager - Carthage renovate.json: { "regexManagers": [ { "fileMatch":

    ["^Cartfile(\\.(private|resolved))?$"], "matchStrings": ["github\\s\\"(?<depName>.*?)\\"\\s[\"~>=\\s]+(?<currentValue>[a-zA-Z0-9.]+)"], "datasourceTemplate": "github-tags" } ] }
  18. regex manager - XcodeGen project.yml: packages: Quick: url: https://github.com/Quick/Quick version:

    4.0.0 Nimble: url: https://github.com/Quick/Nimble version: 9.2.1
  19. regex manager - XcodeGen renovate.json: { "regexManagers": [ { "fileMatch":

    ["^project.yml$"], "matchStrings": [ "url: https:\\/\\/github\\.com\\/(?<depName>.*?)(\\.git)?\\s*version: (?<currentValue>.*)\\s" ], "datasourceTemplate": "github-releases" } ] }
  20. ϞόΠϧΞϓϦ։ൃͰ΋ ϥΠϒϥϦʔߋ৽Λ ࣗಈԽ͍͖ͯ͠·͠ΐ͏

  21. ࢀߟURL • https://renovatebot.com/ • https://docs.renovatebot.com/configuration-options/ • https://docs.renovatebot.com/modules/manager/regex/ • ͸ͯͳͰ࢖༻͍ͯ͠ΔRenovateͷઃఆϓϦηοτΛެ։͠· ͨ͠

    - Hatena Developer Blog • RenovateΛiOSΞϓϦ։ൃʹಋೖͯ͠Έͨ - dely tech blog
  22. ! Happy Renovation

  23. Thank you @ikesyo / Sho Ikeda