From 0526853ddecab9c431c7d1ffa05daee3b1a34447 Mon Sep 17 00:00:00 2001 From: Tim De Jong Date: Thu, 2 Oct 2025 12:32:33 +0200 Subject: [PATCH 01/33] Fixed some linker errors caused by WAL absence on Linux. --- GRDB/Core/DispatchQueueActor.swift | 4 ++++ Package.swift | 2 ++ 2 files changed, 6 insertions(+) diff --git a/GRDB/Core/DispatchQueueActor.swift b/GRDB/Core/DispatchQueueActor.swift index 3a51d8897f..93f054a30e 100644 --- a/GRDB/Core/DispatchQueueActor.swift +++ b/GRDB/Core/DispatchQueueActor.swift @@ -1,4 +1,8 @@ +#if os(Linux) +@preconcurrency import Dispatch +#else import Dispatch +#endif /// An actor that runs in a DispatchQueue. /// diff --git a/Package.swift b/Package.swift index 9d0c79554f..680d1c913e 100644 --- a/Package.swift +++ b/Package.swift @@ -21,6 +21,8 @@ var swiftSettings: [SwiftSetting] = [ // TODO: when Xcode support traits, remove all mentions of SQLITE_DISABLE_SNAPSHOT and update as below: // .define("SQLITE_ENABLE_SNAPSHOT", .when(platforms: darwinPlatforms, traits: ["GRDBSQLite"])), .define("SQLITE_ENABLE_SNAPSHOT"), + // Not all Linux distributions have support for WAL snapshots. + .define("SQLITE_DISABLE_SNAPSHOT", .when(platforms: [.linux])), ] var cSettings: [CSetting] = [] var dependencies: [PackageDescription.Package.Dependency] = [] From 2d6fe172c35a9b40dd520adb9961396b0f2ba8bd Mon Sep 17 00:00:00 2001 From: Tim De Jong Date: Sun, 12 Oct 2025 16:57:26 +0200 Subject: [PATCH 02/33] Import Foundation for CGFloat on non-Darwin platforms --- GRDB/Core/Support/CoreGraphics/CGFloat.swift | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/GRDB/Core/Support/CoreGraphics/CGFloat.swift b/GRDB/Core/Support/CoreGraphics/CGFloat.swift index 6b0fb6053b..11487c6b4e 100644 --- a/GRDB/Core/Support/CoreGraphics/CGFloat.swift +++ b/GRDB/Core/Support/CoreGraphics/CGFloat.swift @@ -1,5 +1,8 @@ #if canImport(CoreGraphics) import CoreGraphics +#elseif !os(Darwin) +import Foundation +#endif /// CGFloat adopts DatabaseValueConvertible extension CGFloat: DatabaseValueConvertible { @@ -15,4 +18,3 @@ extension CGFloat: DatabaseValueConvertible { return CGFloat(double) } } -#endif From 7477e1cff86d9be17fe3c30093c809c907a7839e Mon Sep 17 00:00:00 2001 From: Tim De Jong Date: Thu, 2 Oct 2025 12:42:58 +0200 Subject: [PATCH 03/33] Removed the `#if !os(Linux)` compiler directive in the `Decimal` extension, as it compiles fine under swift 6 --- GRDB/Core/Support/Foundation/Decimal.swift | 2 -- 1 file changed, 2 deletions(-) diff --git a/GRDB/Core/Support/Foundation/Decimal.swift b/GRDB/Core/Support/Foundation/Decimal.swift index 70d84f3ab7..d315fb6d45 100644 --- a/GRDB/Core/Support/Foundation/Decimal.swift +++ b/GRDB/Core/Support/Foundation/Decimal.swift @@ -1,4 +1,3 @@ -#if !os(Linux) // Import C SQLite functions #if GRDBCIPHER // CocoaPods (SQLCipher subspec) import SQLCipher @@ -68,4 +67,3 @@ extension Decimal: StatementColumnConvertible { @usableFromInline let _posixLocale = Locale(identifier: "en_US_POSIX") -#endif From e758fde94161dc48e70a660ce481544ad07b2d91 Mon Sep 17 00:00:00 2001 From: Tim De Jong Date: Thu, 2 Oct 2025 12:44:43 +0200 Subject: [PATCH 04/33] Removed #if !os(Linux) in NSString.swift, NSData.swift and Date.swift. --- GRDB/Core/Support/Foundation/Date.swift | 2 -- GRDB/Core/Support/Foundation/NSData.swift | 2 -- GRDB/Core/Support/Foundation/NSString.swift | 2 -- 3 files changed, 6 deletions(-) diff --git a/GRDB/Core/Support/Foundation/Date.swift b/GRDB/Core/Support/Foundation/Date.swift index dadc00fd65..379e3ff5b0 100644 --- a/GRDB/Core/Support/Foundation/Date.swift +++ b/GRDB/Core/Support/Foundation/Date.swift @@ -12,7 +12,6 @@ import GRDBSQLite import Foundation -#if !os(Linux) /// NSDate is stored in the database using the format /// "yyyy-MM-dd HH:mm:ss.SSS", in the UTC time zone. extension NSDate: DatabaseValueConvertible { @@ -41,7 +40,6 @@ extension NSDate: DatabaseValueConvertible { return cast(date) } } -#endif /// Date is stored in the database using the format /// "yyyy-MM-dd HH:mm:ss.SSS", in the UTC time zone. diff --git a/GRDB/Core/Support/Foundation/NSData.swift b/GRDB/Core/Support/Foundation/NSData.swift index 72861ac02e..12cba1a3ce 100644 --- a/GRDB/Core/Support/Foundation/NSData.swift +++ b/GRDB/Core/Support/Foundation/NSData.swift @@ -1,4 +1,3 @@ -#if !os(Linux) import Foundation /// NSData is convertible to and from DatabaseValue. @@ -24,4 +23,3 @@ extension NSData: DatabaseValueConvertible { return cast(data) } } -#endif diff --git a/GRDB/Core/Support/Foundation/NSString.swift b/GRDB/Core/Support/Foundation/NSString.swift index acddddb35d..3f019ad403 100644 --- a/GRDB/Core/Support/Foundation/NSString.swift +++ b/GRDB/Core/Support/Foundation/NSString.swift @@ -1,4 +1,3 @@ -#if !os(Linux) import Foundation /// NSString adopts DatabaseValueConvertible @@ -24,4 +23,3 @@ extension NSString: DatabaseValueConvertible { return self.init(string: string) } } -#endif From 14f60ad48f311476c8bb65f7d5fceb2300a1001d Mon Sep 17 00:00:00 2001 From: Tim De Jong Date: Sun, 12 Oct 2025 17:42:25 +0200 Subject: [PATCH 05/33] Fixed fromDatabaseValue build under non-Darwin platforms --- GRDB/Core/Support/Foundation/NSNumber.swift | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/GRDB/Core/Support/Foundation/NSNumber.swift b/GRDB/Core/Support/Foundation/NSNumber.swift index 1c5778c19e..3b5076fd34 100644 --- a/GRDB/Core/Support/Foundation/NSNumber.swift +++ b/GRDB/Core/Support/Foundation/NSNumber.swift @@ -1,4 +1,4 @@ -#if !os(Linux) && !os(Windows) +#if !os(Windows) import Foundation private let integerRoundingBehavior = NSDecimalNumberHandler( @@ -81,10 +81,18 @@ extension NSNumber: DatabaseValueConvertible { /// Otherwise, returns nil. public static func fromDatabaseValue(_ dbValue: DatabaseValue) -> Self? { switch dbValue.storage { + case .int64(let int64) where self is NSDecimalNumber.Type: + let number = NSDecimalNumber(value: int64) + return number as? Self case .int64(let int64): - return self.init(value: int64) + let number = NSNumber(value: int64) + return number as? Self + case .double(let double) where self is NSDecimalNumber.Type: + let number = NSDecimalNumber(value: double) + return number as? Self case .double(let double): - return self.init(value: double) + let number = NSNumber(value: double) + return number as? Self case let .string(string): // Must match Decimal.fromDatabaseValue(_:) guard let decimal = Decimal(string: string, locale: posixLocale) else { return nil } From dc7d47c06620b50dff921c7afc295a79ad1ca238 Mon Sep 17 00:00:00 2001 From: Tim De Jong Date: Sun, 12 Oct 2025 17:00:58 +0200 Subject: [PATCH 06/33] Fixed databaseValue build for non-Darwin platforms. --- GRDB/Core/Support/Foundation/URL.swift | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/GRDB/Core/Support/Foundation/URL.swift b/GRDB/Core/Support/Foundation/URL.swift index 6db66ec3b8..d8a8b1c809 100644 --- a/GRDB/Core/Support/Foundation/URL.swift +++ b/GRDB/Core/Support/Foundation/URL.swift @@ -1,12 +1,16 @@ import Foundation -#if !os(Linux) && !os(Windows) +#if !os(Windows) /// NSURL stores its absoluteString in the database. extension NSURL: DatabaseValueConvertible { /// Returns a TEXT database value containing the absolute URL. public var databaseValue: DatabaseValue { - absoluteString?.databaseValue ?? .null + #if !os(Darwin) + absoluteString.databaseValue + #else + absoluteString?.databaseValue ?? .null + #endif } public static func fromDatabaseValue(_ dbValue: DatabaseValue) -> Self? { From 8e5b9ca9bd5a51afc99eb7a101fd8e52bd8651be Mon Sep 17 00:00:00 2001 From: Tim De Jong Date: Thu, 2 Oct 2025 12:48:10 +0200 Subject: [PATCH 07/33] Fixed UUID fromDatabaseValue for non-Darwin platforms --- GRDB/Core/Support/Foundation/UUID.swift | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/GRDB/Core/Support/Foundation/UUID.swift b/GRDB/Core/Support/Foundation/UUID.swift index 54b18b2c80..92d4e1fcba 100644 --- a/GRDB/Core/Support/Foundation/UUID.swift +++ b/GRDB/Core/Support/Foundation/UUID.swift @@ -12,7 +12,7 @@ import GRDBSQLite import Foundation -#if !os(Linux) && !os(Windows) +#if !os(Windows) /// NSUUID adopts DatabaseValueConvertible extension NSUUID: DatabaseValueConvertible { /// Returns a BLOB database value containing the uuid bytes. @@ -36,10 +36,17 @@ extension NSUUID: DatabaseValueConvertible { switch dbValue.storage { case .blob(let data) where data.count == 16: return data.withUnsafeBytes { - self.init(uuidBytes: $0.bindMemory(to: UInt8.self).baseAddress) + #if canImport(Darwin) + self.init(uuidBytes: $0.bindMemory(to: UInt8.self).baseAddress) + #else + guard let uuidBytes = $0.bindMemory(to: UInt8.self).baseAddress else { + return nil as Self? + } + return NSUUID(uuidBytes: uuidBytes) as? Self + #endif } case .string(let string): - return self.init(uuidString: string) + return NSUUID(uuidString: string) as? Self default: return nil } @@ -91,8 +98,8 @@ extension UUID: StatementColumnConvertible { self.init(uuid: uuid.uuid) case SQLITE_BLOB: guard sqlite3_column_bytes(sqliteStatement, index) == 16, - let blob = sqlite3_column_blob(sqliteStatement, index) else - { + let blob = sqlite3_column_blob(sqliteStatement, index) + else { return nil } self.init(uuid: blob.assumingMemoryBound(to: uuid_t.self).pointee) From c7f1dd74705a736e712cf5ee080f8315506a090f Mon Sep 17 00:00:00 2001 From: Tim De Jong Date: Sun, 12 Oct 2025 17:02:54 +0200 Subject: [PATCH 08/33] Fixed import in CGFloatTests.swift to work under non-Darwin platforms. --- Tests/GRDBTests/CGFloatTests.swift | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Tests/GRDBTests/CGFloatTests.swift b/Tests/GRDBTests/CGFloatTests.swift index 1bcfaaa582..3e0bd21c87 100644 --- a/Tests/GRDBTests/CGFloatTests.swift +++ b/Tests/GRDBTests/CGFloatTests.swift @@ -1,7 +1,12 @@ import XCTest -import CoreGraphics import GRDB +#if canImport(CoreGraphics) +import CoreGraphics +#elseif !os(Darwin) +import Foundation +#endif + class CGFloatTests: GRDBTestCase { func testCGFLoat() throws { From 691207567a6816b910570835dbf64f1a988df1ec Mon Sep 17 00:00:00 2001 From: Tim De Jong Date: Sun, 12 Oct 2025 17:04:23 +0200 Subject: [PATCH 09/33] Ignore FailureTestCase.swift entirely on non-Darwin platforms for now. --- Tests/GRDBTests/FailureTestCase.swift | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Tests/GRDBTests/FailureTestCase.swift b/Tests/GRDBTests/FailureTestCase.swift index 9dfb9770ba..7b552aaa04 100644 --- a/Tests/GRDBTests/FailureTestCase.swift +++ b/Tests/GRDBTests/FailureTestCase.swift @@ -1,3 +1,4 @@ +#if canImport(Darwin) // Inspired by https://github.com/groue/CombineExpectations import XCTest @@ -207,3 +208,4 @@ class FailureTestCaseTests: FailureTestCase { } } } +#endif From dd90fe6e62daa8cad14c65d1e9f9a5a05b394f52 Mon Sep 17 00:00:00 2001 From: Tim De Jong Date: Sun, 12 Oct 2025 17:05:35 +0200 Subject: [PATCH 10/33] Ignore ValueObservationRecorderTests.swift on non-Darwin platforms. --- Tests/GRDBTests/ValueObservationRecorderTests.swift | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Tests/GRDBTests/ValueObservationRecorderTests.swift b/Tests/GRDBTests/ValueObservationRecorderTests.swift index 4b8e8a2ae0..134543db4f 100644 --- a/Tests/GRDBTests/ValueObservationRecorderTests.swift +++ b/Tests/GRDBTests/ValueObservationRecorderTests.swift @@ -1,3 +1,4 @@ +#if canImport(Darwin) import Dispatch import XCTest @@ -781,3 +782,4 @@ class ValueObservationRecorderTests: FailureTestCase { } } } +#endif From 2ad2d20a89e3e1feeb7de69a5aa92956a4ad6f6f Mon Sep 17 00:00:00 2001 From: Tim De Jong Date: Sun, 12 Oct 2025 17:11:26 +0200 Subject: [PATCH 11/33] Fixed the unit tests in DatabasePoolConcurrencyTests. --- .../DatabasePoolConcurrencyTests.swift | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/Tests/GRDBTests/DatabasePoolConcurrencyTests.swift b/Tests/GRDBTests/DatabasePoolConcurrencyTests.swift index 7d2478545b..bbdf523d44 100644 --- a/Tests/GRDBTests/DatabasePoolConcurrencyTests.swift +++ b/Tests/GRDBTests/DatabasePoolConcurrencyTests.swift @@ -877,10 +877,12 @@ class DatabasePoolConcurrencyTests: GRDBTestCase { XCTAssertEqual(db.configuration.label, nil) XCTAssertEqual(db.description, "GRDB.DatabasePool.writer") +#if canImport(Darwin) // This test CAN break in future releases: the dispatch queue labels // are documented to be a debug-only tool. let label = String(utf8String: __dispatch_queue_get_label(nil)) XCTAssertEqual(label, "GRDB.DatabasePool.writer") +#endif } let s1 = DispatchSemaphore(value: 0) @@ -890,10 +892,12 @@ class DatabasePoolConcurrencyTests: GRDBTestCase { XCTAssertEqual(db.configuration.label, nil) XCTAssertEqual(db.description, "GRDB.DatabasePool.reader.1") +#if canImport(Darwin) // This test CAN break in future releases: the dispatch queue labels // are documented to be a debug-only tool. let label = String(utf8String: __dispatch_queue_get_label(nil)) XCTAssertEqual(label, "GRDB.DatabasePool.reader.1") +#endif _ = s1.signal() _ = s2.wait(timeout: .distantFuture) @@ -906,10 +910,12 @@ class DatabasePoolConcurrencyTests: GRDBTestCase { XCTAssertEqual(db.configuration.label, nil) XCTAssertEqual(db.description, "GRDB.DatabasePool.reader.2") +#if canImport(Darwin) // This test CAN break in future releases: the dispatch queue labels // are documented to be a debug-only tool. let label = String(utf8String: __dispatch_queue_get_label(nil)) XCTAssertEqual(label, "GRDB.DatabasePool.reader.2") +#endif } } let blocks = [block1, block2] @@ -925,10 +931,12 @@ class DatabasePoolConcurrencyTests: GRDBTestCase { XCTAssertEqual(db.configuration.label, "Toreador") XCTAssertEqual(db.description, "Toreador.writer") +#if canImport(Darwin) // This test CAN break in future releases: the dispatch queue labels // are documented to be a debug-only tool. let label = String(utf8String: __dispatch_queue_get_label(nil)) XCTAssertEqual(label, "Toreador.writer") +#endif } let s1 = DispatchSemaphore(value: 0) @@ -938,10 +946,12 @@ class DatabasePoolConcurrencyTests: GRDBTestCase { XCTAssertEqual(db.configuration.label, "Toreador") XCTAssertEqual(db.description, "Toreador.reader.1") +#if canImport(Darwin) // This test CAN break in future releases: the dispatch queue labels // are documented to be a debug-only tool. let label = String(utf8String: __dispatch_queue_get_label(nil)) XCTAssertEqual(label, "Toreador.reader.1") +#endif _ = s1.signal() _ = s2.wait(timeout: .distantFuture) @@ -954,10 +964,12 @@ class DatabasePoolConcurrencyTests: GRDBTestCase { XCTAssertEqual(db.configuration.label, "Toreador") XCTAssertEqual(db.description, "Toreador.reader.2") +#if canImport(Darwin) // This test CAN break in future releases: the dispatch queue labels // are documented to be a debug-only tool. let label = String(utf8String: __dispatch_queue_get_label(nil)) XCTAssertEqual(label, "Toreador.reader.2") +#endif } } let blocks = [block1, block2] @@ -1037,6 +1049,9 @@ class DatabasePoolConcurrencyTests: GRDBTestCase { } func testQoS() throws { +#if !canImport(Darwin) + throw XCTSkip("__dispatch_get_global_queue unavailable") +#else func test(qos: DispatchQoS) throws { // https://forums.swift.org/t/what-is-the-default-target-queue-for-a-serial-queue/18094/5 // @@ -1072,6 +1087,7 @@ class DatabasePoolConcurrencyTests: GRDBTestCase { try test(qos: .background) try test(qos: .userInitiated) +#endif } // MARK: - AsyncConcurrentRead @@ -1254,6 +1270,9 @@ class DatabasePoolConcurrencyTests: GRDBTestCase { // MARK: - Concurrent opening func testConcurrentOpening() throws { +#if !canImport(Darwin) + throw XCTSkip("NSFileCoordinator unavailable") +#else for _ in 0..<50 { let dbDirectoryName = "DatabasePoolConcurrencyTests-\(ProcessInfo.processInfo.globallyUniqueString)" let directoryURL = URL(fileURLWithPath: NSTemporaryDirectory(), isDirectory: true) @@ -1277,6 +1296,7 @@ class DatabasePoolConcurrencyTests: GRDBTestCase { XCTAssert(poolError ?? coordinatorError == nil) } } +#endif } // MARK: - NSFileCoordinator sample code tests @@ -1284,6 +1304,9 @@ class DatabasePoolConcurrencyTests: GRDBTestCase { // Test for sample code in Documentation.docc/DatabaseSharing.md. // This test passes if this method compiles private func openSharedDatabase(at databaseURL: URL) throws -> DatabasePool { +#if !canImport(Darwin) + throw XCTSkip("NSFileCoordinator unavailable") +#else let coordinator = NSFileCoordinator(filePresenter: nil) var coordinatorError: NSError? var dbPool: DatabasePool? @@ -1299,6 +1322,7 @@ class DatabasePoolConcurrencyTests: GRDBTestCase { throw error } return dbPool! +#endif } // Test for sample code in Documentation.docc/DatabaseSharing.md. @@ -1313,6 +1337,9 @@ class DatabasePoolConcurrencyTests: GRDBTestCase { // Test for sample code in Documentation.docc/DatabaseSharing.md. // This test passes if this method compiles private func openSharedReadOnlyDatabase(at databaseURL: URL) throws -> DatabasePool? { +#if !canImport(Darwin) + throw XCTSkip("NSFileCoordinator unavailable") +#else let coordinator = NSFileCoordinator(filePresenter: nil) var coordinatorError: NSError? var dbPool: DatabasePool? @@ -1328,6 +1355,7 @@ class DatabasePoolConcurrencyTests: GRDBTestCase { throw error } return dbPool +#endif } // Test for sample code in Documentation.docc/DatabaseSharing.md. From 5513eab099a3ec2587fa3f543de72a899e9ecc15 Mon Sep 17 00:00:00 2001 From: Tim De Jong Date: Sun, 12 Oct 2025 17:13:46 +0200 Subject: [PATCH 12/33] Fixed the tests in DatabaseQueueTests.swift --- Tests/GRDBTests/DatabaseQueueTests.swift | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Tests/GRDBTests/DatabaseQueueTests.swift b/Tests/GRDBTests/DatabaseQueueTests.swift index c22be83261..0372d97776 100644 --- a/Tests/GRDBTests/DatabaseQueueTests.swift +++ b/Tests/GRDBTests/DatabaseQueueTests.swift @@ -129,10 +129,12 @@ class DatabaseQueueTests: GRDBTestCase { XCTAssertEqual(db.configuration.label, nil) XCTAssertEqual(db.description, "GRDB.DatabaseQueue") +#if canImport(Darwin) // This test CAN break in future releases: the dispatch queue labels // are documented to be a debug-only tool. let label = String(utf8String: __dispatch_queue_get_label(nil)) XCTAssertEqual(label, "GRDB.DatabaseQueue") +#endif } } @@ -144,10 +146,12 @@ class DatabaseQueueTests: GRDBTestCase { XCTAssertEqual(db.configuration.label, "Toreador") XCTAssertEqual(db.description, "Toreador") +#if canImport(Darwin) // This test CAN break in future releases: the dispatch queue labels // are documented to be a debug-only tool. let label = String(utf8String: __dispatch_queue_get_label(nil)) XCTAssertEqual(label, "Toreador") +#endif } } @@ -221,6 +225,9 @@ class DatabaseQueueTests: GRDBTestCase { } func testQoS() throws { +#if !canImport(Darwin) + throw XCTSkip("__dispatch_get_global_queue not available on non-Darwin platforms") +#else func test(qos: DispatchQoS) throws { // https://forums.swift.org/t/what-is-the-default-target-queue-for-a-serial-queue/18094/5 // @@ -256,6 +263,7 @@ class DatabaseQueueTests: GRDBTestCase { try test(qos: .background) try test(qos: .userInitiated) +#endif } // MARK: - SQLITE_BUSY prevention From 2f108508fa3f32e05aabce1fc928f0af999c4131 Mon Sep 17 00:00:00 2001 From: Tim De Jong Date: Sun, 12 Oct 2025 17:15:32 +0200 Subject: [PATCH 13/33] Fixed DatabaseSnapshotTests on non-darwin platforms --- Tests/GRDBTests/DatabaseSnapshotTests.swift | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Tests/GRDBTests/DatabaseSnapshotTests.swift b/Tests/GRDBTests/DatabaseSnapshotTests.swift index 1cb422ecdd..b31ccea69d 100644 --- a/Tests/GRDBTests/DatabaseSnapshotTests.swift +++ b/Tests/GRDBTests/DatabaseSnapshotTests.swift @@ -230,10 +230,12 @@ class DatabaseSnapshotTests: GRDBTestCase { XCTAssertEqual(db.configuration.label, nil) XCTAssertEqual(db.description, "GRDB.DatabasePool.snapshot.1") +#if canImport(Darwin) // This test CAN break in future releases: the dispatch queue labels // are documented to be a debug-only tool. let label = String(utf8String: __dispatch_queue_get_label(nil)) XCTAssertEqual(label, "GRDB.DatabasePool.snapshot.1") +#endif } let snapshot2 = try dbPool.makeSnapshot() @@ -241,10 +243,12 @@ class DatabaseSnapshotTests: GRDBTestCase { XCTAssertEqual(db.configuration.label, nil) XCTAssertEqual(db.description, "GRDB.DatabasePool.snapshot.2") +#if canImport(Darwin) // This test CAN break in future releases: the dispatch queue labels // are documented to be a debug-only tool. let label = String(utf8String: __dispatch_queue_get_label(nil)) XCTAssertEqual(label, "GRDB.DatabasePool.snapshot.2") +#endif } } @@ -257,10 +261,12 @@ class DatabaseSnapshotTests: GRDBTestCase { XCTAssertEqual(db.configuration.label, "Toreador") XCTAssertEqual(db.description, "Toreador.snapshot.1") +#if canImport(Darwin) // This test CAN break in future releases: the dispatch queue labels // are documented to be a debug-only tool. let label = String(utf8String: __dispatch_queue_get_label(nil)) XCTAssertEqual(label, "Toreador.snapshot.1") +#endif } let snapshot2 = try dbPool.makeSnapshot() @@ -268,10 +274,12 @@ class DatabaseSnapshotTests: GRDBTestCase { XCTAssertEqual(db.configuration.label, "Toreador") XCTAssertEqual(db.description, "Toreador.snapshot.2") +#if canImport(Darwin) // This test CAN break in future releases: the dispatch queue labels // are documented to be a debug-only tool. let label = String(utf8String: __dispatch_queue_get_label(nil)) XCTAssertEqual(label, "Toreador.snapshot.2") +#endif } } From 65186104cce3457f2a2912857b0637a66175203a Mon Sep 17 00:00:00 2001 From: Tim De Jong Date: Sun, 12 Oct 2025 17:16:06 +0200 Subject: [PATCH 14/33] Integrated upstream changes. Some tests depend on Combine which is not available on non-Darwin platforms. Fix this. --- Tests/GRDBTests/DatabaseMigratorTests.swift | 2 ++ Tests/GRDBTests/DatabaseRegionObservationTests.swift | 2 ++ Tests/GRDBTests/ValueObservationTests.swift | 2 ++ 3 files changed, 6 insertions(+) diff --git a/Tests/GRDBTests/DatabaseMigratorTests.swift b/Tests/GRDBTests/DatabaseMigratorTests.swift index da09225083..73d873020d 100644 --- a/Tests/GRDBTests/DatabaseMigratorTests.swift +++ b/Tests/GRDBTests/DatabaseMigratorTests.swift @@ -9,6 +9,7 @@ class DatabaseMigratorTests : GRDBTestCase { try migrator.migrate(writer) } + #if canImport(Combine) func testEmptyMigratorSync() throws { func test(writer: some DatabaseWriter) throws { let migrator = DatabaseMigrator() @@ -347,6 +348,7 @@ class DatabaseMigratorTests : GRDBTestCase { try Test(test).runAtTemporaryDatabasePath { try DatabasePool(path: $0) } } + #endif func testMigrationFailureTriggersRollback() throws { var migrator = DatabaseMigrator() migrator.registerMigration("createPersons") { db in diff --git a/Tests/GRDBTests/DatabaseRegionObservationTests.swift b/Tests/GRDBTests/DatabaseRegionObservationTests.swift index 3ffdfc39eb..6338a76057 100644 --- a/Tests/GRDBTests/DatabaseRegionObservationTests.swift +++ b/Tests/GRDBTests/DatabaseRegionObservationTests.swift @@ -4,12 +4,14 @@ import GRDB class DatabaseRegionObservationTests: GRDBTestCase { // Test passes if it compiles. // See + #if canImport(Combine) func testAnyDatabaseWriter(writer: any DatabaseWriter) throws { let observation = DatabaseRegionObservation(tracking: .fullDatabase) _ = observation.start(in: writer, onError: { _ in }, onChange: { _ in }) _ = observation.publisher(in: writer) } + #endif func testDatabaseRegionObservation_FullDatabase() throws { let dbQueue = try makeDatabaseQueue() diff --git a/Tests/GRDBTests/ValueObservationTests.swift b/Tests/GRDBTests/ValueObservationTests.swift index 6134d8453b..e884fc2a0e 100644 --- a/Tests/GRDBTests/ValueObservationTests.swift +++ b/Tests/GRDBTests/ValueObservationTests.swift @@ -926,6 +926,7 @@ class ValueObservationTests: GRDBTestCase { } // MARK: - Async Await +#if canImport(Combine) func testAsyncAwait_values_prefix() async throws { func test(_ writer: some DatabaseWriter) async throws { @@ -1238,6 +1239,7 @@ class ValueObservationTests: GRDBTestCase { try Test(test).runAtTemporaryDatabasePath { try DatabasePool(path: $0) } } +#endif // Regression test for func testIssue1383() throws { From a212bf9e8993fceccbca4ace7dc7902c7f1cd324 Mon Sep 17 00:00:00 2001 From: Tim De Jong Date: Thu, 2 Oct 2025 17:06:58 +0200 Subject: [PATCH 15/33] It should be canImport(Darwin) not os(Darwin) --- GRDB/Core/Support/CoreGraphics/CGFloat.swift | 2 +- GRDB/Core/Support/Foundation/URL.swift | 2 +- Tests/GRDBTests/CGFloatTests.swift | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/GRDB/Core/Support/CoreGraphics/CGFloat.swift b/GRDB/Core/Support/CoreGraphics/CGFloat.swift index 11487c6b4e..99d6153506 100644 --- a/GRDB/Core/Support/CoreGraphics/CGFloat.swift +++ b/GRDB/Core/Support/CoreGraphics/CGFloat.swift @@ -1,6 +1,6 @@ #if canImport(CoreGraphics) import CoreGraphics -#elseif !os(Darwin) +#elseif !canImport(Darwin) import Foundation #endif diff --git a/GRDB/Core/Support/Foundation/URL.swift b/GRDB/Core/Support/Foundation/URL.swift index d8a8b1c809..b3630b14a4 100644 --- a/GRDB/Core/Support/Foundation/URL.swift +++ b/GRDB/Core/Support/Foundation/URL.swift @@ -6,7 +6,7 @@ extension NSURL: DatabaseValueConvertible { /// Returns a TEXT database value containing the absolute URL. public var databaseValue: DatabaseValue { - #if !os(Darwin) + #if !canImport(Darwin) absoluteString.databaseValue #else absoluteString?.databaseValue ?? .null diff --git a/Tests/GRDBTests/CGFloatTests.swift b/Tests/GRDBTests/CGFloatTests.swift index 3e0bd21c87..4c9ebd93b4 100644 --- a/Tests/GRDBTests/CGFloatTests.swift +++ b/Tests/GRDBTests/CGFloatTests.swift @@ -3,7 +3,7 @@ import GRDB #if canImport(CoreGraphics) import CoreGraphics -#elseif !os(Darwin) +#elseif !canImport(Darwin) import Foundation #endif From 389c3e0d4a255eaec3b152cff4ed851bfcdc4f67 Mon Sep 17 00:00:00 2001 From: Tim De Jong Date: Fri, 3 Oct 2025 09:30:54 +0200 Subject: [PATCH 16/33] Use #if !canImport(Combine) per test case (as done by @marcprux) and throw an XCTSkip for these test cases. This gives a better impression how many tests are skipped on Linux/non-Darwin platforms. --- Tests/GRDBTests/DatabaseMigratorTests.swift | 46 ++++++++++++++++++++- 1 file changed, 44 insertions(+), 2 deletions(-) diff --git a/Tests/GRDBTests/DatabaseMigratorTests.swift b/Tests/GRDBTests/DatabaseMigratorTests.swift index 73d873020d..1b053e2583 100644 --- a/Tests/GRDBTests/DatabaseMigratorTests.swift +++ b/Tests/GRDBTests/DatabaseMigratorTests.swift @@ -9,8 +9,10 @@ class DatabaseMigratorTests : GRDBTestCase { try migrator.migrate(writer) } - #if canImport(Combine) func testEmptyMigratorSync() throws { +#if !canImport(Combine) + throw XCTSkip("Combine not supported on this platform") +#else func test(writer: some DatabaseWriter) throws { let migrator = DatabaseMigrator() try migrator.migrate(writer) @@ -19,9 +21,13 @@ class DatabaseMigratorTests : GRDBTestCase { try Test(test).run { try DatabaseQueue() } try Test(test).runAtTemporaryDatabasePath { try DatabaseQueue(path: $0) } try Test(test).runAtTemporaryDatabasePath { try DatabasePool(path: $0) } +#endif } func testEmptyMigratorAsync() throws { +#if !canImport(Combine) + throw XCTSkip("Combine not supported on this platform") +#else func test(writer: some DatabaseWriter) throws { let expectation = self.expectation(description: "") let migrator = DatabaseMigrator() @@ -39,9 +45,13 @@ class DatabaseMigratorTests : GRDBTestCase { try Test(test).run { try DatabaseQueue() } try Test(test).runAtTemporaryDatabasePath { try DatabaseQueue(path: $0) } try Test(test).runAtTemporaryDatabasePath { try DatabasePool(path: $0) } +#endif } func testEmptyMigratorPublisher() throws { +#if !canImport(Combine) + throw XCTSkip("Combine not supported on this platform") +#else func test(writer: some DatabaseWriter) throws { let migrator = DatabaseMigrator() let publisher = migrator.migratePublisher(writer) @@ -52,9 +62,13 @@ class DatabaseMigratorTests : GRDBTestCase { try Test(test).run { try DatabaseQueue() } try Test(test).runAtTemporaryDatabasePath { try DatabaseQueue(path: $0) } try Test(test).runAtTemporaryDatabasePath { try DatabasePool(path: $0) } +#endif } func testNonEmptyMigratorSync() throws { +#if !canImport(Combine) + throw XCTSkip("Combine not supported on this platform") +#else func test(writer: some DatabaseWriter) throws { var migrator = DatabaseMigrator() migrator.registerMigration("createPersons") { db in @@ -96,9 +110,13 @@ class DatabaseMigratorTests : GRDBTestCase { try Test(test).run { try DatabaseQueue() } try Test(test).runAtTemporaryDatabasePath { try DatabaseQueue(path: $0) } try Test(test).runAtTemporaryDatabasePath { try DatabasePool(path: $0) } +#endif } func testNonEmptyMigratorAsync() throws { +#if !canImport(Combine) + throw XCTSkip("Combine not supported on this platform") +#else func test(writer: some DatabaseWriter) throws { var migrator = DatabaseMigrator() migrator.registerMigration("createPersons") { db in @@ -147,9 +165,13 @@ class DatabaseMigratorTests : GRDBTestCase { try Test(test).run { try DatabaseQueue() } try Test(test).runAtTemporaryDatabasePath { try DatabaseQueue(path: $0) } try Test(test).runAtTemporaryDatabasePath { try DatabasePool(path: $0) } +#endif } func testNonEmptyMigratorPublisher() throws { +#if !canImport(Combine) + throw XCTSkip("Combine not supported on this platform") +#else func test(writer: some DatabaseWriter) throws { var migrator = DatabaseMigrator() migrator.registerMigration("createPersons") { db in @@ -199,9 +221,13 @@ class DatabaseMigratorTests : GRDBTestCase { try Test(test).run { try DatabaseQueue() } try Test(test).runAtTemporaryDatabasePath { try DatabaseQueue(path: $0) } try Test(test).runAtTemporaryDatabasePath { try DatabasePool(path: $0) } +#endif } func testEmptyMigratorPublisherIsAsynchronous() throws { +#if !canImport(Combine) + throw XCTSkip("Combine not supported on this platform") +#else func test(writer: some DatabaseWriter) throws { let migrator = DatabaseMigrator() let expectation = self.expectation(description: "") @@ -221,9 +247,13 @@ class DatabaseMigratorTests : GRDBTestCase { try Test(test).run { try DatabaseQueue() } try Test(test).runAtTemporaryDatabasePath { try DatabaseQueue(path: $0) } try Test(test).runAtTemporaryDatabasePath { try DatabasePool(path: $0) } +#endif } func testNonEmptyMigratorPublisherIsAsynchronous() throws { +#if !canImport(Combine) + throw XCTSkip("Combine not supported on this platform") +#else func test(writer: some DatabaseWriter) throws { var migrator = DatabaseMigrator() migrator.registerMigration("first", migrate: { _ in }) @@ -244,9 +274,13 @@ class DatabaseMigratorTests : GRDBTestCase { try Test(test).run { try DatabaseQueue() } try Test(test).runAtTemporaryDatabasePath { try DatabaseQueue(path: $0) } try Test(test).runAtTemporaryDatabasePath { try DatabasePool(path: $0) } +#endif } func testMigratorPublisherDefaultScheduler() throws { +#if !canImport(Combine) + throw XCTSkip("Combine not supported on this platform") +#else func test(writer: Writer) { var migrator = DatabaseMigrator() migrator.registerMigration("first", migrate: { _ in }) @@ -269,9 +303,13 @@ class DatabaseMigratorTests : GRDBTestCase { try Test(test).run { try DatabaseQueue() } try Test(test).runAtTemporaryDatabasePath { try DatabaseQueue(path: $0) } try Test(test).runAtTemporaryDatabasePath { try DatabasePool(path: $0) } +#endif } func testMigratorPublisherCustomScheduler() throws { +#if !canImport(Combine) + throw XCTSkip("Combine not supported on this platform") +#else func test(writer: Writer) { var migrator = DatabaseMigrator() migrator.registerMigration("first", migrate: { _ in }) @@ -295,9 +333,13 @@ class DatabaseMigratorTests : GRDBTestCase { try Test(test).run { try DatabaseQueue() } try Test(test).runAtTemporaryDatabasePath { try DatabaseQueue(path: $0) } try Test(test).runAtTemporaryDatabasePath { try DatabasePool(path: $0) } +#endif } func testMigrateUpTo() throws { +#if !canImport(Combine) + throw XCTSkip("Combine not supported on this platform") +#else func test(writer: some DatabaseWriter) throws { var migrator = DatabaseMigrator() migrator.registerMigration("a") { db in @@ -346,9 +388,9 @@ class DatabaseMigratorTests : GRDBTestCase { try Test(test).run { try DatabaseQueue() } try Test(test).runAtTemporaryDatabasePath { try DatabaseQueue(path: $0) } try Test(test).runAtTemporaryDatabasePath { try DatabasePool(path: $0) } +#endif } - #endif func testMigrationFailureTriggersRollback() throws { var migrator = DatabaseMigrator() migrator.registerMigration("createPersons") { db in From d7cf0f9e59c46054d1dcbbe1b145c19c8ed8de30 Mon Sep 17 00:00:00 2001 From: Tim De Jong Date: Sun, 12 Oct 2025 17:17:47 +0200 Subject: [PATCH 17/33] NSError bridging is not available, or doesn't work the same on non-Darwin platforms. Skip testNSErrorBridging on these platforms. --- Tests/GRDBTests/DatabaseErrorTests.swift | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Tests/GRDBTests/DatabaseErrorTests.swift b/Tests/GRDBTests/DatabaseErrorTests.swift index e968b44074..d0106ad64b 100644 --- a/Tests/GRDBTests/DatabaseErrorTests.swift +++ b/Tests/GRDBTests/DatabaseErrorTests.swift @@ -216,6 +216,9 @@ class DatabaseErrorTests: GRDBTestCase { } func testNSErrorBridging() throws { +#if !canImport(Darwin) + throw XCTSkip("NSError bridging not available on non-Darwin platforms") +#else let dbQueue = try makeDatabaseQueue() try dbQueue.inDatabase { db in try db.create(table: "parents") { $0.column("id", .integer).primaryKey() } @@ -229,5 +232,6 @@ class DatabaseErrorTests: GRDBTestCase { XCTAssertNotNil(error.localizedFailureReason) } } +#endif } } From 3dd3bbf0c5ab23fb8576f380d9a5564bc83ca846 Mon Sep 17 00:00:00 2001 From: Tim De Jong Date: Sun, 12 Oct 2025 16:43:31 +0200 Subject: [PATCH 18/33] vscode config --- .vscode/settings.json | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 .vscode/settings.json diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000000..35164a22f8 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,7 @@ +{ + "editor.formatOnSave": false, + "editor.insertSpaces": true, + "editor.tabSize": 4, + "editor.detectIndentation": false, + "editor.trimAutoWhitespace": false +} \ No newline at end of file From 5db6c36c2de25970db3adc0cbc9b48b729dadad5 Mon Sep 17 00:00:00 2001 From: Tim De Jong Date: Fri, 7 Nov 2025 10:58:59 +0100 Subject: [PATCH 19/33] Added a ci for ubuntu --- .github/workflows/ubuntu-ci.yml | 55 +++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 .github/workflows/ubuntu-ci.yml diff --git a/.github/workflows/ubuntu-ci.yml b/.github/workflows/ubuntu-ci.yml new file mode 100644 index 0000000000..3f3bce9200 --- /dev/null +++ b/.github/workflows/ubuntu-ci.yml @@ -0,0 +1,55 @@ +# https://github.com/actions/runner-images/blob/main/images/macos/macos-15-Readme.md + +name: "Ubuntu Linux CI" + +on: + push: + branches: + - master + - development + paths: + - 'GRDB/**' + - 'Tests/**' + - '.github/workflows/**' + - 'Makefile' + - 'Package.swift' + - 'SQLiteCustom/src' + pull_request: + paths: + - 'GRDB/**' + - 'Tests/**' + - '.github/workflows/**' + - 'Makefile' + - 'Package.swift' + - 'SQLiteCustom/src' + +concurrency: + group: ${{ github.ref_name }} + cancel-in-progress: true +permissions: + contents: read + +jobs: + build-and-test-on-linux: + runs-on: ${{ matrix.os }} + env: + DEVELOPER_DIR: "/Applications/${{ matrix.xcode }}/Contents/Developer" + timeout-minutes: 60 + strategy: + matrix: + os: [ubuntu-latest] + swift: ["6.1.0", "6.2.0"] + steps: + - name: Checkout Repository + uses: actions/checkout@v5 + + - name: Setup Environment + uses: swift-actions/setup-swift@v2 + with: + swift-version: ${{ matrix.swift }} + + - name: Build SPM Package + run: swift build -c release -v + + - name: Run tests + run: swift test -c release From c3c0275046f83239fc5b4faedad751f81990411f Mon Sep 17 00:00:00 2001 From: Tim De Jong Date: Fri, 7 Nov 2025 11:01:06 +0100 Subject: [PATCH 20/33] Added the grdb_linux_changes branch to test the github actions for ubuntu --- .github/workflows/ubuntu-ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ubuntu-ci.yml b/.github/workflows/ubuntu-ci.yml index 3f3bce9200..30c2ae9095 100644 --- a/.github/workflows/ubuntu-ci.yml +++ b/.github/workflows/ubuntu-ci.yml @@ -7,6 +7,7 @@ on: branches: - master - development + - grdb_linux_changes paths: - 'GRDB/**' - 'Tests/**' From 7e3d68abaa1bc0ba6dee8e07e2c4296c9bdacf75 Mon Sep 17 00:00:00 2001 From: Tim De Jong Date: Fri, 7 Nov 2025 11:02:17 +0100 Subject: [PATCH 21/33] swift 6.2.0 is apparently not available for setup-swift@v2 --- .github/workflows/ubuntu-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ubuntu-ci.yml b/.github/workflows/ubuntu-ci.yml index 30c2ae9095..677ac8a026 100644 --- a/.github/workflows/ubuntu-ci.yml +++ b/.github/workflows/ubuntu-ci.yml @@ -39,7 +39,7 @@ jobs: strategy: matrix: os: [ubuntu-latest] - swift: ["6.1.0", "6.2.0"] + swift: ["6.1.0"] steps: - name: Checkout Repository uses: actions/checkout@v5 From 46fdfa8d1cba579da4fd9822ce8ef77ff4d1760f Mon Sep 17 00:00:00 2001 From: Tim De Jong Date: Fri, 7 Nov 2025 11:17:08 +0100 Subject: [PATCH 22/33] Added a batch for the linux build. Now for the grdb_linux_changes branch tho --- .github/workflows/ubuntu-ci.yml | 2 -- README.md | 1 + 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/ubuntu-ci.yml b/.github/workflows/ubuntu-ci.yml index 677ac8a026..eff4abc913 100644 --- a/.github/workflows/ubuntu-ci.yml +++ b/.github/workflows/ubuntu-ci.yml @@ -33,8 +33,6 @@ permissions: jobs: build-and-test-on-linux: runs-on: ${{ matrix.os }} - env: - DEVELOPER_DIR: "/Applications/${{ matrix.xcode }}/Contents/Developer" timeout-minutes: 60 strategy: matrix: diff --git a/README.md b/README.md index 4261c65e8f..927e1c1bd5 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,7 @@ Swift 6.1 License CI Status + Linux Status

