Closed harryngict closed 1 month ago
Any updates on this?
We're also facing the same issue 😢 Would love to see any updates on this!
We are experiencing the same issue running Danger-Swift on Ubuntu, so Xcode is not involved. Could it be a Swift 6 issue?
Same experience on Github Actions
We are experiencing the same issue running Danger-Swift on Ubuntu, so Xcode is not involved. Could it be a Swift 6 issue?
I don't see how. The Package. swift
that I use for Danger is marked as 5.10
. And I don't have Swift 6 enabled anywhere in my project.
I don't see how. The Package. swift that I use for Danger is marked as 5.10. And I don't have Swift 6 enabled anywhere in my project.
The swift-tools-version
in Package.swift
defines the minimum version of Swift tools required to build the package. I was referring to the Swift 6 toolchain, not the Swift 6 language - apologies for the confusion. If the system only has Swift 6 toolchain installed (which seems to be the case with the Ubuntu runners), it will be used to build the package.
Also happening on 3.20.0:
danger-swift 3.18.1 is already installed but outdated (so it will be upgraded).
==> Fetching danger/tap/danger-swift
==> Downloading https://github.com/danger/danger-swift/archive/3.20.0.tar.gz
==> Downloading from https://codeload.github.com/danger/swift/tar.gz/refs/tags/3.20.0
==> Upgrading danger/tap/danger-swift
3.18.1 -> 3.20.0
==> make install PREFIX=/opt/homebrew/Cellar/danger-swift/3.20.0
🍺 /opt/homebrew/Cellar/danger-swift/3.20.0: 8 files, 3.9MB, built in 39 seconds
Warning: HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK is set: not checking for outdated
dependents or dependents with broken linkage!
+ echo '⚠️ DANGER ! :)'
⚠️ DANGER ! :)
+ danger-swift ci
/var/folders/b8/9zt_tx3s1y37nzh_cs991xyc0000gn/T/danger/FFA7F08D-5ACD-4F14-9B3C-8765A95A10D2/_tmp_dangerfile.swift:1:8: error: no such module 'Danger'
1 [REDACTED] import Danger
[REDACTED] `- error: no such module 'Danger'
2 [REDACTED] import Foundation
3 [REDACTED]
ERROR: Dangerfile eval failed at Dangerfile.swift
ERROR: Could not get the results JSON file at /var/folders/b8/9zt_tx3s1y37nzh_cs991xyc0000gn/T/danger/FFA7F08D-5ACD-4F14-9B3C-8765A95A10D2/danger-response.json
Failing the build, there is 1 fail.
Feedback: https://github.com/gtforge/gtforge-iphone/pull/3919#issuecomment-2411101472
ERROR: Could not get the results JSON file at /var/folders/b8/9zt_tx3s1y37nzh_cs991xyc0000gn/T/danger/FFA7F08D-5ACD-4F14-9B3C-8765A95A10D2/danger-response.json
the homebrew version is not working, SwiftPM version is not working either. seeing a new releases, but none helps.
SwiftPM is working on 3.20.0 (https://github.com/danger/swift/issues/615) while brew should now be working on 3.20.1, please let me know if it works
nope. Tried SwiftPM today, still no luck when trying to use SwiftLint
Can you please post the verbose logs obtained by adding --verbose
in the command?
Sure! Will provide you verbose logs a bit later
@Sega-Zero looking at your Package.swift it seems you have
.package(url: "https://github.com/danger/swift.git", from: "1.0.0"),
I think this would not get the latest version 3.20.1. Please let me know if that helps!
Still not working with brew
in 3.20.1
@f-meloni
Warning: swiftlint 0.57.0 is already installed and up-to-date.
To reinstall 0.57.0, run:
brew reinstall swiftlint
+ brew install danger-swift
danger-swift 3.18.1 is already installed but outdated (so it will be upgraded).
==> Fetching danger/tap/danger-swift
==> Downloading https://github.com/danger/danger-swift/archive/3.20.1.tar.gz
==> Downloading from https://codeload.github.com/danger/swift/tar.gz/refs/tags/3.20.1
==> Upgrading danger/tap/danger-swift
3.18.1 -> 3.20.1
==> make install PREFIX=/opt/homebrew/Cellar/danger-swift/3.20.1
🍺 /opt/homebrew/Cellar/danger-swift/3.20.1: 8 files, 3.9MB, built in 47 seconds
Warning: HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK is set: not checking for outdated
dependents or dependents with broken linkage!
+ echo '⚠️ DANGER ! :)'
⚠️ DANGER ! :)
+ danger-swift ci
/var/folders/b8/9zt_tx3s1y37nzh_cs991xyc0000gn/T/danger/A2174C8B-B237-46B1-9154-A4BF42A901DA/_tmp_dangerfile.swift:1:8: error: no such module 'Danger'
1 [REDACTED] import Danger
[REDACTED] `- error: no such module 'Danger'
2 [REDACTED] import Foundation
3 [REDACTED]
ERROR: Dangerfile eval failed at Dangerfile.swift
ERROR: Could not get the results JSON file at /var/folders/b8/9zt_tx3s1y37nzh_cs991xyc0000gn/T/danger/A2174C8B-B237-46B1-9154-A4BF42A901DA/danger-response.json
Failing the build, there is 1 fail.
Feedback: https://github.com/gtforge/gtforge-iphone/pull/3919#issuecomment-2411101472
ERROR: Could not get the results JSON file at /var/folders/b8/9zt_tx3s1y37nzh_cs991xyc0000gn/T/danger/A2174C8B-B237-46B1-9154-A4BF42A901DA/danger-response.json
@oronbz would you have time to manually install danger swift (clone the repo, run make install)? Just to understand if the issue is on how we are installing it with brew, because on ci it was working.
@oronbz would you have time to manually install danger swift (clone the repo, run make install)? Just to understand if the issue is on how we are installing it with brew, because on ci it was working.
Trying...
Same issue @f-meloni:
23 [REDACTED] if let spmDanger = SPMDanger() {
[23/30] Write Objects.LinkFileList
[24/30] Linking danger-swift
[26/30] Compiling OctoKit Configuration.swift
[27/31] Compiling Danger BitBucketCloud.swift
[27/31] Write Objects.LinkFileList
[29/33] Compiling Danger_Swift Fake.swift
[29/33] Write Objects.LinkFileList
[30/33] Linking libDanger.dylib
[31/33] Linking libDangerDeps.dylib
[33/33] Compiling DangerFixtures CustomGitHubDSL.swift
Build complete! (48.98s)
swift-driver version: 1.115 + cd ..
+ echo '⚠️ DANGER ! :)'
⚠️ DANGER ! :)
+ danger-swift ci
/var/folders/b8/9zt_tx3s1y37nzh_cs991xyc0000gn/T/danger/373C7EB1-762B-4E64-9B08-F2A3C9EF15D7/_tmp_dangerfile.swift:1:8: error: no such module 'Danger'
1 [REDACTED] import Danger
[REDACTED] `- error: no such module 'Danger'
2 [REDACTED] import Foundation
3 [REDACTED]
ERROR: Dangerfile eval failed at Dangerfile.swift
ERROR: Could not get the results JSON file at /var/folders/b8/9zt_tx3s1y37nzh_cs991xyc0000gn/T/danger/373C7EB1-762B-4E64-9B08-F2A3C9EF15D7/danger-response.json
Failing the build, there is 1 fail.
Feedback: https://github.com/gtforge/gtforge-iphone/pull/3919#issuecomment-2411101472
ERROR: Could not get the results JSON file at /var/folders/b8/9zt_tx3s1y37nzh_cs991xyc0000gn/T/danger/373C7EB1-762B-4E64-9B08-F2A3C9EF15D7/danger-response.json
@oronbz I'm not able to reproduce it on Mac, are you on Linux?
@oronbz I'm not able to reproduce it on Mac, are you on Linux?
It's a Bitrise (CI) mac
edit: It comes preinstalled with Danger 3.18.1
, are there any steps to fully uninstall it other than brew uninstall danger-swift
?
@oronbz I'm not able to reproduce it on Mac, are you on Linux?
It's a Bitrise (CI) mac
edit: It comes preinstalled with
Danger 3.18.1
, are there any steps to fully uninstall it other thanbrew uninstall danger-swift
?
I would probably run
rm -rf /usr/local/lib/danger
rm -rf /usr/local/bin/danger-swift
(assuming danger is saved there)
and then make install
from the cloned repo, to minimise the possibilities of an issue
@f-meloni first of all, it doesn't work locally for me macOS 15.0
Xcode 16
:
➜ gtforge-iphone git:(infra/return_danger) danger-swift --version
3.20.1
➜ gtforge-iphone git:(infra/return_danger) danger-swift pr https://github.com/gtforge/gtforge-iphone/pull/3919
Starting Danger PR on gtforge/gtforge-iphone#3919
/var/folders/5c/pr5fqvp10g3237xh2zvywh6r0000gq/T/danger/F0097C4F-C4A0-40DC-989E-DB7DCD1828A1/_tmp_dangerfile.swift:1:8: error: no such module 'Danger'
1 | import Danger
| `- error: no such module 'Danger'
2 | import Foundation
3 |
ERROR: Dangerfile eval failed at Dangerfile.swift
ERROR: Could not get the results JSON file at /var/folders/5c/pr5fqvp10g3237xh2zvywh6r0000gq/T/danger/F0097C4F-C4A0-40DC-989E-DB7DCD1828A1/danger-response.json
Danger: ⅹ Failing the build, there is 1 fail.
## Failures
`danger-swift` failed.
## Markdowns
### Log
<details>
/var/folders/5c/pr5fqvp10g3237xh2zvywh6r0000gq/T/danger/F0097C4F-C4A0-40DC-989E-DB7DCD1828A1/_tmp_dangerfile.swift:1:8: error: no such module 'Danger'
1 | import Danger
| `- error: no such module 'Danger'
2 | import Foundation
3 |
ERROR: Dangerfile eval failed at Dangerfile.swift
ERROR: Could not get the results JSON file at /var/folders/5c/pr5fqvp10g3237xh2zvywh6r0000gq/T/danger/F0097C4F-C4A0-40DC-989E-DB7DCD1828A1/danger-response.json
</details>
This is from a brew install
, will try now with a local clone
@f-meloni exactly the same with local clone and make install
.
attaching the Dangerfile.swift
just in case I missed something:
import Danger
import Foundation
let danger = Danger()
// Make sure no Quick focused tests were accidentally left in
verifyNoQuickFocusedTests()
// When run locally or out of a PR scenario, `github` will be nil
if let pullRequest = danger.github?.pullRequest {
if pullRequest.title.starts(with: "[WIP]") {
warn("PR is classified as Work in Progress")
}
detectJIRATicket(in: pullRequest.title)
}
// Warn if GTRide.h has been changed
if danger.git.modifiedFiles.contains("Gett/Model/GTRide.h") {
warn("`GTRide.h` has been modified. " +
"If you've added a property, make sure you've also added it in: " +
"`GTWorkflow.m` `updateRide:(GTRide*)ride`")
}
// Lint Rider
let riderViloations = SwiftLint.lint(.all(directory: "Rider"), inline: true, configFile: "Rider/.swiftlint.yml")
// Lint project
let gtViloations = SwiftLint.lint(.all(directory: nil), inline: true)
let violationCount = riderViloations.count + gtViloations.count
if violationCount > 0 {
fail("There are \(violationCount) violations, please fix those before merging")
}
// MARK: - Private Helpers
/// Check if a JIRA ticket is mentioned in the PR title
private func detectJIRATicket(in title: String) {
guard title.starts(with: "[GETT-"),
let jiraTicket = title.components(separatedBy: "]").first?.dropFirst() else {
return
}
message("JIRA Ticket: [\(jiraTicket)](https://jira.gtforge.com/browse/\(jiraTicket))")
}
/// Make sure we didn't forget any focused Quick tests on
private func verifyNoQuickFocusedTests() {
func testFiles(containing searchTerm: String) -> [String] {
let result = danger.utils.exec("grep -rlI \"\(searchTerm)\" GettTests/")
return result
.components(separatedBy: "\n")
.compactMap { piece -> String? in
guard let spec = piece.components(separatedBy: "/")
.last?
.trimmingCharacters(in: .whitespacesAndNewlines),
!spec.isEmpty else { return nil }
return spec
}
}
let fitFiles = testFiles(containing: "fit(")
let fdescribeFiles = testFiles(containing: "fdescribe(")
let fcontextFiles = testFiles(containing: "fcontext(")
if !fitFiles.isEmpty {
fail("The following specs have fit() focused tests: \(fitFiles.joined(separator: ", "))")
}
if !fdescribeFiles.isEmpty {
fail("The following specs have fdescribe() focused tests: \(fdescribeFiles.joined(separator: ", "))")
}
if !fcontextFiles.isEmpty {
fail("The following specs have fcontext() focused tests: \(fcontextFiles.joined(separator: ", "))")
}
}
So, this is what confuses me at the moment: https://github.com/danger/swift/actions/runs/11328285003/job/31501199290
This is doing a make install
, then creates a new folder with just a dangerfile and runs danger there, and that is passing.
I can also make it work locally, but if I look at the libraries moved by make install, they don't seem the right ones. Let me investigate this further
@oronbz can you try to run make install from this branch please? fix_install_script
@f-meloni worked! Woop woop
➜ gtforge-iphone git:(infra/return_danger) danger-swift pr https://github.com/gtforge/gtforge-iphone/pull/3919
Starting Danger PR on gtforge/gtforge-iphone#3919
Danger: ⅹ Failing the build, there is 1 fail.
## Failures
There are 1 violations, please fix those before merging
## Warnings
Colons should be next to the identifier when specifying a type and next to the key in dictionary literals (`colon`)
Great! let me clean up, merge and release!
Can you please try the new version 3.20.2? Thank you! :)
🥳
Thank you so much @f-meloni!
Fantastic! Closing the issue then :)
@f-meloni sorry 😭
patched a version in Package.swift to 3.0.0 as you mentioned
@Sega-Zero I'm looking at your package.swift, I think DangerDepedencies needs to depend on Danger, for it to be linked
.target(name: "DangerDependencies", dependencies: ["Danger"])
It will not compile then
finally got it working after changing the Package.swift to
@f-meloni I'm still getting some errors when using a vanilla danger setup with Swift 6 / Xcode 16
This is my Package.swift file
// swift-tools-version:6.0
import PackageDescription
let package = Package(
name: "Eigen",
platforms: [.macOS(.v13)],
products: [
.library(
name: "DangerDeps",
type: .dynamic,
targets: ["DangerDependencies"]
)
],
dependencies: [
.package(
url: "https://github.com/danger/swift.git",
from: "3.20.2"
)
],
targets: [
.target(
name: "DangerDependencies",
dependencies: [
.product(
name: "Danger",
package: "swift"
),
]
)
]
)
And this is the error I'm getting after running these commands:
swift build -c release
cp .build/release/libDangerDeps.dylib .build/release/libDanger.dylib
DEBUG="*" swift run -c release danger-swift ci
Error:
/Users/myuser/danger-test/.build/arm64-apple-macosx/release/SwiftFormat-tool.build/module.modulemap:1:8: error: redefinition of module 'SwiftFormat'
1 | module SwiftFormat {
| `- error: redefinition of module 'SwiftFormat'
2 | header "/Users/myuser/danger-test/.build/arm64-apple-macosx/release/SwiftFormat-tool.build/SwiftFormat-Swift.h"
3 | requires objc
/Users/myuser/danger-test/.build/arm64-apple-macosx/release/SwiftFormat.build/module.modulemap:1:8: note: previously defined here
1 | module SwiftFormat {
| `- note: previously defined here
2 | header "/Users/myuser/danger-test/.build/arm64-apple-macosx/release/SwiftFormat.build/SwiftFormat-Swift.h"
3 | requires objc
/Users/myuser/danger-test/.build/arm64-apple-macosx/release/SwiftFormat-tool.build/module.modulemap:1:8: error: redefinition of module 'SwiftFormat'
1 | module SwiftFormat {
| `- error: redefinition of module 'SwiftFormat'
2 | header "/Users/myuser/danger-test/.build/arm64-apple-macosx/release/SwiftFormat-tool.build/SwiftFormat-Swift.h"
3 | requires objc
/Users/myuser/danger-test/.build/arm64-apple-macosx/release/SwiftFormat.build/module.modulemap:1:8: note: previously defined here
1 | module SwiftFormat {
| `- note: previously defined here
2 | header "/Users/myuser/danger-test/.build/arm64-apple-macosx/release/SwiftFormat.build/SwiftFormat-Swift.h"
3 | requires objc
/var/folders/xy/fyskh3557hj_zjyrnnjmhg9nqsvv6_/T/danger/D60A5DF8-BB5B-4655-BA7A-345479D39771/_tmp_dangerfile.swift:1:8: error: could not build Objective-C module 'Danger'
1 | import Danger
| `- error: could not build Objective-C module 'Danger'
2 |
3 | let danger = Danger()
Any idea what's happening here?
Are you sure you are using the latest danger swift version?
According to the resolved file yes, not sure what's going on
{
"originHash" : "36abd041412583f5cd210268e843be9b5b8e8277411c70fb9c71ae0fdda24bdf",
"pins" : [
{
"identity" : "logger",
"kind" : "remoteSourceControl",
"location" : "https://github.com/shibapm/Logger",
"state" : {
"revision" : "53c3ecca5abe8cf46697e33901ee774236d94cce",
"version" : "0.2.3"
}
},
{
"identity" : "octokit.swift",
"kind" : "remoteSourceControl",
"location" : "https://github.com/nerdishbynature/octokit.swift",
"state" : {
"revision" : "44192458beb89180c3a3a1245d904aacac8be0ae",
"version" : "0.13.0"
}
},
{
"identity" : "requestkit",
"kind" : "remoteSourceControl",
"location" : "https://github.com/nerdishbynature/RequestKit.git",
"state" : {
"revision" : "e4d905fed938807e36d87f28375f88b7c1c26840",
"version" : "3.3.0"
}
},
{
"identity" : "swift",
"kind" : "remoteSourceControl",
"location" : "https://github.com/danger/swift.git",
"state" : {
"revision" : "e43a19617fc905ef303b1af2f0449b99fc6ea0f2",
"version" : "3.20.2"
}
},
{
"identity" : "swiftformat",
"kind" : "remoteSourceControl",
"location" : "https://github.com/nicklockwood/SwiftFormat",
"state" : {
"revision" : "86ed20990585f478c0daf309af645c2a528b59d8",
"version" : "0.54.6"
}
},
{
"identity" : "version",
"kind" : "remoteSourceControl",
"location" : "https://github.com/mxcl/Version",
"state" : {
"revision" : "303a0f916772545e1e8667d3104f83be708a723c",
"version" : "2.1.0"
}
}
],
"version" : 3
}
I think you don't need those two commands
swift build -c release
cp .build/release/libDangerDeps.dylib .build/release/libDanger.dylib
Also can you please try Swift run without -c release? Just want to see what happens, thanks
Getting this running swift run -c release danger-swift ci
Launching Danger Swift runner (v3.20.2)
Got URL for JSON: /var/folders/xy/fyskh3557hj_zjyrnnjmhg9nqsvv6_/T/danger-dsl-fabda10d.json
Created a temporary file for the Dangerfile DSL at: /var/folders/xy/fyskh3557hj_zjyrnnjmhg9nqsvv6_/T/danger-dsl-fabda10d.json
Running Dangerfile at: Dangerfile.swift
ERROR: Could not find a libDanger to link against at any of: [".build/debug", ".build/x86_64-unknown-linux/debug", ".build/release", "/usr/local/lib/danger", "/opt/homebrew/lib/danger"]
Or via Homebrew, or Marathon
Same without the -c release
flag
And with the same commands as before but without the flag:
swift build
cp .build/debug/libDangerDeps.dylib .build/debug/libDanger.dylib
swift run danger-swift ci
I'm getting this error:
/Users/myuser/danger-test/.build/debug/SwiftFormat-tool.build/module.modulemap:1:8: error: redefinition of module 'SwiftFormat'
1 | module SwiftFormat {
| `- error: redefinition of module 'SwiftFormat'
2 | header "/Users/myuser/danger-test/.build/arm64-apple-macosx/debug/SwiftFormat-tool.build/SwiftFormat-Swift.h"
3 | requires objc
/Users/myuser/danger-test/.build/debug/SwiftFormat.build/module.modulemap:1:8: note: previously defined here
1 | module SwiftFormat {
| `- note: previously defined here
2 | header "/Users/myuser/danger-test/.build/arm64-apple-macosx/debug/SwiftFormat.build/SwiftFormat-Swift.h"
3 | requires objc
/Users/myuser/danger-test/.build/debug/SwiftFormat-tool.build/module.modulemap:1:8: error: redefinition of module 'SwiftFormat'
1 | module SwiftFormat {
| `- error: redefinition of module 'SwiftFormat'
2 | header "/Users/myuser/danger-test/.build/arm64-apple-macosx/debug/SwiftFormat-tool.build/SwiftFormat-Swift.h"
3 | requires objc
/Users/myuser/danger-test/.build/debug/SwiftFormat.build/module.modulemap:1:8: note: previously defined here
1 | module SwiftFormat {
| `- note: previously defined here
2 | header "/Users/myuser/danger-test/.build/arm64-apple-macosx/debug/SwiftFormat.build/SwiftFormat-Swift.h"
3 | requires objc
/var/folders/xy/fyskh3557hj_zjyrnnjmhg9nqsvv6_/T/danger/543F39B0-BE17-40A0-B565-2B4E500A0D90/_tmp_dangerfile.swift:1:8: error: could not build Objective-C module 'Danger'
1 | import Danger
| `- error: could not build Objective-C module 'Danger'
2 |
3 | let danger = Danger()
Launching Danger Swift runner (v3.20.2)
Got URL for JSON: /var/folders/xy/fyskh3557hj_zjyrnnjmhg9nqsvv6_/T/danger-dsl-4551d159.json
Created a temporary file for the Dangerfile DSL at: /var/folders/xy/fyskh3557hj_zjyrnnjmhg9nqsvv6_/T/danger-dsl-4551d159.json
Running Dangerfile at: Dangerfile.swift
Preparing to compile
Running: /Applications/Xcode-16.0.0.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift --driver-mode=swift -L /Users/myuser/danger-test/.build/debug -I /Users/myuser/danger-test/.build/debug -lDanger /var/folders/xy/fyskh3557hj_zjyrnnjmhg9nqsvv6_/T/danger/543F39B0-BE17-40A0-B565-2B4E500A0D90/_tmp_dangerfile.swift runner /snapshot/danger-js/distribution/commands/danger-ci.js --process .build/debug/danger-swift --passURLForDSL /var/folders/xy/fyskh3557hj_zjyrnnjmhg9nqsvv6_/T/danger-dsl-4551d159.json /var/folders/xy/fyskh3557hj_zjyrnnjmhg9nqsvv6_/T/danger/543F39B0-BE17-40A0-B565-2B4E500A0D90/danger-response.json
Completed evaluation
ERROR: Dangerfile eval failed at Dangerfile.swift
ERROR: Could not get the results JSON file at /var/folders/xy/fyskh3557hj_zjyrnnjmhg9nqsvv6_/T/danger/543F39B0-BE17-40A0-B565-2B4E500A0D90/danger-response.json
Swift version:
swift-driver version: 1.115 Apple Swift version 6.0 (swiftlang-6.0.0.9.10 clang-1600.0.26.2)
Target: arm64-apple-macosx15.0
Try to remove the new line in
library(name: "DangerDeps",
(Just write it like this, to match the regex)
Then do not do the other steps just run danger-swift directly
That worked, thank you!
Btw, -c
flag is ignored when running swift run
, is that expected?
Yes
Out of context but another observation is that --package-path
flag does not work either, you have to run danger at the same dir level you're located
Hi Team, We are using Danger 3.19.1 on our Bitrise. before XCode 15 that working fine. After we upgrade to XCode 16, Bitrise throw the error:
################### DANGER ###################### Run danger /var/folders/b8/9zt_tx3s1y37nzh_cs991xyc0000gn/T/danger/9D80CAB8-A906-4735-AD6E-128CA0161196/_tmpdangerfile.swift:2:8: error: no such module 'Danger' 1 | import Foundation 2 | import Danger | `- error: no such module 'Danger' 3 | 4 | func checkReviewers( bitbucketCloud: BitBucketCloud) { ERROR: Dangerfile eval failed at Dangerfile.swift ERROR: Could not get the results JSON file at /var/folders/b8/9zt_tx3s1y37nzh_cs991xyc0000gn/T/danger/9D80CAB8-A906-4735-AD6E-128CA0161196/danger-response.json Failing the build, there is 1 fail.