File tree 4 files changed +26
-7
lines changed
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
5
5
PLATFORM_WATCHOS = watchOS Simulator,name=Apple Watch Series 9 (41mm)
6
6
EXAMPLE = Examples
7
7
8
+ test-all : test-library test-linux
9
+
8
10
test-library :
9
11
for platform in " $( PLATFORM_IOS) " " $( PLATFORM_MACOS) " " $( PLATFORM_MAC_CATALYST) " " $( PLATFORM_TVOS) " " $( PLATFORM_WATCHOS) " ; do \
10
12
xcodebuild test \
@@ -14,6 +16,10 @@ test-library:
14
16
-destination platform=" $$ platform" || exit 1; \
15
17
done ;
16
18
19
+ test-linux :
20
+ docker build -t supabase-swift .
21
+ docker run supabase-swift
22
+
17
23
build-for-library-evolution :
18
24
swift build \
19
25
-c release \
@@ -47,4 +53,4 @@ build-examples:
47
53
format :
48
54
@swiftformat .
49
55
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
11
11
12
12
#if canImport(FoundationNetworking)
13
13
import FoundationNetworking
14
+
15
+ let NSEC_PER_SEC : UInt64 = 1_000_000_000
14
16
#endif
15
17
16
18
public actor RealtimeClientV2 {
@@ -241,7 +243,7 @@ public actor RealtimeClientV2 {
241
243
guard let self else { return }
242
244
243
245
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) )
245
247
if Task . isCancelled {
246
248
break
247
249
}
@@ -379,7 +381,7 @@ func withThrowingTimeout<R>(
379
381
}
380
382
381
383
group. addTask {
382
- try await Task . sleep ( nanoseconds: UInt64 ( seconds * 1000000000 ) )
384
+ try await Task . sleep ( nanoseconds: UInt64 ( seconds) * NSEC_PER_SEC )
383
385
throw TimeoutError ( )
384
386
}
385
387
Original file line number Diff line number Diff line change @@ -36,8 +36,6 @@ final class RealtimeTests: XCTestCase {
36
36
makeWebSocketClient: { _, _ in mock }
37
37
)
38
38
39
- XCTAssertNoLeak ( realtime)
40
-
41
39
let channel = await realtime. channel ( " public:messages " )
42
40
_ = await channel. postgresChange ( InsertAction . self, table: " messages " )
43
41
_ = await channel. postgresChange ( UpdateAction . self, table: " messages " )
@@ -60,8 +58,6 @@ final class RealtimeTests: XCTestCase {
60
58
await channel. subscribe ( )
61
59
62
60
XCTAssertNoDifference ( sentMessages, [ . subscribeToMessages] )
63
-
64
- await realtime. disconnect ( )
65
61
}
66
62
67
63
func testHeartbeat( ) {
You can’t perform that action at this time.
0 commit comments