diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 54475b7..295de01 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,7 +19,7 @@ jobs: - name: Build run: xcodebuild -scheme InfomaniakCore build -destination "platform=iOS Simulator,name=iPhone 16,OS=latest" - name: Test - run: xcodebuild -scheme InfomaniakCore-Package test -destination "platform=iOS Simulator,name=iPhone 16,OS=latest" + run: Scripts/prepareForTesting.sh && xcodebuild -scheme InfomaniakCore-Package test -destination "platform=iOS Simulator,name=iPhone 16,OS=latest" build_and_test_macOS: name: Build and Test project on macOS @@ -35,4 +35,4 @@ jobs: - name: Build run: swift build - name: Test - run: swift test + run: Scripts/prepareForTesting.sh && swift test diff --git a/Package.resolved b/Package.resolved index beba15e..7a2905c 100644 --- a/Package.resolved +++ b/Package.resolved @@ -5,8 +5,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/Alamofire/Alamofire", "state" : { - "revision" : "ea6a94b7dddffd0ca4d0f29252d95310b84dec84", - "version" : "5.10.0" + "revision" : "513364f870f6bfc468f9d2ff0a95caccc10044c5", + "version" : "5.10.2" } }, { @@ -50,8 +50,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/realm/realm-core.git", "state" : { - "revision" : "c2552e1d36867cb42b28130e894a81fc17081062", - "version" : "14.12.0" + "revision" : "85eeca41654cc9070ad81a21a4b1d153ad467c33", + "version" : "14.13.1" } }, { @@ -59,8 +59,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/realm/realm-swift", "state" : { - "revision" : "5221a83dc720823e3017493394d00d49ccf13446", - "version" : "10.52.3" + "revision" : "a3abcdf95a3176f5ad990239920aad4ef86e00de", + "version" : "10.54.2" } }, { @@ -68,8 +68,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/getsentry/sentry-cocoa", "state" : { - "revision" : "54cc2e3e4fcbf9d4c7708ce00d3b6eee29aecbb1", - "version" : "8.38.0" + "revision" : "110fbe350c057722288b39e757afcb0830695d75", + "version" : "8.42.0" } }, { @@ -77,8 +77,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/apple/swift-log", "state" : { - "revision" : "9cb486020ebf03bfa5b5df985387a14a98744537", - "version" : "1.6.1" + "revision" : "96a2f8a0fa41e9e09af4585e2724c4e825410b91", + "version" : "1.6.2" } }, { diff --git a/Package.swift b/Package.swift index 60a10da..e16f1e4 100644 --- a/Package.swift +++ b/Package.swift @@ -1,8 +1,23 @@ // swift-tools-version:5.7 // The swift-tools-version declares the minimum version of Swift required to build this package. +import Foundation import PackageDescription +let resolveDependenciesForTesting = false + +let realmDependencies: [Target.Dependency] +if resolveDependenciesForTesting { + realmDependencies = [ + .product(name: "RealmSwift", package: "realm-swift") + ] +} else { + realmDependencies = [ + .product(name: "Realm", package: "realm-swift"), + .product(name: "RealmSwift", package: "realm-swift") + ] +} + let package = Package( name: "InfomaniakCore", platforms: [ @@ -36,9 +51,9 @@ let package = Package( "Alamofire", .product(name: "InfomaniakDI", package: "ios-dependency-injection"), .product(name: "InfomaniakLogin", package: "ios-login"), - .product(name: "Sentry", package: "sentry-cocoa"), - .product(name: "RealmSwift", package: "realm-swift"), + .product(name: "Sentry-Dynamic", package: "sentry-cocoa"), .product(name: "CocoaLumberjackSwift", package: "CocoaLumberjack"), + .product(name: "CocoaLumberjack", package: "CocoaLumberjack"), .product(name: "OSInfo", package: "OSInfo") ] ), @@ -46,9 +61,8 @@ let package = Package( name: "InfomaniakCoreDB", dependencies: [ "InfomaniakCore", - .product(name: "InfomaniakDI", package: "ios-dependency-injection"), - .product(name: "RealmSwift", package: "realm-swift") - ] + .product(name: "InfomaniakDI", package: "ios-dependency-injection") + ] + realmDependencies ), .testTarget( name: "InfomaniakCoreTests", diff --git a/Scripts/prepareForTesting.sh b/Scripts/prepareForTesting.sh new file mode 100755 index 0000000..1f54492 --- /dev/null +++ b/Scripts/prepareForTesting.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +file="Package.swift" + +sed -i '' 's/let resolveDependenciesForTesting = false/let resolveDependenciesForTesting = true/' "$file" + +echo "$file ready for tests"