diff --git a/.github/workflows/compatibility_tests.yml b/.github/workflows/compatibility_tests.yml index 475268e01..a9f12513a 100644 --- a/.github/workflows/compatibility_tests.yml +++ b/.github/workflows/compatibility_tests.yml @@ -13,7 +13,7 @@ jobs: fail-fast: false matrix: include: - - os: macos-13 + - os: macos-14 xcode-version: "15.2" # Swift 5.9.2 runs-on: ${{ matrix.os }} steps: diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index 553653ffb..c89659da1 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -13,8 +13,14 @@ jobs: fail-fast: false matrix: include: - - os: macos-13 - xcode-version: "15.2" # Swift 5.9.2 + - os: macos-14 + xcode-version: "15.2" # Swift 5.9.2 (minimum supported) + # TODO: drop this once the Swift 6 Sendable/Concurrency warnings + # in the schedulers and test doubles are resolved. + warnings-as-errors: "-Xswiftc -warnings-as-errors" + - os: macos-15 + xcode-version: "16.4" # Current Swift + warnings-as-errors: "" runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v4 @@ -28,7 +34,7 @@ jobs: run: | swift test \ -c debug \ - -Xswiftc -warnings-as-errors \ + ${{ matrix.warnings-as-errors }} \ --enable-code-coverage \ --build-path .build-test-debug xcrun llvm-cov show \ @@ -40,16 +46,15 @@ jobs: swift test \ -c debug \ --sanitize thread \ - -Xswiftc -warnings-as-errors \ + ${{ matrix.warnings-as-errors }} \ --build-path .build-test-debug-sanitize-thread - name: Build and run tests in release mode - if: ${{ matrix.xcode-version != '14.3.1' }} # error: no input files specified. See llvm-profdata merge -help run: | swift test \ -c release \ - -Xswiftc -warnings-as-errors \ + ${{ matrix.warnings-as-errors }} \ --enable-code-coverage \ --build-path .build-test-release - - uses: codecov/codecov-action@v3 + - uses: codecov/codecov-action@v4 with: verbose: true diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml index 19e7ceddc..6e149b4bb 100644 --- a/.github/workflows/ubuntu.yml +++ b/.github/workflows/ubuntu.yml @@ -12,22 +12,24 @@ jobs: strategy: fail-fast: false matrix: - swift_version: ["5.9.2"] - os: [ubuntu-20.04, ubuntu-22.04] include: - - os: ubuntu-20.04 - os_name: focal - - os: ubuntu-22.04 - os_name: jammy - runs-on: ${{ matrix.os }} - container: swift:${{ matrix.swift_version }}-${{ matrix.os_name }} + - swift_image: "5.9.2-jammy" # Swift 5.9.2 (minimum supported) + # TODO: drop this once the Swift 6 Sendable/Concurrency warnings + # in the schedulers and test doubles are resolved. + warnings-as-errors: "-Xswiftc -warnings-as-errors" + - swift_image: "6.1-noble" # Current Swift + warnings-as-errors: "" + runs-on: ubuntu-latest + container: swift:${{ matrix.swift_image }} steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 + - name: Swift version + run: swift --version - name: Building and running tests in debug mode with coverage run: | swift test \ -c debug \ - -Xswiftc -warnings-as-errors \ + ${{ matrix.warnings-as-errors }} \ --enable-code-coverage \ --build-path .build-test-debug llvm-cov show \ @@ -44,8 +46,8 @@ jobs: run: | swift test \ -c release \ - -Xswiftc -warnings-as-errors \ + ${{ matrix.warnings-as-errors }} \ --build-path .build-test-release - - uses: codecov/codecov-action@v3 + - uses: codecov/codecov-action@v4 with: verbose: true diff --git a/Sources/OpenCombine/CombineIdentifier.swift b/Sources/OpenCombine/CombineIdentifier.swift index 62862db3a..b004145db 100644 --- a/Sources/OpenCombine/CombineIdentifier.swift +++ b/Sources/OpenCombine/CombineIdentifier.swift @@ -6,8 +6,12 @@ // #if canImport(COpenCombineHelpers) +#if compiler(>=6.0) +internal import COpenCombineHelpers +#else @_implementationOnly import COpenCombineHelpers #endif +#endif #if os(WASI) private var __identifier: UInt64 = 0 diff --git a/Sources/OpenCombine/Helpers/Locking.swift b/Sources/OpenCombine/Helpers/Locking.swift index 3ff662fc1..bb7bf1a67 100644 --- a/Sources/OpenCombine/Helpers/Locking.swift +++ b/Sources/OpenCombine/Helpers/Locking.swift @@ -6,8 +6,12 @@ // #if canImport(COpenCombineHelpers) +#if compiler(>=6.0) +internal import COpenCombineHelpers +#else @_implementationOnly import COpenCombineHelpers #endif +#endif #if os(WASI) internal struct __UnfairLock { // swiftlint:disable:this type_name diff --git a/Sources/OpenCombine/Publishers/Publishers.Breakpoint.swift b/Sources/OpenCombine/Publishers/Publishers.Breakpoint.swift index 354555e13..11aca5500 100644 --- a/Sources/OpenCombine/Publishers/Publishers.Breakpoint.swift +++ b/Sources/OpenCombine/Publishers/Publishers.Breakpoint.swift @@ -8,8 +8,12 @@ #if !os(WASI) #if canImport(COpenCombineHelpers) +#if compiler(>=6.0) +internal import COpenCombineHelpers +#else @_implementationOnly import COpenCombineHelpers #endif +#endif extension Publisher { diff --git a/Sources/OpenCombine/Publishers/Publishers.Merge.swift b/Sources/OpenCombine/Publishers/Publishers.Merge.swift index 0a9567e3a..c5601632a 100644 --- a/Sources/OpenCombine/Publishers/Publishers.Merge.swift +++ b/Sources/OpenCombine/Publishers/Publishers.Merge.swift @@ -6,8 +6,12 @@ // Audited for 2023 Release #if canImport(COpenCombineHelpers) +#if compiler(>=6.0) +internal import COpenCombineHelpers +#else @_implementationOnly import COpenCombineHelpers #endif +#endif // MARK: - merge methods on Publisher diff --git a/Sources/OpenCombine/Publishers/Publishers.Zip.swift b/Sources/OpenCombine/Publishers/Publishers.Zip.swift index 2e3f5a7fb..b0895f2bc 100644 --- a/Sources/OpenCombine/Publishers/Publishers.Zip.swift +++ b/Sources/OpenCombine/Publishers/Publishers.Zip.swift @@ -6,8 +6,12 @@ // Audited for 2023 Release #if canImport(COpenCombineHelpers) +#if compiler(>=6.0) +internal import COpenCombineHelpers +#else @_implementationOnly import COpenCombineHelpers #endif +#endif // MARK: - zip methods on Publisher diff --git a/Sources/OpenCombineFoundation/Helpers/Locking.swift b/Sources/OpenCombineFoundation/Helpers/Locking.swift index d09bd1be5..ecb96275f 100644 --- a/Sources/OpenCombineFoundation/Helpers/Locking.swift +++ b/Sources/OpenCombineFoundation/Helpers/Locking.swift @@ -6,8 +6,12 @@ // #if canImport(COpenCombineHelpers) +#if compiler(>=6.0) +internal import COpenCombineHelpers +#else @_implementationOnly import COpenCombineHelpers #endif +#endif import OpenCombine diff --git a/Sources/OpenCombineFoundation/OperationQueue+Scheduler.swift b/Sources/OpenCombineFoundation/OperationQueue+Scheduler.swift index b9a07697a..8668663fb 100644 --- a/Sources/OpenCombineFoundation/OperationQueue+Scheduler.swift +++ b/Sources/OpenCombineFoundation/OperationQueue+Scheduler.swift @@ -157,7 +157,7 @@ extension OperationQueue { public struct SchedulerOptions { } - private final class DelayReadyOperation: Operation, Cancellable { + private final class DelayReadyOperation: Operation, Cancellable, @unchecked Sendable { fileprivate final class CancellationContext: Cancellable { let lock = UnfairLock.allocate() diff --git a/Tests/OpenCombineTests/FoundationTests/NotificationCenterTests.swift b/Tests/OpenCombineTests/FoundationTests/NotificationCenterTests.swift index 9b90b1fe7..46913c853 100644 --- a/Tests/OpenCombineTests/FoundationTests/NotificationCenterTests.swift +++ b/Tests/OpenCombineTests/FoundationTests/NotificationCenterTests.swift @@ -476,7 +476,7 @@ private func makePublisher( /// A simple mock notification center that always sends notifications to **all** /// observers in non-thread safe manner. -private final class TestNotificationCenter: NotificationCenter { +private final class TestNotificationCenter: NotificationCenter, @unchecked Sendable { enum Event { case postNotificationWithName(Notification.Name, Any?, [AnyHashable : Any]?) diff --git a/Tests/OpenCombineTests/FoundationTests/OperationQueueSchedulerTests.swift b/Tests/OpenCombineTests/FoundationTests/OperationQueueSchedulerTests.swift index 50e478884..a4b91adad 100644 --- a/Tests/OpenCombineTests/FoundationTests/OperationQueueSchedulerTests.swift +++ b/Tests/OpenCombineTests/FoundationTests/OperationQueueSchedulerTests.swift @@ -332,7 +332,7 @@ extension OperationQueueScheduler.SchedulerTimeType: DateBackedSchedulerTimeType @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) extension OperationQueueScheduler: RunLoopLikeScheduler {} -private final class TestOperationQueue: OperationQueue { +private final class TestOperationQueue: OperationQueue, @unchecked Sendable { enum Event { case progress diff --git a/Tests/OpenCombineTests/FoundationTests/URLSessionTests.swift b/Tests/OpenCombineTests/FoundationTests/URLSessionTests.swift index 2a6fe2929..d73c365f8 100644 --- a/Tests/OpenCombineTests/FoundationTests/URLSessionTests.swift +++ b/Tests/OpenCombineTests/FoundationTests/URLSessionTests.swift @@ -247,7 +247,7 @@ final class URLSessionTests: XCTestCase { /// A simple mock URLSession that records its history and allows executing /// callbacks synchronously -private class TestURLSession: URLSession { +private class TestURLSession: URLSession, @unchecked Sendable { enum Event: Equatable { case delegateQueue @@ -527,7 +527,7 @@ private class TestURLSession: URLSession { #endif // canImport(Darwin) && !os(watchOS) } -private final class TestURLSessionDataTask: URLSessionDataTask { +private final class TestURLSessionDataTask: URLSessionDataTask, @unchecked Sendable { enum Event: Equatable { case taskIdentifier diff --git a/Tests/OpenCombineTests/Helpers/AssertCrashes.swift b/Tests/OpenCombineTests/Helpers/AssertCrashes.swift index a624bec86..bbe89f31e 100644 --- a/Tests/OpenCombineTests/Helpers/AssertCrashes.swift +++ b/Tests/OpenCombineTests/Helpers/AssertCrashes.swift @@ -9,8 +9,12 @@ import Foundation import XCTest #if canImport(COpenCombineHelpers) +#if compiler(>=6.0) +internal import COpenCombineHelpers +#else @_implementationOnly import COpenCombineHelpers #endif +#endif extension XCTest { diff --git a/Tests/OpenCombineTests/ObservableObjectTests.swift b/Tests/OpenCombineTests/ObservableObjectTests.swift index bc2d0c73b..4f613f973 100644 --- a/Tests/OpenCombineTests/ObservableObjectTests.swift +++ b/Tests/OpenCombineTests/ObservableObjectTests.swift @@ -343,13 +343,13 @@ private final class ObjCClassSubclass: NSObject, ObservableObject { } @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) -private class ResilientClassSubclass: JSONDecoder, ObservableObject { +private class ResilientClassSubclass: JSONDecoder, ObservableObject, @unchecked Sendable { @Published var published0 = 10 @Published var published1 = "hello!" } @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) -private final class ResilientClassSubclass2: ResilientClassSubclass { +private final class ResilientClassSubclass2: ResilientClassSubclass, @unchecked Sendable { @Published var published3 = true } @@ -388,7 +388,8 @@ private class NSObjectSubclass: NSObject, ObservableObject { @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) private class ResilientClassGenericSubclass : JSONDecoder, - ObservableObject + ObservableObject, + @unchecked Sendable { @Published var value1: Value1 @Published var value2: Value2 @@ -401,7 +402,7 @@ private class ResilientClassGenericSubclass @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) private final class ResilientClassGenericSubclass2 - : ResilientClassGenericSubclass + : ResilientClassGenericSubclass, @unchecked Sendable { @Published var value3 = false } diff --git a/Tests/OpenCombineTests/PublisherTests/CatchTests.swift b/Tests/OpenCombineTests/PublisherTests/CatchTests.swift index 62dba547b..5d641a807 100644 --- a/Tests/OpenCombineTests/PublisherTests/CatchTests.swift +++ b/Tests/OpenCombineTests/PublisherTests/CatchTests.swift @@ -8,8 +8,12 @@ import XCTest #if canImport(COpenCombineHelpers) +#if compiler(>=6.0) +internal import COpenCombineHelpers +#else @_implementationOnly import COpenCombineHelpers #endif +#endif #if OPENCOMBINE_COMPATIBILITY_TEST import Combine