Browse Source

Update test target deployment targets (#3990)

### Goals :soccer:
This PR updates the deployment target of the test targets so Swift
Testing can be used without availability checking.

### Implementation Details :construction:
Project update only, SPM already had high enough targets.

### Testing Details :mag:
Sets the stage for more Testing tests.
Jon Shier 2 months ago
parent
commit
8f4ecb5c92

+ 5 - 0
.github/workflows/ci.yml

@@ -31,6 +31,11 @@ jobs:
       fail-fast: false
       matrix:
         include:
+          - xcode: "Xcode_26.1"
+            runsOn: macos-26
+            name: "macOS 26, Xcode 26.1, Swift 6.2.1"
+            testPlan: "macOS"
+            outputFilter: xcbeautify --renderer github-actions
           - xcode: "Xcode_26.0"
             runsOn: macos-26
             name: "macOS 26, Xcode 26.0, Swift 6.2.0"

+ 6 - 0
Alamofire.xcodeproj/project.pbxproj

@@ -2432,6 +2432,7 @@
 				PRODUCT_BUNDLE_IDENTIFIER = "org.alamofire.Alamofire-tvOSTests";
 				PRODUCT_NAME = "$(TARGET_NAME)";
 				SDKROOT = appletvos;
+				TVOS_DEPLOYMENT_TARGET = 13.0;
 			};
 			name = Debug;
 		};
@@ -2448,6 +2449,7 @@
 				PRODUCT_BUNDLE_IDENTIFIER = "org.alamofire.Alamofire-tvOSTests";
 				PRODUCT_NAME = "$(TARGET_NAME)";
 				SDKROOT = appletvos;
+				TVOS_DEPLOYMENT_TARGET = 13.0;
 			};
 			name = Release;
 		};
@@ -2722,6 +2724,7 @@
 				CODE_SIGN_STYLE = Automatic;
 				DEVELOPMENT_TEAM = "";
 				INFOPLIST_FILE = Tests/Info.plist;
+				IPHONEOS_DEPLOYMENT_TARGET = 13.0;
 				LD_RUNPATH_SEARCH_PATHS = (
 					"$(inherited)",
 					"@executable_path/Frameworks",
@@ -2741,6 +2744,7 @@
 				CODE_SIGN_STYLE = Automatic;
 				DEVELOPMENT_TEAM = "";
 				INFOPLIST_FILE = Tests/Info.plist;
+				IPHONEOS_DEPLOYMENT_TARGET = 13.0;
 				LD_RUNPATH_SEARCH_PATHS = (
 					"$(inherited)",
 					"@executable_path/Frameworks",
@@ -2763,6 +2767,7 @@
 					"@executable_path/../Frameworks",
 					"@loader_path/../Frameworks",
 				);
+				MACOSX_DEPLOYMENT_TARGET = 10.15;
 				PRODUCT_BUNDLE_IDENTIFIER = "org.alamofire.$(PRODUCT_NAME:rfc1034identifier)";
 				PRODUCT_NAME = "$(TARGET_NAME)";
 				SDKROOT = macosx;
@@ -2780,6 +2785,7 @@
 					"@executable_path/../Frameworks",
 					"@loader_path/../Frameworks",
 				);
+				MACOSX_DEPLOYMENT_TARGET = 10.15;
 				PRODUCT_BUNDLE_IDENTIFIER = "org.alamofire.$(PRODUCT_NAME:rfc1034identifier)";
 				PRODUCT_NAME = "$(TARGET_NAME)";
 				SDKROOT = macosx;

+ 3 - 3
Source/Features/OfflineRetrier.swift

@@ -28,14 +28,14 @@ import Network
 
 /// `RequestRetrier` which uses `NWPathMonitor` to detect when connectivity is restored to retry failed requests.
 @available(macOS 10.14, iOS 12, tvOS 12, watchOS 5, visionOS 1, *)
-public final class OfflineRetrier: RequestInterceptor, Sendable {
+public final class OfflineRetrier: RequestAdapter, RequestRetrier, RequestInterceptor, Sendable {
     /// Default amount of time to wait for connectivity to be restored before failure. `.seconds(5)` by default.
     public static let defaultWait: DispatchTimeInterval = .seconds(5)
-    /// Default `Set<URLError.Code>` used to check for offline errors.
+    /// Default `Set<URLError.Code>` used to check for offline errors. `[.notConnectedToInternet]` by default.
     public static let defaultURLErrorOfflineCodes: Set<URLError.Code> = [
         .notConnectedToInternet
     ]
-    /// Default method of detecting whether a paricular `any Error` means connectivity is offline.
+    /// Default method of detecting whether a particular `any Error` means connectivity is offline.
     public static let defaultIsOfflineError: @Sendable (_ error: any Error) -> Bool = { error in
         if let error = error.asAFError?.underlyingError {
             defaultIsOfflineError(error)

+ 1 - 8
Tests/OfflineRetrierTests.swift

@@ -1,4 +1,4 @@
-#if canImport(Networking)
+#if canImport(Network)
 import Dispatch
 import Testing
 
@@ -7,7 +7,6 @@ import Testing
 @Suite("OfflineRetrierTests")
 struct OfflineRetrierTests {
     @Test
-    @available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, visionOS 1, *)
     func requestIsRetriedWhenConnectivityIsRestored() async throws {
         // Given
         let didStop = Protected(false)
@@ -34,7 +33,6 @@ struct OfflineRetrierTests {
     }
 
     @Test
-    @available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, visionOS 1, *)
     func requestIsNotRetriedWhenTheErrorIsNotOfflineError() async throws {
         // Given
         let didStop = Protected(false)
@@ -61,7 +59,6 @@ struct OfflineRetrierTests {
     }
 
     @Test
-    @available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, visionOS 1, *)
     func requestIsNotRetriedWhenPathTimesOut() async throws {
         // Given
         let didStop = Protected(false)
@@ -91,7 +88,6 @@ struct OfflineRetrierTests {
     }
 
     @Test
-    @available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, visionOS 1, *)
     func sessionWideRetrierCanRetryMultipleRequests() async throws {
         // Given
         let didStop = Protected(false)
@@ -125,7 +121,6 @@ struct OfflineRetrierTests {
     }
 
     @Test
-    @available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, visionOS 1, *)
     func sessionWideRetrierCanRetryMultipleRequestsTwice() async throws {
         // Given
         let didStop = Protected(false)
@@ -171,7 +166,6 @@ struct OfflineRetrierTests {
     }
 
     @Test
-    @available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, visionOS 1, *)
     func sessionWideRetrierCanTimeOutMultipleRequests() async throws {
         // Given
         let didStop = Protected(false)
@@ -205,7 +199,6 @@ struct OfflineRetrierTests {
     }
 
     @Test
-    @available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, visionOS 1, *)
     func offlineRetrierNeverStartsOrStopsWhenImmediatelyDeinited() async throws {
         // Given
         let didStart = Protected(false)