Danger-Swift 導入のススメ / Path to import Danger-Swift

Danger-Swift 導入のススメ / Path to import Danger-Swift

Af64bc38c0ffcfcabdf430759ee491ce?s=128

Elvis Shi

July 22, 2020
Tweet

Transcript

  1. %BOHFS4XJGUಋೖͷεεϝ f o r  .PC JMF  "D U

     0/ - * / &   
  2. } var employedBy = "YUMEMI Inc." var job = "iOS

    Tech Lead" var favoriteLanguage = "Swift" var twitter = "@lovee" var qiita = "lovee" var github = "el-hoshino" var additionalInfo = """ Nintendo Switch ͕ͳ͔ͳ͔౰ͨΒͳ͍! """ final class Me: Developable, Talkable {
  3. 13 ͷϨϏϡʔͰɺ͜ΜͳࢦఠΑ͘͠·ͤΜ͔ʁ w ςετΛ௥Ճ͍ͯͩ͘͠͞ w $IBOHFMPHΛ௥Ճ͍ͯͩ͘͠͞ w ͜ͷ -JOU ϫʔχϯάΛमਖ਼͍ͯͩ͘͠͞

    w मਖ਼ྔ͕ଟ͗͢ΔͷͰখ͘͞෼ׂ͍ͯͩ͘͠͞ w FUD
  4. %BOHFS4XJGU

  5. %BOHFS4XJGUͱ͸ ΤϯδχΞ Ϧϙϗετ ʢ(JU)VC౳ʣ $*$%αʔό ʢ#JUSJTF౳ʣ ᶃίʔυΛ1VTIͯ͠ 13Λग़͢ ᶄτϦΨʔΛൃՐ ᶅςετ΍σϓϩΠ

    ͳͲΛ࣮ߦ ᶆ࣮ߦ݁ՌΛฦ͢ %BOHFS4XJGU 13΍ࠩ෼ͷ ੩తղੳ
  6. 13΍ࠩ෼Λ ੩తղੳ͢Δπʔϧ %BOHFS4XJGUͱ͸

  7. w ϑΝΠϧมߋ֬ೝ w Ϗϧυϫʔχϯά w ϒϥϯν֬ೝ w ςετΧόϨοδ ʢશମʣ w

    ςετΧόϨοδ ʢϑΝΠϧ͝ͱʣ
  8. ػցݕࠪͰ ϨϏϡΞʔͷෛ୲ΛݮΒ͢πʔϧ %BOHFS4XJGUͱ͸

  9. Ͱ͸%BOHFS4XJGUΛ ಋೖͯ͠ΈΑ͏

  10. IUUQTHJUIVCDPNEBOHFSTXJGU

  11. %BOHFS4XJGUͷಋೖᶃϩʔΧϧฤ .JOUΛ࢖͏ํ๏΋͋Δ͕ɺݱࡏόά͕͋ΔͬΆ͍ͷͰ౰෼ͷؒ)PNFCSFXͷํ͕͓͢͢Ί $ brew install danger-swift * $ cd path/to/project

    $ danger-swift edit $ # edit in Xcode $ # return $ # Dangerfile.swift generated
  12. %BOHFS4XJGUͷಋೖᶄಈ࡞ςετฤ $ # Create a Pull Request $ danger-swift pr

    url/to/pr
  13. %BOHFS4XJGUͷಋೖᶅ$*࣮ߦฤ .JOUΛ࢖͏ํ๏΋͋Δ͕ɺݱࡏόά͕͋ΔͬΆ͍ͷͰ౰෼ͷؒ)PNFCSFXͷํ͕͓͢͢Ί $ brew install danger-swift * $ # set

    $DANGER_GITHUB_API_TOKEN $ danger-swift ci
  14. ͢Ͱʹ%BOHFS͕͋Δͷʹ ͳͥ%BOHFS4XJGUΛਪ͔͢

  15. %BOHFS %BOHFS4XJGU

  16. ϓϩύςΟʔએݴ΁ͷδϟϯϓ

  17. %BOHFSΑΓ%BOHFS4XJGU͕͍͍ͱ͜Ζ w ࢖͍׳ΕͯΔ4XJGUͰ%BOHFSpMFॻ͚ΔͷͰɺॻ͘ ͷ΋ಡΉͷ΋3VCZΑΓָʢJ04ΤϯδχΞతʹʣ w *%&ͷαϙʔτ͕ड͚ΒΕΔͷͰɺ࢓༷Λ׬શʹ೺Ѳ Ͱ͖ͯͳͯ͘΋τϥΠˍΤϥʔͰॻ͍͍͚ͯΔ w ߏจΤϥʔ͸ϏϧυΤϥʔͳͷͰɺϩʔΧϧͰͷಈ࡞ ςετ͸3VCZϑΝΠϧΑΓίετ͕௿͍

    w 4XJGU1.ϓϩδΣΫτରԠͷϓϥάΠϯ͕%BOHFS ΑΓॆ࣮
  18. 13ͷϨϏϡʔͰɺ͜ΜͳࢦఠΑ͘͠·ͤΜ͔ʁ w ςετΛ௥Ճ͍ͯͩ͘͠͞ w $IBOHFMPHΛ௥Ճ͍ͯͩ͘͠͞ w ͜ͷ-JOUϫʔχϯάΛमਖ਼͍ͯͩ͘͠͞ w मਖ਼ྔ͕ଟ͗͢ΔͷͰখ͘͞෼ׂ͍ͯͩ͘͠͞ w

    FUD
  19. %BOHFSpMFTXJGUαϯϓϧ let danger = Danger() // ςετΧόϨοδΛ֬ೝ import DangerSwiftCoverage //

    package: https://github.com/f-meloni/danger-swift-coverage.git Coverage.xcodeBuildCoverage(.xcresultBundle("Test.xcresult"), minimumCoverage: 60) // Changelog ฤूঢ়گ֬ೝ if !danger.git.modifiedFiles.contains(where: { $0 == "CHANGELOG.md" }) { danger.warn("CHANGELOG Λฤू͍ͯͩ͘͠͞ɻ") } // SwiftLint ϫʔχϯάΛ֬ೝ SwiftLint.lint() // मਖ਼ྔΛ֬ೝ let additions = danger.github.pullRequest.additions ?? 0 let deletions = danger.github.pullRequest.deletions ?? 0 if additions + deletions > 1_000 { danger.warn("मਖ਼ྔ͕ଟ͗͢Ͱ͢ɻPR Λখ͘͞෼ׂ͍ͯͩ͘͠͞ɻ") } // ϦϦʔεલͷόʔδϣϯ൪߸มߋ֬ೝ import DangerSwiftHammer // package: https://github.com/el-hoshino/DangerSwiftHammer.git if danger.github.pullRequest.head.ref == "master" { let xcodeprojFileDiff = danger.hammer.diffLines(in: "Project.xcodeproj/project.pbxproj") if !xcodeprojFileDiff.additions.contains(where: { $0.contains("MARKETING_VERSION = ") }) { danger.warn("ϦϦʔεલʹόʔδϣϯ൪߸Λมߋ͍ͯͩ͘͠͞") } }
  20. ͞Βʹৄ͘͠ɿ IUUQTRJJUBDPNMPWFFJUFNTBEBFC

  21. ࢀߟࢿྉ w IUUQTEBOHFSTZTUFNTTXJGU w IUUQTEBOHFSTZTUFNTSVCZ w IUUQTHJUIVCDPNEBOHFSTXJGU w IUUQTHJUIVCDPNFMIPTIJOP2VJDLTIB3FCMPC EFWFMPQ%BOHFSpMFTXJGU