From 2c5307c0c9a64669cce889a224c22ae42a671678 Mon Sep 17 00:00:00 2001 From: Guilherme Souza Date: Mon, 13 Jan 2025 07:59:53 -0300 Subject: [PATCH 01/14] ci: add job for xcode 15.2 --- .github/workflows/ci.yml | 49 +++++++++++++++++++++----------- Sources/Realtime/V2/PushV2.swift | 4 +-- 2 files changed, 35 insertions(+), 18 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cf7524ce..1def3ae1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,27 +14,29 @@ concurrency: cancel-in-progress: true jobs: - xcodebuild: + xcodebuild-latest: + name: xcodebuild (16) runs-on: macos-15 strategy: matrix: command: [test, ""] - platform: [IOS, MAC_CATALYST, MACOS, TVOS, VISIONOS, WATCHOS] - exclude: - - { platform: VISIONOS } - include: - - { command: test, skip_release: 1 } + platform: [IOS, MACOS] + xcode: ["16.0"] steps: - uses: actions/checkout@v4 + - name: Select Xcode ${{ matrix.xcode }} + run: sudo xcode-select -s /Applications/Xcode_${{ matrix.xcode }}.app + - name: List available devices + run: xcrun simctl list devices available - name: Cache derived data uses: actions/cache@v3 with: path: | ~/.derivedData key: | - deriveddata-xcodebuild-${{ matrix.platform }}-${{ matrix.command }}-${{ hashFiles('**/Sources/**/*.swift', '**/Tests/**/*.swift') }} + deriveddata-xcodebuild-${{ matrix.platform }}-${{ matrix.xcode }}-${{ matrix.command }}-${{ hashFiles('**/Sources/**/*.swift', '**/Tests/**/*.swift') }} restore-keys: | - deriveddata-xcodebuild-${{ matrix.platform }}-${{ matrix.command }}- + deriveddata-xcodebuild-${{ matrix.platform }}-${{ matrix.xcode }}-${{ matrix.command }}- - name: Set IgnoreFileSystemDeviceInodeChanges flag run: defaults write com.apple.dt.XCBuild IgnoreFileSystemDeviceInodeChanges -bool YES - name: Update mtime for incremental builds @@ -42,31 +44,46 @@ jobs: - run: make dot-env - name: Debug run: make XCODEBUILD_ARGUMENT="${{ matrix.command }}" CONFIG=Debug PLATFORM="${{ matrix.platform }}" xcodebuild - - name: Release - if: matrix.skip_release != '1' - run: make XCODEBUILD_ARGUMENT="${{ matrix.command }}" CONFIG=Release PLATFORM="${{ matrix.platform }}" xcodebuild - xcodebuild-macOS-14: + xcodebuild: + name: xcodebuild (15) runs-on: macos-14 strategy: matrix: command: [test, ""] platform: [IOS, MAC_CATALYST, MACOS, TVOS, VISIONOS, WATCHOS] + xcode: [15.2, 15.4] exclude: - - { platform: VISIONOS } + - {xcode: 15.2, command: test} + - {xcode: 15.4, command: ''} + - {xcode: 15.2, platform: MAC_CATALYST} + - {xcode: 15.2, platform: TVOS} + - {xcode: 15.2, platform: VISIONOS} + - {xcode: 15.2, platform: WATCHOS} include: - - { command: test, skip_release: 1 } + - {xcode: 15.2, skip_release: 1} steps: - uses: actions/checkout@v4 + - name: Select Xcode ${{ matrix.xcode }} + run: sudo xcode-select -s /Applications/Xcode_${{ matrix.xcode }}.app + - name: Install visionOS runtime + if: matrix.platform == 'visionOS' + run: | + sudo xcodebuild -runFirstLaunch + sudo xcrun simctl list + sudo xcodebuild -downloadPlatform visionOS + sudo xcodebuild -runFirstLaunch + - name: List available devices + run: xcrun simctl list devices available - name: Cache derived data uses: actions/cache@v3 with: path: | ~/.derivedData key: | - deriveddata-xcodebuild-${{ matrix.platform }}-${{ matrix.command }}-${{ hashFiles('**/Sources/**/*.swift', '**/Tests/**/*.swift') }} + deriveddata-xcodebuild-${{ matrix.platform }}-${{ matrix.xcode }}-${{ matrix.command }}-${{ hashFiles('**/Sources/**/*.swift', '**/Tests/**/*.swift') }} restore-keys: | - deriveddata-xcodebuild-${{ matrix.platform }}-${{ matrix.command }}- + deriveddata-xcodebuild-${{ matrix.platform }}-${{ matrix.xcode }}-${{ matrix.command }}- - name: Set IgnoreFileSystemDeviceInodeChanges flag run: defaults write com.apple.dt.XCBuild IgnoreFileSystemDeviceInodeChanges -bool YES - name: Update mtime for incremental builds diff --git a/Sources/Realtime/V2/PushV2.swift b/Sources/Realtime/V2/PushV2.swift index 884fc981..199e6b74 100644 --- a/Sources/Realtime/V2/PushV2.swift +++ b/Sources/Realtime/V2/PushV2.swift @@ -31,7 +31,7 @@ actor PushV2 { return .error } - channel.socket.push(message) + await channel.socket.push(message) if !channel.config.broadcast.acknowledgeBroadcasts { // channel was configured with `ack = false`, @@ -40,7 +40,7 @@ actor PushV2 { } do { - return try await withTimeout(interval: channel.socket.options.timeoutInterval) { + return try await withTimeout(interval: channel.socket.options().timeoutInterval) { await withCheckedContinuation { continuation in self.receivedContinuation = continuation } From c2992cc16be6536fa8b6bf6c72ff04405fc60f95 Mon Sep 17 00:00:00 2001 From: Guilherme Souza Date: Mon, 13 Jan 2025 08:03:34 -0300 Subject: [PATCH 02/14] remove unsafe --- Sources/Realtime/WebSocket/URLSessionWebSocket.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Sources/Realtime/WebSocket/URLSessionWebSocket.swift b/Sources/Realtime/WebSocket/URLSessionWebSocket.swift index 61bafc70..bce22afc 100644 --- a/Sources/Realtime/WebSocket/URLSessionWebSocket.swift +++ b/Sources/Realtime/WebSocket/URLSessionWebSocket.swift @@ -34,8 +34,8 @@ final class URLSessionWebSocket: WebSocket { } // It is safe to use `nonisolated(unsafe)` because all completion handlers runs on the same queue. - nonisolated(unsafe) var continuation: CheckedContinuation! - nonisolated(unsafe) var webSocket: URLSessionWebSocket? + nonisolated var continuation: CheckedContinuation! + nonisolated var webSocket: URLSessionWebSocket? let session = URLSession.sessionWithConfiguration( configuration ?? .default, From b7d953de0af53be6bb9ba827fd8973780b6f3185 Mon Sep 17 00:00:00 2001 From: Guilherme Souza Date: Mon, 13 Jan 2025 08:14:58 -0300 Subject: [PATCH 03/14] wip --- Sources/Realtime/V2/PushV2.swift | 4 ++-- Sources/Realtime/WebSocket/URLSessionWebSocket.swift | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Sources/Realtime/V2/PushV2.swift b/Sources/Realtime/V2/PushV2.swift index 199e6b74..884fc981 100644 --- a/Sources/Realtime/V2/PushV2.swift +++ b/Sources/Realtime/V2/PushV2.swift @@ -31,7 +31,7 @@ actor PushV2 { return .error } - await channel.socket.push(message) + channel.socket.push(message) if !channel.config.broadcast.acknowledgeBroadcasts { // channel was configured with `ack = false`, @@ -40,7 +40,7 @@ actor PushV2 { } do { - return try await withTimeout(interval: channel.socket.options().timeoutInterval) { + return try await withTimeout(interval: channel.socket.options.timeoutInterval) { await withCheckedContinuation { continuation in self.receivedContinuation = continuation } diff --git a/Sources/Realtime/WebSocket/URLSessionWebSocket.swift b/Sources/Realtime/WebSocket/URLSessionWebSocket.swift index bce22afc..61bafc70 100644 --- a/Sources/Realtime/WebSocket/URLSessionWebSocket.swift +++ b/Sources/Realtime/WebSocket/URLSessionWebSocket.swift @@ -34,8 +34,8 @@ final class URLSessionWebSocket: WebSocket { } // It is safe to use `nonisolated(unsafe)` because all completion handlers runs on the same queue. - nonisolated var continuation: CheckedContinuation! - nonisolated var webSocket: URLSessionWebSocket? + nonisolated(unsafe) var continuation: CheckedContinuation! + nonisolated(unsafe) var webSocket: URLSessionWebSocket? let session = URLSession.sessionWithConfiguration( configuration ?? .default, From 634fbaa8ccc7b39a08ec547d4c1f6d58f29305b2 Mon Sep 17 00:00:00 2001 From: Guilherme Souza Date: Mon, 13 Jan 2025 08:21:27 -0300 Subject: [PATCH 04/14] remove nonisolated(unsafe) --- Sources/Helpers/_Clock.swift | 20 ++++-- .../WebSocket/URLSessionWebSocket.swift | 66 +++++++++++-------- 2 files changed, 54 insertions(+), 32 deletions(-) diff --git a/Sources/Helpers/_Clock.swift b/Sources/Helpers/_Clock.swift index d4ed2e8a..765565e1 100644 --- a/Sources/Helpers/_Clock.swift +++ b/Sources/Helpers/_Clock.swift @@ -6,6 +6,7 @@ // import Clocks +import ConcurrencyExtras import Foundation package protocol _Clock: Sendable { @@ -41,12 +42,19 @@ let _resolveClock: @Sendable () -> any _Clock = { } } -// For overriding clock on tests, we use a mutable _clock in DEBUG builds. -// nonisolated(unsafe) is safe to use if making sure we assign _clock once in test set up. -// -// _clock is read-only in RELEASE builds. +private let __clock = LockIsolated(_resolveClock()) + #if DEBUG - nonisolated(unsafe) package var _clock = _resolveClock() + package var _clock: any _Clock { + get { + __clock.value + } + set { + __clock.setValue(newValue) + } + } #else - package let _clock = _resolveClock() + package var _clock: any _Clock { + __clock.value + } #endif diff --git a/Sources/Realtime/WebSocket/URLSessionWebSocket.swift b/Sources/Realtime/WebSocket/URLSessionWebSocket.swift index 61bafc70..e9a7cc9e 100644 --- a/Sources/Realtime/WebSocket/URLSessionWebSocket.swift +++ b/Sources/Realtime/WebSocket/URLSessionWebSocket.swift @@ -33,45 +33,59 @@ final class URLSessionWebSocket: WebSocket { preconditionFailure("only ws: and wss: schemes are supported") } - // It is safe to use `nonisolated(unsafe)` because all completion handlers runs on the same queue. - nonisolated(unsafe) var continuation: CheckedContinuation! - nonisolated(unsafe) var webSocket: URLSessionWebSocket? + struct MutableState { + var continuation: CheckedContinuation! + var webSocket: URLSessionWebSocket? + } + + let mutableState = LockIsolated(MutableState()) let session = URLSession.sessionWithConfiguration( configuration ?? .default, onComplete: { session, task, error in - if let webSocket { - // There are three possibilities here: - // 1. the peer sent a close Frame, `onWebSocketTaskClosed` was already - // called and `_connectionClosed` is a no-op. - // 2. we sent a close Frame (through `close()`) and `_connectionClosed` - // is a no-op. - // 3. an error occurred (e.g. network failure) and `_connectionClosed` - // will signal that and close `event`. - webSocket._connectionClosed( - code: 1006, reason: Data("abnormal close".utf8)) - } else if let error { - continuation.resume( - throwing: WebSocketError.connection( - message: "connection ended unexpectedly", error: error)) - } else { - // `onWebSocketTaskOpened` should have been called and resumed continuation. - // So either there was an error creating the connection or a logic error. - assertionFailure("expected an error or `onWebSocketTaskOpened` to have been called first") + mutableState.withValue { + if let webSocket = $0.webSocket { + // There are three possibilities here: + // 1. the peer sent a close Frame, `onWebSocketTaskClosed` was already + // called and `_connectionClosed` is a no-op. + // 2. we sent a close Frame (through `close()`) and `_connectionClosed` + // is a no-op. + // 3. an error occurred (e.g. network failure) and `_connectionClosed` + // will signal that and close `event`. + webSocket._connectionClosed( + code: 1006, reason: Data("abnormal close".utf8)) + } else if let error { + $0.continuation.resume( + throwing: WebSocketError.connection( + message: "connection ended unexpectedly", error: error)) + } else { + // `onWebSocketTaskOpened` should have been called and resumed continuation. + // So either there was an error creating the connection or a logic error. + assertionFailure( + "expected an error or `onWebSocketTaskOpened` to have been called first") + } } }, onWebSocketTaskOpened: { session, task, `protocol` in - webSocket = URLSessionWebSocket(_task: task, _protocol: `protocol` ?? "") - continuation.resume(returning: webSocket!) + mutableState.withValue { + $0.webSocket = URLSessionWebSocket(_task: task, _protocol: `protocol` ?? "") + $0.continuation.resume(returning: $0.webSocket!) + } }, onWebSocketTaskClosed: { session, task, code, reason in - assert(webSocket != nil, "connection should exist by this time") - webSocket!._connectionClosed(code: code, reason: reason) + mutableState.withValue { + assert($0.webSocket != nil, "connection should exist by this time") + $0.webSocket!._connectionClosed(code: code, reason: reason) + } } ) session.webSocketTask(with: url, protocols: protocols ?? []).resume() - return try await withCheckedThrowingContinuation { continuation = $0 } + return try await withCheckedThrowingContinuation { continuation in + mutableState.withValue { + $0.continuation = continuation + } + } } let _task: URLSessionWebSocketTask From 447c8079ea7c5b2442a917f753ad6f48f095bda8 Mon Sep 17 00:00:00 2001 From: Guilherme Souza Date: Mon, 13 Jan 2025 13:37:45 -0300 Subject: [PATCH 05/14] remove testable --- Package.resolved | 9 +++++++++ Sources/Helpers/EventEmitter.swift | 2 +- Tests/AuthTests/AuthClientTests.swift | 2 +- Tests/HelpersTests/AnyJSONTests.swift | 2 +- Tests/HelpersTests/EventEmitterTests.swift | 2 +- Tests/HelpersTests/JWTTests.swift | 2 +- Tests/HelpersTests/ObservationTokenTests.swift | 2 +- 7 files changed, 15 insertions(+), 6 deletions(-) diff --git a/Package.resolved b/Package.resolved index aae76928..3c3c681f 100644 --- a/Package.resolved +++ b/Package.resolved @@ -9,6 +9,15 @@ "version" : "1.3.0" } }, + { + "identity" : "swift-clocks", + "kind" : "remoteSourceControl", + "location" : "https://github.com/pointfreeco/swift-clocks", + "state" : { + "revision" : "cc46202b53476d64e824e0b6612da09d84ffde8e", + "version" : "1.0.6" + } + }, { "identity" : "swift-concurrency-extras", "kind" : "remoteSourceControl", diff --git a/Sources/Helpers/EventEmitter.swift b/Sources/Helpers/EventEmitter.swift index 99ad965f..63d07d97 100644 --- a/Sources/Helpers/EventEmitter.swift +++ b/Sources/Helpers/EventEmitter.swift @@ -70,7 +70,7 @@ package final class EventEmitter: Sendable { /// The last event emitted by this Emiter, or the initial event. package var lastEvent: Event { mutableState.lastEvent } - let emitsLastEventWhenAttaching: Bool + package let emitsLastEventWhenAttaching: Bool package init( initialEvent event: Event, diff --git a/Tests/AuthTests/AuthClientTests.swift b/Tests/AuthTests/AuthClientTests.swift index 17905696..4f154438 100644 --- a/Tests/AuthTests/AuthClientTests.swift +++ b/Tests/AuthTests/AuthClientTests.swift @@ -7,12 +7,12 @@ import ConcurrencyExtras import CustomDump +import Helpers import InlineSnapshotTesting import TestHelpers import XCTest @testable import Auth -@testable import Helpers #if canImport(FoundationNetworking) import FoundationNetworking diff --git a/Tests/HelpersTests/AnyJSONTests.swift b/Tests/HelpersTests/AnyJSONTests.swift index 2c2197a1..e486cf7e 100644 --- a/Tests/HelpersTests/AnyJSONTests.swift +++ b/Tests/HelpersTests/AnyJSONTests.swift @@ -9,7 +9,7 @@ import CustomDump import Foundation import XCTest -@testable import Helpers +import Helpers final class AnyJSONTests: XCTestCase { let jsonString = """ diff --git a/Tests/HelpersTests/EventEmitterTests.swift b/Tests/HelpersTests/EventEmitterTests.swift index 869b6090..f673a5a8 100644 --- a/Tests/HelpersTests/EventEmitterTests.swift +++ b/Tests/HelpersTests/EventEmitterTests.swift @@ -8,7 +8,7 @@ import ConcurrencyExtras import XCTest -@testable import Helpers +import Helpers final class EventEmitterTests: XCTestCase { diff --git a/Tests/HelpersTests/JWTTests.swift b/Tests/HelpersTests/JWTTests.swift index 9e8161b9..e1fdeece 100644 --- a/Tests/HelpersTests/JWTTests.swift +++ b/Tests/HelpersTests/JWTTests.swift @@ -1,6 +1,6 @@ import XCTest -@testable import Helpers +import Helpers final class JWTTests: XCTestCase { func testDecodeJWT() throws { diff --git a/Tests/HelpersTests/ObservationTokenTests.swift b/Tests/HelpersTests/ObservationTokenTests.swift index 16eec655..6ff6ce52 100644 --- a/Tests/HelpersTests/ObservationTokenTests.swift +++ b/Tests/HelpersTests/ObservationTokenTests.swift @@ -7,7 +7,7 @@ import ConcurrencyExtras import Foundation -@testable import Helpers +import Helpers import XCTest final class ObservationTokenTests: XCTestCase { From edd84ae5e7548944976fe3fea4a685d96d927c0f Mon Sep 17 00:00:00 2001 From: Guilherme Souza Date: Tue, 14 Jan 2025 08:47:57 -0300 Subject: [PATCH 06/14] use test and remove testplans --- .swiftpm/configuration/Package.resolved | 68 --------- .../contents.xcworkspacedata | 7 - .../xcshareddata/xcschemes/Supabase.xcscheme | 77 ---------- Supabase.xcworkspace/contents.xcworkspacedata | 28 ---- .../xcshareddata/xcschemes/Auth.xcscheme | 8 +- .../xcshareddata/xcschemes/Functions.xcscheme | 8 +- .../xcshareddata/xcschemes/PostgREST.xcscheme | 8 +- .../xcshareddata/xcschemes/Realtime.xcscheme | 8 +- .../xcshareddata/xcschemes/Storage.xcscheme | 8 +- .../xcshareddata/xcschemes/Supabase.xcscheme | 138 ++++++++++++++++++ TestPlans/AllTests.xctestplan | 66 --------- TestPlans/Auth.xctestplan | 24 --- TestPlans/Functions.xctestplan | 23 --- TestPlans/Integration.xctestplan | 24 --- TestPlans/PostgREST.xctestplan | 24 --- TestPlans/Realtime.xctestplan | 24 --- TestPlans/Storage.xctestplan | 24 --- TestPlans/Supabase.xctestplan | 66 --------- 18 files changed, 148 insertions(+), 485 deletions(-) delete mode 100644 .swiftpm/configuration/Package.resolved delete mode 100644 .swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata delete mode 100644 .swiftpm/xcode/xcshareddata/xcschemes/Supabase.xcscheme rename {.swiftpm/xcode => Supabase.xcworkspace}/xcshareddata/xcschemes/Auth.xcscheme (92%) rename {.swiftpm/xcode => Supabase.xcworkspace}/xcshareddata/xcschemes/Functions.xcscheme (92%) rename {.swiftpm/xcode => Supabase.xcworkspace}/xcshareddata/xcschemes/PostgREST.xcscheme (92%) rename {.swiftpm/xcode => Supabase.xcworkspace}/xcshareddata/xcschemes/Realtime.xcscheme (92%) rename {.swiftpm/xcode => Supabase.xcworkspace}/xcshareddata/xcschemes/Storage.xcscheme (92%) create mode 100644 Supabase.xcworkspace/xcshareddata/xcschemes/Supabase.xcscheme delete mode 100644 TestPlans/AllTests.xctestplan delete mode 100644 TestPlans/Auth.xctestplan delete mode 100644 TestPlans/Functions.xctestplan delete mode 100644 TestPlans/Integration.xctestplan delete mode 100644 TestPlans/PostgREST.xctestplan delete mode 100644 TestPlans/Realtime.xctestplan delete mode 100644 TestPlans/Storage.xctestplan delete mode 100644 TestPlans/Supabase.xctestplan diff --git a/.swiftpm/configuration/Package.resolved b/.swiftpm/configuration/Package.resolved deleted file mode 100644 index 5fbb0348..00000000 --- a/.swiftpm/configuration/Package.resolved +++ /dev/null @@ -1,68 +0,0 @@ -{ - "pins" : [ - { - "identity" : "multipartformdata", - "kind" : "remoteSourceControl", - "location" : "https://github.com/grdsdev/MultipartFormData", - "state" : { - "revision" : "ed7abea9cfc6c3b5e77a73fe6842c57a372d2017", - "version" : "0.1.0" - } - }, - { - "identity" : "swift-concurrency-extras", - "kind" : "remoteSourceControl", - "location" : "https://github.com/pointfreeco/swift-concurrency-extras", - "state" : { - "revision" : "bb5059bde9022d69ac516803f4f227d8ac967f71", - "version" : "1.1.0" - } - }, - { - "identity" : "swift-crypto", - "kind" : "remoteSourceControl", - "location" : "https://github.com/apple/swift-crypto.git", - "state" : { - "revision" : "bc1c29221f6dfeb0ebbfbc98eb95cd3d4967868e", - "version" : "3.4.0" - } - }, - { - "identity" : "swift-custom-dump", - "kind" : "remoteSourceControl", - "location" : "https://github.com/pointfreeco/swift-custom-dump", - "state" : { - "revision" : "aec6a73f5c1dc1f1be4f61888094b95cf995d973", - "version" : "1.3.2" - } - }, - { - "identity" : "swift-snapshot-testing", - "kind" : "remoteSourceControl", - "location" : "https://github.com/pointfreeco/swift-snapshot-testing", - "state" : { - "revision" : "c097f955b4e724690f0fc8ffb7a6d4b881c9c4e3", - "version" : "1.17.2" - } - }, - { - "identity" : "swift-syntax", - "kind" : "remoteSourceControl", - "location" : "https://github.com/swiftlang/swift-syntax", - "state" : { - "revision" : "303e5c5c36d6a558407d364878df131c3546fad8", - "version" : "510.0.2" - } - }, - { - "identity" : "xctest-dynamic-overlay", - "kind" : "remoteSourceControl", - "location" : "https://github.com/pointfreeco/xctest-dynamic-overlay", - "state" : { - "revision" : "357ca1e5dd31f613a1d43320870ebc219386a495", - "version" : "1.2.2" - } - } - ], - "version" : 2 -} diff --git a/.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata b/.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata deleted file mode 100644 index 919434a6..00000000 --- a/.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata +++ /dev/null @@ -1,7 +0,0 @@ - - - - - diff --git a/.swiftpm/xcode/xcshareddata/xcschemes/Supabase.xcscheme b/.swiftpm/xcode/xcshareddata/xcschemes/Supabase.xcscheme deleted file mode 100644 index 73d8b0ca..00000000 --- a/.swiftpm/xcode/xcshareddata/xcschemes/Supabase.xcscheme +++ /dev/null @@ -1,77 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Supabase.xcworkspace/contents.xcworkspacedata b/Supabase.xcworkspace/contents.xcworkspacedata index 74de040b..d6fe7ad5 100644 --- a/Supabase.xcworkspace/contents.xcworkspacedata +++ b/Supabase.xcworkspace/contents.xcworkspacedata @@ -7,32 +7,4 @@ - - - - - - - - - - - - - - - - - - diff --git a/.swiftpm/xcode/xcshareddata/xcschemes/Auth.xcscheme b/Supabase.xcworkspace/xcshareddata/xcschemes/Auth.xcscheme similarity index 92% rename from .swiftpm/xcode/xcshareddata/xcschemes/Auth.xcscheme rename to Supabase.xcworkspace/xcshareddata/xcschemes/Auth.xcscheme index d8bbe65b..ba0e25dc 100644 --- a/.swiftpm/xcode/xcshareddata/xcschemes/Auth.xcscheme +++ b/Supabase.xcworkspace/xcshareddata/xcschemes/Auth.xcscheme @@ -28,12 +28,8 @@ selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" shouldUseLaunchSchemeArgsEnv = "YES"> - - - - + + - - - - + + - - - - + + - - - - + + - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/TestPlans/AllTests.xctestplan b/TestPlans/AllTests.xctestplan deleted file mode 100644 index bb36d65c..00000000 --- a/TestPlans/AllTests.xctestplan +++ /dev/null @@ -1,66 +0,0 @@ -{ - "configurations" : [ - { - "id" : "5F632059-FF26-463E-B598-A1902519AB3F", - "name" : "Configuration 1", - "options" : { - - } - } - ], - "defaultOptions" : { - - }, - "testTargets" : [ - { - "target" : { - "containerPath" : "container:", - "identifier" : "FunctionsTests", - "name" : "FunctionsTests" - } - }, - { - "target" : { - "containerPath" : "container:", - "identifier" : "PostgRESTTests", - "name" : "PostgRESTTests" - } - }, - { - "target" : { - "containerPath" : "container:", - "identifier" : "RealtimeTests", - "name" : "RealtimeTests" - } - }, - { - "target" : { - "containerPath" : "container:", - "identifier" : "StorageTests", - "name" : "StorageTests" - } - }, - { - "target" : { - "containerPath" : "container:", - "identifier" : "SupabaseTests", - "name" : "SupabaseTests" - } - }, - { - "target" : { - "containerPath" : "container:", - "identifier" : "AuthTests", - "name" : "AuthTests" - } - }, - { - "target" : { - "containerPath" : "container:", - "identifier" : "HelpersTests", - "name" : "HelpersTests" - } - } - ], - "version" : 1 -} diff --git a/TestPlans/Auth.xctestplan b/TestPlans/Auth.xctestplan deleted file mode 100644 index be833ec2..00000000 --- a/TestPlans/Auth.xctestplan +++ /dev/null @@ -1,24 +0,0 @@ -{ - "configurations" : [ - { - "id" : "CB7AE2C5-B36E-4571-9927-9EE60FC5BB1A", - "name" : "Test Scheme Action", - "options" : { - - } - } - ], - "defaultOptions" : { - "codeCoverage" : false - }, - "testTargets" : [ - { - "target" : { - "containerPath" : "container:", - "identifier" : "AuthTests", - "name" : "AuthTests" - } - } - ], - "version" : 1 -} diff --git a/TestPlans/Functions.xctestplan b/TestPlans/Functions.xctestplan deleted file mode 100644 index eb0bb4ab..00000000 --- a/TestPlans/Functions.xctestplan +++ /dev/null @@ -1,23 +0,0 @@ -{ - "configurations" : [ - { - "id" : "C2968060-7062-4A69-B936-4DF46F4A933D", - "name" : "Test Scheme Action", - "options" : { - - } - } - ], - "defaultOptions" : { - }, - "testTargets" : [ - { - "target" : { - "containerPath" : "container:", - "identifier" : "FunctionsTests", - "name" : "FunctionsTests" - } - } - ], - "version" : 1 -} diff --git a/TestPlans/Integration.xctestplan b/TestPlans/Integration.xctestplan deleted file mode 100644 index e7ce2dbe..00000000 --- a/TestPlans/Integration.xctestplan +++ /dev/null @@ -1,24 +0,0 @@ -{ - "configurations" : [ - { - "id" : "EFD3DB79-4307-4515-8158-5E17BF4577D4", - "name" : "Configuration 1", - "options" : { - - } - } - ], - "defaultOptions" : { - - }, - "testTargets" : [ - { - "target" : { - "containerPath" : "container:", - "identifier" : "IntegrationTests", - "name" : "IntegrationTests" - } - } - ], - "version" : 1 -} diff --git a/TestPlans/PostgREST.xctestplan b/TestPlans/PostgREST.xctestplan deleted file mode 100644 index efcfbfcd..00000000 --- a/TestPlans/PostgREST.xctestplan +++ /dev/null @@ -1,24 +0,0 @@ -{ - "configurations" : [ - { - "id" : "B9D59B72-C47A-432C-80B7-898C5D95FC0D", - "name" : "Configuration 1", - "options" : { - - } - } - ], - "defaultOptions" : { - - }, - "testTargets" : [ - { - "target" : { - "containerPath" : "container:", - "identifier" : "PostgRESTTests", - "name" : "PostgRESTTests" - } - } - ], - "version" : 1 -} diff --git a/TestPlans/Realtime.xctestplan b/TestPlans/Realtime.xctestplan deleted file mode 100644 index a4102cb9..00000000 --- a/TestPlans/Realtime.xctestplan +++ /dev/null @@ -1,24 +0,0 @@ -{ - "configurations" : [ - { - "id" : "6C13CD34-2158-4CD9-A3C5-F634B9026E15", - "name" : "Configuration 1", - "options" : { - - } - } - ], - "defaultOptions" : { - - }, - "testTargets" : [ - { - "target" : { - "containerPath" : "container:", - "identifier" : "RealtimeTests", - "name" : "RealtimeTests" - } - } - ], - "version" : 1 -} diff --git a/TestPlans/Storage.xctestplan b/TestPlans/Storage.xctestplan deleted file mode 100644 index d821caea..00000000 --- a/TestPlans/Storage.xctestplan +++ /dev/null @@ -1,24 +0,0 @@ -{ - "configurations" : [ - { - "id" : "79A4DDA5-0CB7-40BC-A6AF-39E351546C2B", - "name" : "Configuration 1", - "options" : { - - } - } - ], - "defaultOptions" : { - - }, - "testTargets" : [ - { - "target" : { - "containerPath" : "container:", - "identifier" : "StorageTests", - "name" : "StorageTests" - } - } - ], - "version" : 1 -} diff --git a/TestPlans/Supabase.xctestplan b/TestPlans/Supabase.xctestplan deleted file mode 100644 index 7479acbf..00000000 --- a/TestPlans/Supabase.xctestplan +++ /dev/null @@ -1,66 +0,0 @@ -{ - "configurations" : [ - { - "id" : "45505B3F-281D-4398-B92C-A63746C756E0", - "name" : "Configuration 1", - "options" : { - - } - } - ], - "defaultOptions" : { - - }, - "testTargets" : [ - { - "target" : { - "containerPath" : "container:", - "identifier" : "AuthTests", - "name" : "AuthTests" - } - }, - { - "target" : { - "containerPath" : "container:", - "identifier" : "HelpersTests", - "name" : "HelpersTests" - } - }, - { - "target" : { - "containerPath" : "container:", - "identifier" : "SupabaseTests", - "name" : "SupabaseTests" - } - }, - { - "target" : { - "containerPath" : "container:", - "identifier" : "StorageTests", - "name" : "StorageTests" - } - }, - { - "target" : { - "containerPath" : "container:", - "identifier" : "PostgRESTTests", - "name" : "PostgRESTTests" - } - }, - { - "target" : { - "containerPath" : "container:", - "identifier" : "FunctionsTests", - "name" : "FunctionsTests" - } - }, - { - "target" : { - "containerPath" : "container:", - "identifier" : "RealtimeTests", - "name" : "RealtimeTests" - } - } - ], - "version" : 1 -} From d16e66160215200164bc782a977885441631a908 Mon Sep 17 00:00:00 2001 From: Guilherme Souza Date: Tue, 14 Jan 2025 10:34:05 -0300 Subject: [PATCH 07/14] add all targets to Supabase scheme --- .../xcshareddata/xcschemes/Supabase.xcscheme | 70 +++++++++++++++++++ 1 file changed, 70 insertions(+) diff --git a/Supabase.xcworkspace/xcshareddata/xcschemes/Supabase.xcscheme b/Supabase.xcworkspace/xcshareddata/xcschemes/Supabase.xcscheme index b513e670..932de571 100644 --- a/Supabase.xcworkspace/xcshareddata/xcschemes/Supabase.xcscheme +++ b/Supabase.xcworkspace/xcshareddata/xcschemes/Supabase.xcscheme @@ -20,6 +20,76 @@ ReferencedContainer = "container:"> + + + + + + + + + + + + + + + + + + + + Date: Tue, 14 Jan 2025 11:26:05 -0300 Subject: [PATCH 08/14] move scheme files back --- .github/workflows/ci.yml | 18 +- .../xcshareddata/xcschemes/Auth.xcscheme | 0 .../xcshareddata/xcschemes/Functions.xcscheme | 0 .../xcshareddata/xcschemes/PostgREST.xcscheme | 0 .../xcshareddata/xcschemes/Realtime.xcscheme | 0 .../xcshareddata/xcschemes/Storage.xcscheme | 0 .../xcshareddata/xcschemes/Supabase.xcscheme | 208 ++++++++++++++++++ Makefile | 9 + Package.swift | 12 +- 9 files changed, 233 insertions(+), 14 deletions(-) rename {Supabase.xcworkspace => .swiftpm/xcode}/xcshareddata/xcschemes/Auth.xcscheme (100%) rename {Supabase.xcworkspace => .swiftpm/xcode}/xcshareddata/xcschemes/Functions.xcscheme (100%) rename {Supabase.xcworkspace => .swiftpm/xcode}/xcshareddata/xcschemes/PostgREST.xcscheme (100%) rename {Supabase.xcworkspace => .swiftpm/xcode}/xcshareddata/xcschemes/Realtime.xcscheme (100%) rename {Supabase.xcworkspace => .swiftpm/xcode}/xcshareddata/xcschemes/Storage.xcscheme (100%) create mode 100644 .swiftpm/xcode/xcshareddata/xcschemes/Supabase.xcscheme diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1def3ae1..0804a30a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -119,15 +119,15 @@ jobs: # - name: Run tests # run: swift test --skip IntegrationTests - # library-evolution: - # name: Library (evolution) - # runs-on: macos-14 - # steps: - # - uses: actions/checkout@v4 - # - name: Select Xcode 15.4 - # run: sudo xcode-select -s /Applications/Xcode_15.4.app - # - name: Build for library evolution - # run: make build-for-library-evolution + library-evolution: + name: Library (evolution) + runs-on: macos-14 + steps: + - uses: actions/checkout@v4 + - name: Select Xcode 15.4 + run: sudo xcode-select -s /Applications/Xcode_15.4.app + - name: Build for library evolution + run: make build-for-library-evolution examples: name: Examples diff --git a/Supabase.xcworkspace/xcshareddata/xcschemes/Auth.xcscheme b/.swiftpm/xcode/xcshareddata/xcschemes/Auth.xcscheme similarity index 100% rename from Supabase.xcworkspace/xcshareddata/xcschemes/Auth.xcscheme rename to .swiftpm/xcode/xcshareddata/xcschemes/Auth.xcscheme diff --git a/Supabase.xcworkspace/xcshareddata/xcschemes/Functions.xcscheme b/.swiftpm/xcode/xcshareddata/xcschemes/Functions.xcscheme similarity index 100% rename from Supabase.xcworkspace/xcshareddata/xcschemes/Functions.xcscheme rename to .swiftpm/xcode/xcshareddata/xcschemes/Functions.xcscheme diff --git a/Supabase.xcworkspace/xcshareddata/xcschemes/PostgREST.xcscheme b/.swiftpm/xcode/xcshareddata/xcschemes/PostgREST.xcscheme similarity index 100% rename from Supabase.xcworkspace/xcshareddata/xcschemes/PostgREST.xcscheme rename to .swiftpm/xcode/xcshareddata/xcschemes/PostgREST.xcscheme diff --git a/Supabase.xcworkspace/xcshareddata/xcschemes/Realtime.xcscheme b/.swiftpm/xcode/xcshareddata/xcschemes/Realtime.xcscheme similarity index 100% rename from Supabase.xcworkspace/xcshareddata/xcschemes/Realtime.xcscheme rename to .swiftpm/xcode/xcshareddata/xcschemes/Realtime.xcscheme diff --git a/Supabase.xcworkspace/xcshareddata/xcschemes/Storage.xcscheme b/.swiftpm/xcode/xcshareddata/xcschemes/Storage.xcscheme similarity index 100% rename from Supabase.xcworkspace/xcshareddata/xcschemes/Storage.xcscheme rename to .swiftpm/xcode/xcshareddata/xcschemes/Storage.xcscheme diff --git a/.swiftpm/xcode/xcshareddata/xcschemes/Supabase.xcscheme b/.swiftpm/xcode/xcshareddata/xcschemes/Supabase.xcscheme new file mode 100644 index 00000000..932de571 --- /dev/null +++ b/.swiftpm/xcode/xcshareddata/xcschemes/Supabase.xcscheme @@ -0,0 +1,208 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Makefile b/Makefile index 7d9f5b66..d053a1d5 100644 --- a/Makefile +++ b/Makefile @@ -97,6 +97,15 @@ build-linux: -w "$(PWD)" \ swift:5.9 \ bash -c 'swift build -c $(CONFIG)' + +build-for-library-evolution: + swift build \ + -q \ + -c release \ + --target Supabase \ + -Xswiftc -emit-module-interface \ + -Xswiftc -enable-library-evolution + .PHONY: build-for-library-evolution format xcodebuild test-docs test-integration define udid_for diff --git a/Package.swift b/Package.swift index bd91709f..0daf6b54 100644 --- a/Package.swift +++ b/Package.swift @@ -19,11 +19,13 @@ let package = Package( .library(name: "PostgREST", targets: ["PostgREST"]), .library(name: "Realtime", targets: ["Realtime"]), .library(name: "Storage", targets: ["Storage"]), - .library(name: "Supabase", targets: ["Supabase", "Functions", "PostgREST", "Auth", "Realtime", "Storage"]), + .library( + name: "Supabase", + targets: ["Supabase", "Functions", "PostgREST", "Auth", "Realtime", "Storage"]), ], dependencies: [ .package(url: "https://github.com/apple/swift-http-types.git", from: "1.3.0"), - .package(url: "https://github.com/apple/swift-crypto.git", "1.0.0" ..< "4.0.0"), + .package(url: "https://github.com/apple/swift-crypto.git", "1.0.0"..<"4.0.0"), .package(url: "https://github.com/pointfreeco/swift-concurrency-extras", from: "1.1.0"), .package(url: "https://github.com/pointfreeco/swift-custom-dump", from: "1.3.2"), .package(url: "https://github.com/pointfreeco/swift-snapshot-testing", from: "1.17.2"), @@ -66,14 +68,14 @@ let package = Package( "TestHelpers", ], exclude: [ - "__Snapshots__", + "__Snapshots__" ], resources: [.process("Resources")] ), .target( name: "Functions", dependencies: [ - "Helpers", + "Helpers" ] ), .testTarget( @@ -137,7 +139,7 @@ let package = Package( .target( name: "Storage", dependencies: [ - "Helpers", + "Helpers" ] ), .testTarget( From 854ef777446dd4926578bb574a9ea780d37ab6ac Mon Sep 17 00:00:00 2001 From: Guilherme Souza Date: Tue, 14 Jan 2025 11:52:04 -0300 Subject: [PATCH 09/14] skip release --- .github/workflows/ci.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0804a30a..2f1d22f8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -22,6 +22,8 @@ jobs: command: [test, ""] platform: [IOS, MACOS] xcode: ["16.0"] + include: + - {command: test, skip_release: 1} steps: - uses: actions/checkout@v4 - name: Select Xcode ${{ matrix.xcode }} @@ -44,6 +46,9 @@ jobs: - run: make dot-env - name: Debug run: make XCODEBUILD_ARGUMENT="${{ matrix.command }}" CONFIG=Debug PLATFORM="${{ matrix.platform }}" xcodebuild + - name: Release + if: matrix.skip_release != '1' + run: make XCODEBUILD_ARGUMENT="${{ matrix.command }}" CONFIG=Release PLATFORM="${{ matrix.platform }}" xcodebuild xcodebuild: name: xcodebuild (15) @@ -62,6 +67,7 @@ jobs: - {xcode: 15.2, platform: WATCHOS} include: - {xcode: 15.2, skip_release: 1} + - {command: test, skip_release: 1} steps: - uses: actions/checkout@v4 - name: Select Xcode ${{ matrix.xcode }} From 1755faa9b172d10db801e50c9533294d334356c5 Mon Sep 17 00:00:00 2001 From: Guilherme Souza Date: Tue, 14 Jan 2025 12:12:36 -0300 Subject: [PATCH 10/14] wip --- .github/workflows/ci.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2f1d22f8..ab22ab47 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -60,13 +60,11 @@ jobs: xcode: [15.2, 15.4] exclude: - {xcode: 15.2, command: test} - - {xcode: 15.4, command: ''} - {xcode: 15.2, platform: MAC_CATALYST} - {xcode: 15.2, platform: TVOS} - {xcode: 15.2, platform: VISIONOS} - {xcode: 15.2, platform: WATCHOS} include: - - {xcode: 15.2, skip_release: 1} - {command: test, skip_release: 1} steps: - uses: actions/checkout@v4 From b228550edabb9de6b4248903403777d15a12973b Mon Sep 17 00:00:00 2001 From: Guilherme Souza Date: Tue, 14 Jan 2025 12:28:17 -0300 Subject: [PATCH 11/14] run ci for all platforms --- .github/workflows/ci.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ab22ab47..4a94082c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -20,7 +20,7 @@ jobs: strategy: matrix: command: [test, ""] - platform: [IOS, MACOS] + platform: [IOS, MAC_CATALYST, MACOS, TVOS, VISIONOS, WATCHOS] xcode: ["16.0"] include: - {command: test, skip_release: 1} @@ -58,12 +58,12 @@ jobs: command: [test, ""] platform: [IOS, MAC_CATALYST, MACOS, TVOS, VISIONOS, WATCHOS] xcode: [15.2, 15.4] - exclude: - - {xcode: 15.2, command: test} - - {xcode: 15.2, platform: MAC_CATALYST} - - {xcode: 15.2, platform: TVOS} - - {xcode: 15.2, platform: VISIONOS} - - {xcode: 15.2, platform: WATCHOS} + # exclude: + # - {xcode: 15.2, command: test} + # - {xcode: 15.2, platform: MAC_CATALYST} + # - {xcode: 15.2, platform: TVOS} + # - {xcode: 15.2, platform: VISIONOS} + # - {xcode: 15.2, platform: WATCHOS} include: - {command: test, skip_release: 1} steps: From 51e4c774def39d2f5317ec5c350e18b817082ae3 Mon Sep 17 00:00:00 2001 From: Guilherme Souza Date: Tue, 14 Jan 2025 12:29:12 -0300 Subject: [PATCH 12/14] remove duplicate build-for-library-evolution from makefile --- Makefile | 8 -------- 1 file changed, 8 deletions(-) diff --git a/Makefile b/Makefile index d053a1d5..ef5c1620 100644 --- a/Makefile +++ b/Makefile @@ -98,14 +98,6 @@ build-linux: swift:5.9 \ bash -c 'swift build -c $(CONFIG)' -build-for-library-evolution: - swift build \ - -q \ - -c release \ - --target Supabase \ - -Xswiftc -emit-module-interface \ - -Xswiftc -enable-library-evolution - .PHONY: build-for-library-evolution format xcodebuild test-docs test-integration define udid_for From acb66a15ae1bcb3c49758d774aaea4bb9cf51d7e Mon Sep 17 00:00:00 2001 From: Guilherme Souza Date: Tue, 14 Jan 2025 12:32:19 -0300 Subject: [PATCH 13/14] run ci on xcode 16.2 --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4a94082c..535ba797 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,7 +21,7 @@ jobs: matrix: command: [test, ""] platform: [IOS, MAC_CATALYST, MACOS, TVOS, VISIONOS, WATCHOS] - xcode: ["16.0"] + xcode: ["16.2"] include: - {command: test, skip_release: 1} steps: From ee5acbb685c6c23efe5d799b39309e13f8b8ca28 Mon Sep 17 00:00:00 2001 From: Guilherme Souza Date: Tue, 14 Jan 2025 13:01:25 -0300 Subject: [PATCH 14/14] wip --- .github/workflows/ci.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 535ba797..311009d6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -20,7 +20,7 @@ jobs: strategy: matrix: command: [test, ""] - platform: [IOS, MAC_CATALYST, MACOS, TVOS, VISIONOS, WATCHOS] + platform: [IOS, MACOS] xcode: ["16.2"] include: - {command: test, skip_release: 1} @@ -58,12 +58,12 @@ jobs: command: [test, ""] platform: [IOS, MAC_CATALYST, MACOS, TVOS, VISIONOS, WATCHOS] xcode: [15.2, 15.4] - # exclude: - # - {xcode: 15.2, command: test} - # - {xcode: 15.2, platform: MAC_CATALYST} - # - {xcode: 15.2, platform: TVOS} - # - {xcode: 15.2, platform: VISIONOS} - # - {xcode: 15.2, platform: WATCHOS} + exclude: + - {xcode: 15.2, command: test} + - {xcode: 15.2, platform: MAC_CATALYST} + - {xcode: 15.2, platform: TVOS} + - {xcode: 15.2, platform: VISIONOS} + - {xcode: 15.2, platform: WATCHOS} include: - {command: test, skip_release: 1} steps: