Open skywalkerdude opened 4 years ago
I have the same problem. Did you find a way to make this work?
When using marathon I get:
ERROR: Could not get the results JSON file at /var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/danger-response.json
And with a Package.swift I get:
ERROR: failedToUpdatePackages("/Users/runner/.danger-swift/Packages/")
@f-meloni Do you have an example GitHub Actions workflow?
I tried:
- name: Lint
run: |
brew install danger/tap/danger-swift
danger-swift ci
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Also tried:
- name: Lint
run: |
brew install danger/tap/danger-js
swift build --target DangerDependencies
swift run danger-swift ci
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@yonat-ateam can I see your Dangerfile? Because you are using swift build, but that error comes from the non SPM configuration, so there is something wrong there for sure.
My Dangerfile.swift (when trying with marathon):
// swiftlint:disable all
import Danger
import DangerSwiftCoverage // package: https://github.com/f-meloni/danger-swift-coverage.git
let danger = Danger()
SwiftLint.lint(inline: true, swiftlintPath: "Pods/SwiftLint/swiftlint")
Coverage.xcodeBuildCoverage(
.derivedDataFolder("Build"),
minimumCoverage: 50
)
@yonat-ateam given you are using swift build --target DangerDependencies
are you also importing this framework in your Package.swift, if so can I see that too?
If you are using SPM to download the dependencies you don't have the // package in your Dangerfile.
The two ways to get the needed framework are mutual exclusive
I tried both ways:
danger-swift ci
in the workflowswift build --target DangerDependencies
in the workflow, and the following Package.swift:// swift-tools-version:5.1
import PackageDescription
let package = Package(
name: "DangerDependencies",
products: [
.library(name: "DangerDependencies", type: .dynamic, targets: ["DangerDependencies"]) // dev
],
dependencies: [
.package(url: "https://github.com/danger/swift.git", from: "3.11.1"), // dev
.package(url: "https://github.com/f-meloni/danger-swift-coverage.git", from: "1.2.1"), // dev
],
targets: [
.target(name: "DangerDependencies", dependencies: ["Danger", "DangerSwiftCoverage"], path: "DangerDependencies") // dev
]
)
Note: My project is a regular iOS app, not a swift package. I only use the Package.swift for danger.
Also, I made an empty file at DangerDependencies/Fake.swift
.
With SPM the name of the framework is fixed, so you need to call the library DangerDeps
(plus optionally any string you want so DangerDepsMyFramework
for example) in order for it to work.
For the "Marathon"solution, if you are using Xcode 13 then there was a bug which is been solved in the version I've released on Sunday, please see if you have that one installed 🙂 (3.12.2)
Thanks, will try that!
I'm afraid I'm still getting ERROR: failedToUpdatePackages("/Users/runner/.danger-swift/Packages/")
.
Full step output:
Run brew install danger/tap/danger-swift
brew install danger/tap/danger-swift
danger-swift ci
shell: /bin/bash -e {0}
env:
GITHUB_TOKEN: ***
==> Tapping danger/tap
Cloning into '/usr/local/Homebrew/Library/Taps/danger/homebrew-tap'...
Tapped 3 formulae (16 files, 114KB).
==> Downloading https://github.com/danger/danger-js/releases/download/10.7.0/danger-macos.zip
==> Downloading from https://github-releases.githubusercontent.com/66146807/9a626ab6-0b77-4d2b-bc17-2abe3888d463?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20211102%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20211102T143354Z&X-Amz-Expires=300&X-Amz-Signature=433ad85183e37e0b20d4f1500869bfa4522ee6c6afe68a4083f8d8e8049a59f9&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=66146807&response-content-disposition=attachment%3B%20filename%3Ddanger-macos.zip&response-content-type=application%2Foctet-stream
==> Downloading https://github.com/danger/danger-swift/archive/3.12.2.tar.gz
==> Downloading from https://codeload.github.com/danger/swift/tar.gz/3.12.2
==> Installing danger-swift from danger/tap
==> Installing dependencies for danger/tap/danger-swift: danger/tap/danger-js
==> Installing danger/tap/danger-swift dependency: danger/tap/danger-js
🍺 /usr/local/Cellar/danger-js/10.7.0: 3 files, 84MB, built in 7 seconds
==> Installing danger/tap/danger-swift
==> make install PREFIX=/usr/local/Cellar/danger-swift/3.12.2
🍺 /usr/local/Cellar/danger-swift/3.12.2: 17 files, 5.3MB, built in 1 minute 39 seconds
Cloning and building inline dependencies: import DangerSwiftCoverage // package: https://github.com/f-meloni/danger-swift-coverage.git, this might take some time.
Updating packages...
ERROR: failedToUpdatePackages("/Users/runner/.danger-swift/Packages/")
Any ideas?
I turned off spm caching (through actions/cache@v2
) and now it runs without errors. Thanks @f-meloni !
I tried my best when following the instructions, but I am unable to run the DangerSwiftCoverage plugin on my danger github action. I did enable "Gather the Coverage" on my XCode. I am using Cocoapods for my dependencies, so I haven't yet moved to SPM
https://github.com/HymnalDreamTeam/Hymns-iOS/pull/79