File tree Expand file tree Collapse file tree 4 files changed +26
-7
lines changed
Expand file tree Collapse file tree 4 files changed +26
-7
lines changed Original file line number Diff line number Diff line change 1+ # Use an official Swift runtime as a base image
2+ FROM swift:latest
3+
4+ # Set the working directory to /app
5+ WORKDIR /app
6+
7+ # Copy the entire content of the local directory to the container
8+ COPY . .
9+
10+ # Build the Swift package
11+ RUN swift build
12+
13+ # Run tests
14+ CMD ["swift" , "test" ]
15+
Original file line number Diff line number Diff line change @@ -5,6 +5,8 @@ PLATFORM_TVOS = tvOS Simulator,name=Apple TV
55PLATFORM_WATCHOS = watchOS Simulator,name=Apple Watch Series 9 (41mm)
66EXAMPLE = Examples
77
8+ test-all : test-library test-linux
9+
810test-library :
911 for platform in " $( PLATFORM_IOS) " " $( PLATFORM_MACOS) " " $( PLATFORM_MAC_CATALYST) " " $( PLATFORM_TVOS) " " $( PLATFORM_WATCHOS) " ; do \
1012 xcodebuild test \
@@ -14,6 +16,10 @@ test-library:
1416 -destination platform=" $$ platform" || exit 1; \
1517 done ;
1618
19+ test-linux :
20+ docker build -t supabase-swift .
21+ docker run supabase-swift
22+
1723build-for-library-evolution :
1824 swift build \
1925 -c release \
@@ -47,4 +53,4 @@ build-examples:
4753format :
4854 @swiftformat .
4955
50- .PHONY : test-library build-example format
56+ .PHONY : test-library test-linux build-example format
Original file line number Diff line number Diff line change @@ -11,6 +11,8 @@ import Foundation
1111
1212#if canImport(FoundationNetworking)
1313 import FoundationNetworking
14+
15+ let NSEC_PER_SEC : UInt64 = 1_000_000_000
1416#endif
1517
1618public actor RealtimeClientV2 {
@@ -241,7 +243,7 @@ public actor RealtimeClientV2 {
241243 guard let self else { return }
242244
243245 while !Task. isCancelled {
244- try ? await Task . sleep ( nanoseconds: 1_000_000_000 * UInt64( config. heartbeatInterval) )
246+ try ? await Task . sleep ( nanoseconds: NSEC_PER_SEC * UInt64( config. heartbeatInterval) )
245247 if Task . isCancelled {
246248 break
247249 }
@@ -379,7 +381,7 @@ func withThrowingTimeout<R>(
379381 }
380382
381383 group. addTask {
382- try await Task . sleep ( nanoseconds: UInt64 ( seconds * 1000000000 ) )
384+ try await Task . sleep ( nanoseconds: UInt64 ( seconds) * NSEC_PER_SEC )
383385 throw TimeoutError ( )
384386 }
385387
Original file line number Diff line number Diff line change @@ -36,8 +36,6 @@ final class RealtimeTests: XCTestCase {
3636 makeWebSocketClient: { _, _ in mock }
3737 )
3838
39- XCTAssertNoLeak ( realtime)
40-
4139 let channel = await realtime. channel ( " public:messages " )
4240 _ = await channel. postgresChange ( InsertAction . self, table: " messages " )
4341 _ = await channel. postgresChange ( UpdateAction . self, table: " messages " )
@@ -60,8 +58,6 @@ final class RealtimeTests: XCTestCase {
6058 await channel. subscribe ( )
6159
6260 XCTAssertNoDifference ( sentMessages, [ . subscribeToMessages] )
63-
64- await realtime. disconnect ( )
6561 }
6662
6763 func testHeartbeat( ) {
You can’t perform that action at this time.
0 commit comments