Coder Social home page Coder Social logo

squarefrog / danger-swift-xcodesummary Goto Github PK

View Code? Open in Web Editor NEW

This project forked from f-meloni/danger-swift-xcodesummary

0.0 1.0 0.0 3.86 MB

A Danger-Swift plugin that adds build errors, warnings and unit tests results generated from xcodebuild to your Danger report

Ruby 0.46% Swift 99.54%

danger-swift-xcodesummary's Introduction

DangerXCodeSummary

A Danger-Swift plugin that adds build errors, warnings and unit tests results generated from xcodebuild to your Danger report

Inspired by danger-xcode_summary

DangerXCodeSummary

Getting Started

Install DangerSwiftCoverage

Swift Package Manager (More performant)

You can use a "full SPM" solution to install both danger-swift and DangerXCodeSummary.

  • Add to your Package.swift:
let package = Package(
    ...
    products: [
        ...
        .library(name: "DangerDeps", type: .dynamic, targets: ["DangerDependencies"]), // dev
        ...
    ],
    dependencies: [
        ...
        // Danger Plugins
        .package(url: "https://github.com/f-meloni/danger-swift-xcodesummary", from: "0.1.0") // dev
        ...
    ],
    targets: [
        .target(name: "DangerDependencies", dependencies: ["Danger", "DangerXCodeSummary"]), // dev
        ...
    ]
)
  • Add the correct import to your Dangerfile.swift:
import DangerXCodeSummary

let summary = XCodeSummary(filePath: "result.json")
  • Create a folder called DangerDependencies on Sources with an empty file inside like Fake.swift
  • To run Danger use swift run danger-swift command
  • (Recommended) If you are using SPM to distribute your framework, use Rocket, or similar to comment out all the dev depencencies from your Package.swift. This prevents the dev dependencies to be downloaded and compiled with your framework.

Marathon

  • Add this to your Dangerfile.swift
import DangerXCodeSummary // package: https://github.com/f-meloni/danger-swift-xcodesummary.git

let summary = XCodeSummary(filePath: "result.json")
  • (Recommended) Cache the ~/.danger-swift folder

Run with SPM

DangerXCodeSummary can be used with SPM (this repo uses it on the Linux CI), but at the moment, if you use SPM, falining tests inline messages are not generated. To generate the report run:

swift test | XCPRETTY_JSON_FILE_OUTPUT=result.json xcpretty -f `xcpretty-json-formatter`

Send report to Danger

summary.report()

Warning and Errors count

if summary.errorsCount > maxErrorCount {
  fail("There are more than \(maxErrorCount) errors"
}

if summary.warningsCount > maxWarningsCount {
  fail("There are more than \(maxWarningsCount) warnings"
}

Filtering results

Don't show warnings:

let summary = XCodeSummary(json: JSONFile.jsonObject(fromString: reportTestJSON), dsl: dsl, resultsFilter: { result in
    return result.category != .warning
})
summary.report()

Filter out any error or warning for a specific path:

let summary = XCodeSummary(json: JSONFile.jsonObject(fromString: warningsJSON), dsl: dsl, resultsFilter: { result in
    guard let file = result.file else { return true }
    return !file.contains("Sources/DangerXCodeSummary/")
})
summary.report()

danger-swift-xcodesummary's People

Contributors

avdlee avatar f-meloni avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.