-
Notifications
You must be signed in to change notification settings - Fork 96
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enable swift PM tests on Linux and macOS #118
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great! Got a few questions. Thanks for taking the time to look into this! ❤️
|
||
extension Bundle { | ||
#if !SWIFT_PACKAGE | ||
static let module = Bundle(for: MockedData.self) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wait, how does this work for the constants above if we're SWIFT_PACKAGE
is YES
? From what I can tell, it shouldn't compile? 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SPM generates this special Bundle.module
accessor (https://developer.apple.com/documentation/swift_packages/bundling_resources_with_a_swift_package) Unfortunately, it doesn't exist in non-SPM targets, so here I was trying to keep both Xcode iOS tests and SPM tests working with resources.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, this makes sense to me! 🙂
func testRedirectResponse() { | ||
func testRedirectResponse() throws { | ||
#if os(Linux) | ||
throw XCTSkip("The URLSession swift-corelibs-foundation implementation doesn't currently handle redirects directly") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👌. Perhaps we can even leave a reference to the issue that tracks this here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here is the code that throws this error https://github.com/apple/swift-corelibs-foundation/blob/main/Sources/FoundationNetworking/URLSession/URLSessionTask.swift#L1037 I haven't found any open issue, seems like URLSession
hasn't been fully implemented on Linux, also, not sure what's their plans in swift-corelibs-foundation
@@ -173,13 +154,13 @@ final class MockerTests: XCTestCase { | |||
/// It should return the additional headers. | |||
func testAdditionalHeaders() { | |||
let expectation = self.expectation(description: "Data request should succeed") | |||
let headers = ["testkey": "testvalue"] | |||
let headers = ["Testkey": "testvalue"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added capitalisation to HTTP headers because Foundation on Linux does this 🤷
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This all makes total sense to me! Thanks a lot for taking the effort to add this. No need to add the GitHub action to our CI package, it's pretty specific. All good 💪
SwiftLint found issues
Code Coverage Report
Generated by 🚫 Danger Swift against 5295a25 |
Congratulations! 🎉 This was released as part of Release 2.6.0 🚀 Generated by GitBuddy |
Follow up from #116
UIKit.UIImage
dependency from tests.swift test
on Linux and macOS. Not sure whether it should be integrated in https://github.com/WeTransfer/WeTransfer-iOS-CI.