From bdd64944cacbebee123ea4038121b3b8bd8ad1cb Mon Sep 17 00:00:00 2001 From: pjechris Date: Tue, 6 May 2025 17:56:54 +0200 Subject: [PATCH 1/6] update --- .editorconfig | 10 ++++++++++ .github/workflows/doc.yml | 4 ++-- .github/workflows/test.yml | 6 +++--- 3 files changed, 15 insertions(+), 5 deletions(-) create mode 100644 .editorconfig diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..8c59ce1 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,10 @@ +root = true + +[*] +end_of_line = lf +trim_trailing_whitespace = true + +# 4 space indentation +[*.swift] +indent_style = space +indent_size = 4 \ No newline at end of file diff --git a/.github/workflows/doc.yml b/.github/workflows/doc.yml index 925b17f..5394a25 100644 --- a/.github/workflows/doc.yml +++ b/.github/workflows/doc.yml @@ -7,11 +7,11 @@ on: jobs: doc: - runs-on: macos-latest + runs-on: ubuntu-latest steps: - name: Checkout repo - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Publish Jazzy Docs uses: steven0351/publish-jazzy-docs@v1 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 7090a36..a406eee 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -10,14 +10,14 @@ on: jobs: test: - runs-on: macos-11 + runs-on: ubuntu-latest steps: - name: Checkout repo - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Lint code run: swiftlint lint - name: Run tests - run: swift test --enable-test-discovery + run: swift test From cf1ee1172fdc7905a161e4b4e3bbc2e67dee103b Mon Sep 17 00:00:00 2001 From: pjechris Date: Tue, 6 May 2025 18:01:45 +0200 Subject: [PATCH 2/6] swiftlint --- .github/workflows/test.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a406eee..1e79506 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -16,8 +16,10 @@ jobs: - name: Checkout repo uses: actions/checkout@v4 - - name: Lint code - run: swiftlint lint + - name: Lint PR code + uses: norio-nomura/action-swiftlint@3.2.1 + env: + DIFF_BASE: ${{ github.base_ref }} - name: Run tests run: swift test From ace9551a783fd9f331d9c84812160104bdb031b6 Mon Sep 17 00:00:00 2001 From: pjechris Date: Wed, 7 May 2025 09:28:09 +0200 Subject: [PATCH 3/6] add missing import for Linux --- .../Foundation/URLRequest/URLRequest+URL.swift | 4 ++++ .../SimpleHTTPFoundation/Foundation/URLSession+Async.swift | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/Sources/SimpleHTTPFoundation/Foundation/URLRequest/URLRequest+URL.swift b/Sources/SimpleHTTPFoundation/Foundation/URLRequest/URLRequest+URL.swift index 2e69001..854efd8 100644 --- a/Sources/SimpleHTTPFoundation/Foundation/URLRequest/URLRequest+URL.swift +++ b/Sources/SimpleHTTPFoundation/Foundation/URLRequest/URLRequest+URL.swift @@ -1,5 +1,9 @@ import Foundation +#if canImport(FoundationNetworking) +import FoundationNetworking +#endif + extension URLRequest { /// Return a new URLRequest whose path is relative to `baseURL` public func relativeTo(_ baseURL: URL) -> URLRequest { diff --git a/Sources/SimpleHTTPFoundation/Foundation/URLSession+Async.swift b/Sources/SimpleHTTPFoundation/Foundation/URLSession+Async.swift index db5a0b7..a64ee86 100644 --- a/Sources/SimpleHTTPFoundation/Foundation/URLSession+Async.swift +++ b/Sources/SimpleHTTPFoundation/Foundation/URLSession+Async.swift @@ -1,5 +1,9 @@ import Foundation +#if canImport(FoundationNetworking) +import FoundationNetworking +#endif + extension URLSession { @available(iOS, deprecated: 15.0, message: "Use built-in API instead") public func data(for urlRequest: URLRequest) async throws -> (Data, URLResponse) { From 8887e1f4529c1870bb06c53c6b545e36cd5e7157 Mon Sep 17 00:00:00 2001 From: pjechris Date: Wed, 7 May 2025 09:32:49 +0200 Subject: [PATCH 4/6] remove Combine imports --- Sources/SimpleHTTP/Interceptor/CompositeInterceptor.swift | 1 - Sources/SimpleHTTP/Interceptor/Interceptor.swift | 1 - Tests/SimpleHTTPTests/Response/URLDataResponseTests.swift | 6 ------ Tests/SimpleHTTPTests/Session/SessionTests.swift | 1 - 4 files changed, 9 deletions(-) diff --git a/Sources/SimpleHTTP/Interceptor/CompositeInterceptor.swift b/Sources/SimpleHTTP/Interceptor/CompositeInterceptor.swift index 4b1c168..4fe98a5 100644 --- a/Sources/SimpleHTTP/Interceptor/CompositeInterceptor.swift +++ b/Sources/SimpleHTTP/Interceptor/CompositeInterceptor.swift @@ -1,5 +1,4 @@ import Foundation -import Combine /// Use an Array of `Interceptor` as a single `Interceptor` public struct CompositeInterceptor: ExpressibleByArrayLiteral, Sequence { diff --git a/Sources/SimpleHTTP/Interceptor/Interceptor.swift b/Sources/SimpleHTTP/Interceptor/Interceptor.swift index be3a8be..5486e2a 100644 --- a/Sources/SimpleHTTP/Interceptor/Interceptor.swift +++ b/Sources/SimpleHTTP/Interceptor/Interceptor.swift @@ -1,5 +1,4 @@ import Foundation -import Combine public typealias Interceptor = RequestInterceptor & ResponseInterceptor diff --git a/Tests/SimpleHTTPTests/Response/URLDataResponseTests.swift b/Tests/SimpleHTTPTests/Response/URLDataResponseTests.swift index 635a56c..1ac6d9c 100644 --- a/Tests/SimpleHTTPTests/Response/URLDataResponseTests.swift +++ b/Tests/SimpleHTTPTests/Response/URLDataResponseTests.swift @@ -1,13 +1,7 @@ import XCTest -import Combine @testable import SimpleHTTP class URLDataResponseTests: XCTestCase { - var cancellables: Set = [] - - override func tearDown() { - cancellables = [] - } func test_validate_responseIsError_dataIsEmpty_converterIsNotCalled() throws { let response = URLDataResponse(data: Data(), response: HTTPURLResponse.notFound) diff --git a/Tests/SimpleHTTPTests/Session/SessionTests.swift b/Tests/SimpleHTTPTests/Session/SessionTests.swift index c147cb4..fee414f 100644 --- a/Tests/SimpleHTTPTests/Session/SessionTests.swift +++ b/Tests/SimpleHTTPTests/Session/SessionTests.swift @@ -1,5 +1,4 @@ import XCTest -import Combine @testable import SimpleHTTP class SessionAsyncTests: XCTestCase { From a32645bc4650e57d428d4a89d47224ba5a8d6d5a Mon Sep 17 00:00:00 2001 From: pjechris Date: Wed, 7 May 2025 09:36:27 +0200 Subject: [PATCH 5/6] update SwiftLint action --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 1e79506..b79d42c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -17,7 +17,7 @@ jobs: uses: actions/checkout@v4 - name: Lint PR code - uses: norio-nomura/action-swiftlint@3.2.1 + uses: stanfordbdhg/action-swiftlint@v4 env: DIFF_BASE: ${{ github.base_ref }} From a0b1d0872ec45084140ba56008fc9d0dd6419980 Mon Sep 17 00:00:00 2001 From: pjechris Date: Thu, 8 May 2025 09:59:57 +0200 Subject: [PATCH 6/6] back to macos runner...again --- .github/workflows/test.yml | 2 +- .../Foundation/URLRequest/URLRequestTests+URL.swift | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index b79d42c..89d0484 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -10,7 +10,7 @@ on: jobs: test: - runs-on: ubuntu-latest + runs-on: macos-latest steps: - name: Checkout repo diff --git a/Tests/SimpleHTTPFoundationTests/Foundation/URLRequest/URLRequestTests+URL.swift b/Tests/SimpleHTTPFoundationTests/Foundation/URLRequest/URLRequestTests+URL.swift index 3d18b40..c7f0365 100644 --- a/Tests/SimpleHTTPFoundationTests/Foundation/URLRequest/URLRequestTests+URL.swift +++ b/Tests/SimpleHTTPFoundationTests/Foundation/URLRequest/URLRequestTests+URL.swift @@ -2,6 +2,10 @@ import Foundation import XCTest @testable import SimpleHTTPFoundation +#if canImport(FoundationNetworking) +import FoundationNetworking +#endif + class URLRequestURLTests: XCTestCase { func test_relativeTo_requestURLHasBaseURL() { let request = URLRequest(url: URL(string: "path")!)