--- From dd418160e78fc2c67ee6dc558ee4f06427da7bbd Mon Sep 17 00:00:00 2001 From: Tim De Jong Date: Fri, 7 Nov 2025 11:34:13 +0100 Subject: [PATCH 23/33] Renamed Ubuntu Linux CI to Linux CI and point the badge to the correct location --- .github/workflows/ubuntu-ci.yml | 2 +- README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ubuntu-ci.yml b/.github/workflows/ubuntu-ci.yml index eff4abc913..d02a5762c7 100644 --- a/.github/workflows/ubuntu-ci.yml +++ b/.github/workflows/ubuntu-ci.yml @@ -1,6 +1,6 @@ # https://github.com/actions/runner-images/blob/main/images/macos/macos-15-Readme.md -name: "Ubuntu Linux CI" +name: "Linux CI" on: push: diff --git a/README.md b/README.md index 927e1c1bd5..1682f59ce8 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ Swift 6.1 License CI Status - Linux Status + Linux Status

--- From 7775237bb077884aea1d7a3142042f395e3ac791 Mon Sep 17 00:00:00 2001 From: Tim De Jong Date: Fri, 7 Nov 2025 11:45:27 +0100 Subject: [PATCH 24/33] See if we can install swift via swiftly --- .github/workflows/ubuntu-ci.yml | 48 ++++++++++++++++++++++++++++++--- 1 file changed, 45 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ubuntu-ci.yml b/.github/workflows/ubuntu-ci.yml index d02a5762c7..ce5919c422 100644 --- a/.github/workflows/ubuntu-ci.yml +++ b/.github/workflows/ubuntu-ci.yml @@ -42,10 +42,52 @@ jobs: - name: Checkout Repository uses: actions/checkout@v5 - - name: Setup Environment - uses: swift-actions/setup-swift@v2 + - name: Install Swift Dependencies + run: sudo apt-get update \ + sudo apt-get install -y \ + binutils \ + git \ + gnupg2 \ + libc6-dev \ + libcurl4-openssl-dev \ + libedit2 \ + libgcc-13-dev \ + libpython3-dev \ + libsqlite3-0 \ + libstdc++-13-dev \ + libxml2-dev \ + libz3-dev \ + pkg-config \ + python3-lldb \ + tzdata \ + unzip \ + zip \ + zlib1g-dev \ + wget \ + curl \ + ca-certificates \ + util-linux + + - name: Cache Swiftly toolchains + id: cache-swiftly + uses: actions/cache@v4 with: - swift-version: ${{ matrix.swift }} + path: ~/.swiftly + key: swiftly-${{ runner.os }}-${{ matrix.swift }} + + - name: Install Swift Using Swiftly + run: | + curl -O https://download.swift.org/swiftly/linux/swiftly-$(uname -m).tar.gz + tar zxf swiftly-$(uname -m).tar.gz + ./swiftly init --quiet-shell-followup + . "${SWIFTLY_HOME_DIR:-$HOME/.local/share/swiftly}/env.sh" + hash -r + swiftly install ${{ matrix.swift }} --assume-yes --use + . "${SWIFTLY_HOME_DIR:-$HOME/.local/share/swiftly}/env.sh" + # - name: Setup Environment + # uses: swift-actions/setup-swift@v2 + # with: + # swift-version: ${{ matrix.swift }} - name: Build SPM Package run: swift build -c release -v From 8aaf0a619b1b591c069d46693e73ac480bb3d869 Mon Sep 17 00:00:00 2001 From: Tim De Jong Date: Fri, 7 Nov 2025 11:46:40 +0100 Subject: [PATCH 25/33] Small change --- .github/workflows/ubuntu-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ubuntu-ci.yml b/.github/workflows/ubuntu-ci.yml index ce5919c422..ed2fe65a65 100644 --- a/.github/workflows/ubuntu-ci.yml +++ b/.github/workflows/ubuntu-ci.yml @@ -43,7 +43,7 @@ jobs: uses: actions/checkout@v5 - name: Install Swift Dependencies - run: sudo apt-get update \ + run: sudo apt-get update sudo apt-get install -y \ binutils \ git \ From 6a2c9b537c6d8f4fc80bb07448f557a4d8d63adc Mon Sep 17 00:00:00 2001 From: Tim De Jong Date: Fri, 7 Nov 2025 11:48:11 +0100 Subject: [PATCH 26/33] Check whether this works --- .github/workflows/ubuntu-ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ubuntu-ci.yml b/.github/workflows/ubuntu-ci.yml index ed2fe65a65..d7c4a02a63 100644 --- a/.github/workflows/ubuntu-ci.yml +++ b/.github/workflows/ubuntu-ci.yml @@ -43,7 +43,8 @@ jobs: uses: actions/checkout@v5 - name: Install Swift Dependencies - run: sudo apt-get update + run: | + sudo apt-get update sudo apt-get install -y \ binutils \ git \ From e7850f91372b98629459e2bd94f9d21155e15b17 Mon Sep 17 00:00:00 2001 From: Tim De Jong Date: Fri, 7 Nov 2025 11:56:27 +0100 Subject: [PATCH 27/33] Removed -v flag to silence the warnings a bit --- .github/workflows/ubuntu-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ubuntu-ci.yml b/.github/workflows/ubuntu-ci.yml index d7c4a02a63..7fd48a2695 100644 --- a/.github/workflows/ubuntu-ci.yml +++ b/.github/workflows/ubuntu-ci.yml @@ -91,7 +91,7 @@ jobs: # swift-version: ${{ matrix.swift }} - name: Build SPM Package - run: swift build -c release -v + run: swift build -c release - name: Run tests run: swift test -c release From be47b71b3623f41233b17b647949e862d6dd6f92 Mon Sep 17 00:00:00 2001 From: Tim De Jong Date: Fri, 7 Nov 2025 12:02:42 +0100 Subject: [PATCH 28/33] Added fail-fast false to see whether the linker completes --- .github/workflows/ubuntu-ci.yml | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ubuntu-ci.yml b/.github/workflows/ubuntu-ci.yml index 7fd48a2695..671084a289 100644 --- a/.github/workflows/ubuntu-ci.yml +++ b/.github/workflows/ubuntu-ci.yml @@ -35,9 +35,10 @@ jobs: runs-on: ${{ matrix.os }} timeout-minutes: 60 strategy: + fail-fast: false matrix: os: [ubuntu-latest] - swift: ["6.1.0"] + swift: ["6.2", "6.1.0"] steps: - name: Checkout Repository uses: actions/checkout@v5 @@ -85,13 +86,11 @@ jobs: hash -r swiftly install ${{ matrix.swift }} --assume-yes --use . "${SWIFTLY_HOME_DIR:-$HOME/.local/share/swiftly}/env.sh" - # - name: Setup Environment - # uses: swift-actions/setup-swift@v2 - # with: - # swift-version: ${{ matrix.swift }} - name: Build SPM Package - run: swift build -c release + run: | + swift build -c release - name: Run tests - run: swift test -c release + run: | + swift test -c release From a5283f5002d74e6a1fc36892c46a98aa2cd6ad1f Mon Sep 17 00:00:00 2001 From: Tim De Jong Date: Fri, 7 Nov 2025 12:24:30 +0100 Subject: [PATCH 29/33] Try to silence swiftly prompt --- .github/workflows/ubuntu-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ubuntu-ci.yml b/.github/workflows/ubuntu-ci.yml index 671084a289..2fe519e1ef 100644 --- a/.github/workflows/ubuntu-ci.yml +++ b/.github/workflows/ubuntu-ci.yml @@ -81,7 +81,7 @@ jobs: run: | curl -O https://download.swift.org/swiftly/linux/swiftly-$(uname -m).tar.gz tar zxf swiftly-$(uname -m).tar.gz - ./swiftly init --quiet-shell-followup + ./swiftly init --quiet-shell-followup -y . "${SWIFTLY_HOME_DIR:-$HOME/.local/share/swiftly}/env.sh" hash -r swiftly install ${{ matrix.swift }} --assume-yes --use From 1e39d943b577dd18285283de1be01f6fc5dd2318 Mon Sep 17 00:00:00 2001 From: Tim De Jong Date: Fri, 7 Nov 2025 13:12:35 +0100 Subject: [PATCH 30/33] Fixed caching path for swiftly --- .github/workflows/ubuntu-ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ubuntu-ci.yml b/.github/workflows/ubuntu-ci.yml index 2fe519e1ef..401cfb5347 100644 --- a/.github/workflows/ubuntu-ci.yml +++ b/.github/workflows/ubuntu-ci.yml @@ -74,10 +74,11 @@ jobs: id: cache-swiftly uses: actions/cache@v4 with: - path: ~/.swiftly + path: ${SWIFTLY_HOME_DIR:-$HOME/.local/share/swiftly} key: swiftly-${{ runner.os }}-${{ matrix.swift }} - name: Install Swift Using Swiftly + if: steps.cache-swiftly.outputs.cache-hit != 'true' run: | curl -O https://download.swift.org/swiftly/linux/swiftly-$(uname -m).tar.gz tar zxf swiftly-$(uname -m).tar.gz From 5ba2087275c5379bb8d43ba58bc0977fb46f0fec Mon Sep 17 00:00:00 2001 From: Tim De Jong Date: Fri, 7 Nov 2025 13:28:07 +0100 Subject: [PATCH 31/33] Use 6.1 instead of 6.1.0 to use the latest available 6.1 version with swiftly --- .github/workflows/ubuntu-ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ubuntu-ci.yml b/.github/workflows/ubuntu-ci.yml index 401cfb5347..5557942aff 100644 --- a/.github/workflows/ubuntu-ci.yml +++ b/.github/workflows/ubuntu-ci.yml @@ -38,7 +38,7 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest] - swift: ["6.2", "6.1.0"] + swift: ["6.2", "6.1"] steps: - name: Checkout Repository uses: actions/checkout@v5 @@ -82,7 +82,7 @@ jobs: run: | curl -O https://download.swift.org/swiftly/linux/swiftly-$(uname -m).tar.gz tar zxf swiftly-$(uname -m).tar.gz - ./swiftly init --quiet-shell-followup -y + ./swiftly init --quiet-shell-followup -y --skip-install . "${SWIFTLY_HOME_DIR:-$HOME/.local/share/swiftly}/env.sh" hash -r swiftly install ${{ matrix.swift }} --assume-yes --use From 3c98b5f403380c58dae6d74518e00868af5915ac Mon Sep 17 00:00:00 2001 From: Tim De Jong Date: Fri, 7 Nov 2025 13:41:21 +0100 Subject: [PATCH 32/33] Check if matrix.os helps in caching swiftly. --- .github/workflows/ubuntu-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ubuntu-ci.yml b/.github/workflows/ubuntu-ci.yml index 5557942aff..8d4a12a4e1 100644 --- a/.github/workflows/ubuntu-ci.yml +++ b/.github/workflows/ubuntu-ci.yml @@ -75,7 +75,7 @@ jobs: uses: actions/cache@v4 with: path: ${SWIFTLY_HOME_DIR:-$HOME/.local/share/swiftly} - key: swiftly-${{ runner.os }}-${{ matrix.swift }} + key: swiftly-${{ matrix.os }}-${{ matrix.swift }} - name: Install Swift Using Swiftly if: steps.cache-swiftly.outputs.cache-hit != 'true' From 492dbebe39cb1d70b1b4ce115a24f96952985ca3 Mon Sep 17 00:00:00 2001 From: Tim De Jong Date: Fri, 7 Nov 2025 19:27:14 +0100 Subject: [PATCH 33/33] Changed cancel-in-progress to false based on a comment by @marcprux --- .github/workflows/ubuntu-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ubuntu-ci.yml b/.github/workflows/ubuntu-ci.yml index 8d4a12a4e1..a961c47bd6 100644 --- a/.github/workflows/ubuntu-ci.yml +++ b/.github/workflows/ubuntu-ci.yml @@ -26,7 +26,7 @@ on: concurrency: group: ${{ github.ref_name }} - cancel-in-progress: true + cancel-in-progress: false permissions: contents: read