From 221a592be3e88e5fcf90837a249f55e11cc07cc0 Mon Sep 17 00:00:00 2001 From: Nikola Irinchev Date: Fri, 23 Feb 2024 14:12:55 +0100 Subject: [PATCH 01/16] Update to .net 8 --- .github/templates/build-packages.yml | 2 +- .github/templates/common.lib.yml | 4 ++-- .github/templates/main.yml | 2 +- .github/templates/pr.yml | 2 +- .github/templates/test-code-coverage.yml | 2 +- .github/templates/test-net-core.yml | 4 ++-- .github/templates/test-woven-classes.yml | 2 +- .github/workflows/build-packages.yml | 4 ++-- .github/workflows/codeql.yml | 2 +- .github/workflows/main.yml | 2 +- .github/workflows/pr.yml | 2 +- .github/workflows/test-android.yml | 2 +- .github/workflows/test-code-coverage.yml | 4 ++-- .github/workflows/test-ios.yml | 2 +- .github/workflows/test-macos.yml | 2 +- .github/workflows/test-net-core.yml | 4 ++-- .github/workflows/test-source-generation.yml | 2 +- .github/workflows/test-weaver.yml | 2 +- .github/workflows/test-woven-classes.yml | 4 ++-- Realm/Realm.PlatformHelpers/Realm.PlatformHelpers.csproj | 6 +++--- Realm/Realm/Realm.csproj | 4 ++-- Tests/Realm.Tests/Realm.Tests.csproj | 2 +- Tests/Realm.Tests/Sync/SyncTestHelpers.cs | 3 ++- global.json | 2 +- 24 files changed, 34 insertions(+), 33 deletions(-) diff --git a/.github/templates/build-packages.yml b/.github/templates/build-packages.yml index 5854261d0b..777337796b 100644 --- a/.github/templates/build-packages.yml +++ b/.github/templates/build-packages.yml @@ -15,7 +15,7 @@ Invoke-WebRequest -Uri https://github.com/dotnet/docfx/releases/download/v2.75.2/docfx-win-x64-v2.75.2.zip -OutFile C:\docfx.zip Expand-Archive -Path C:\docfx.zip -DestinationPath C:\docfx shell: powershell - - _: #@ template.replace(setupDotnet("7.0.x", ifCondition = "inputs.build-docs")) + - _: #@ template.replace(setupDotnet("8.0.x", ifCondition = "inputs.build-docs")) - name: Build docs if: inputs.build-docs env: diff --git a/.github/templates/common.lib.yml b/.github/templates/common.lib.yml index b2b14e3845..a5806c910a 100644 --- a/.github/templates/common.lib.yml +++ b/.github/templates/common.lib.yml @@ -190,7 +190,7 @@ with: if-no-files-found: error #@ end --- -#@ def setupDotnet(version = "6.0.x", ifCondition = ""): +#@ def setupDotnet(version = "8.0.x", ifCondition = ""): name: Configure .NET uses: #@ actionSetupDotnet #@ if (ifCondition != ""): @@ -231,7 +231,7 @@ with: #@ end --- #@ def setupWorkloads(workloads = 'maui'): - - _: #@ template.replace(setupDotnet("7.0.x")) + - _: #@ template.replace(setupDotnet("8.0.x")) - name: Setup workloads run: #@ "dotnet workload install " + workloads #@ end diff --git a/.github/templates/main.yml b/.github/templates/main.yml index 71e090cc35..e73a9c9bb1 100644 --- a/.github/templates/main.yml +++ b/.github/templates/main.yml @@ -45,7 +45,7 @@ jobs: _: #@ template.replace(buildUnity()) _: #@ template.replace(runTests(".NET Framework")) _: #@ template.replace(runTests("UWP Managed", additionalSecrets = ["Pfx_Password", "Base64_Encoded_Pfx"])) - _: #@ template.replace(runNetCoreTests("[\"net6.0\", \"net7.0\"]")) + _: #@ template.replace(runNetCoreTests("[\"net6.0\", \"net8.0\"]")) _: #@ template.replace(runTests("macOS")) _: #@ template.replace(runTests("iOS")) _: #@ template.replace(runTests("tvOS", runSyncTests = False)) diff --git a/.github/templates/pr.yml b/.github/templates/pr.yml index 22f71ff66e..759ccc769b 100644 --- a/.github/templates/pr.yml +++ b/.github/templates/pr.yml @@ -44,7 +44,7 @@ jobs: _: #@ template.replace(testUnity('["Mono-Net4"]', '[{ "os": "windows", "testPlatform": "Windows64" }, { "os": "linux", "testPlatform": "Linux64" }]')) _: #@ template.replace(runTests(".NET Framework", runSyncTests = False)) _: #@ template.replace(runTests("UWP Managed", runSyncTests = False, additionalSecrets = ["Pfx_Password", "Base64_Encoded_Pfx"])) - _: #@ template.replace(runNetCoreTests('["net7.0"]')) + _: #@ template.replace(runNetCoreTests('["net8.0"]')) _: #@ template.replace(runTests("macOS", runSyncTests = False)) _: #@ template.replace(runTests("iOS", runSyncTests = False)) _: #@ template.replace(runTests("tvOS", runSyncTests = False)) diff --git a/.github/templates/test-code-coverage.yml b/.github/templates/test-code-coverage.yml index 8c934b378c..cbfae59535 100644 --- a/.github/templates/test-code-coverage.yml +++ b/.github/templates/test-code-coverage.yml @@ -17,7 +17,7 @@ jobs: dotnet tool install coverlet.console --tool-path tools dotnet tool install dotnet-reportgenerator-globaltool --tool-path tools echo "${{ github.workspace }}/tools" >> $GITHUB_PATH - - #@ template.replace(dotnetPublish("Tests/Realm.Tests", "net7.0", "linux-x64", { "RealmTestsStandaloneExe": "true" })) + - #@ template.replace(dotnetPublish("Tests/Realm.Tests", "net8.0", "linux-x64", { "RealmTestsStandaloneExe": "true" })) - name: Run the tests env: DOTNET_DbgEnableMiniDump: 1 diff --git a/.github/templates/test-net-core.yml b/.github/templates/test-net-core.yml index b7dc72f74d..7749ab85c9 100644 --- a/.github/templates/test-net-core.yml +++ b/.github/templates/test-net-core.yml @@ -22,11 +22,11 @@ jobs: runtime: osx-x64 framework: ${{ fromJson(inputs.framework) }} include: - - framework: net7.0 + - framework: net8.0 os: runner: macos-14 runtime: osx-arm64 - - framework: net7.0 + - framework: net8.0 os: runner: win81 runtime: win-x64 diff --git a/.github/templates/test-woven-classes.yml b/.github/templates/test-woven-classes.yml index 3343b9587d..d98a39d670 100644 --- a/.github/templates/test-woven-classes.yml +++ b/.github/templates/test-woven-classes.yml @@ -13,7 +13,7 @@ jobs: steps: - #@ template.replace(checkoutCode()) - #@ template.replace(fetchPackageArtifacts()) - - #@ template.replace(wovenClassesBuildTests("Tests/Realm.Tests", "net7.0", "win-x64")) + - #@ template.replace(wovenClassesBuildTests("Tests/Realm.Tests", "net8.0", "win-x64")) - name: Run the tests run: #@ "${{ steps.dotnet-publish.outputs.executable-path }}/Realm.Tests --result=TestResults.WovenClasses.xml --labels=After" - #@ publishTestsResults("TestResults.WovenClasses.xml", "Woven classes") diff --git a/.github/workflows/build-packages.yml b/.github/workflows/build-packages.yml index 89283c2877..0d0b2d1448 100755 --- a/.github/workflows/build-packages.yml +++ b/.github/workflows/build-packages.yml @@ -41,7 +41,7 @@ jobs: - name: Configure .NET uses: actions/setup-dotnet@607fce577a46308457984d59e4954e075820f10a with: - dotnet-version: 7.0.x + dotnet-version: 8.0.x - name: Setup workloads run: dotnet workload install tvos ios maccatalyst android - name: Set version suffix @@ -230,7 +230,7 @@ jobs: uses: actions/setup-dotnet@607fce577a46308457984d59e4954e075820f10a if: inputs.build-docs with: - dotnet-version: 7.0.x + dotnet-version: 8.0.x - name: Build docs if: inputs.build-docs env: diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index a1e5cfe7cd..efd7e97795 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -53,7 +53,7 @@ jobs: - name: Configure .NET uses: actions/setup-dotnet@607fce577a46308457984d59e4954e075820f10a with: - dotnet-version: 7.0.x + dotnet-version: 8.0.x - name: Setup workloads run: dotnet workload install tvos ios maccatalyst android - name: Add msbuild to PATH diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 80bd8325d6..3dbcf0dc01 100755 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -109,7 +109,7 @@ jobs: uses: ./.github/workflows/test-net-core.yml with: version: ${{ needs.build-packages.outputs.package_version }} - framework: '["net6.0", "net7.0"]' + framework: '["net6.0", "net8.0"]' test-macos: uses: ./.github/workflows/test-macos.yml name: Test diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 6a9889f38f..6529e3a712 100755 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -86,7 +86,7 @@ jobs: uses: ./.github/workflows/test-net-core.yml with: version: ${{ needs.build-packages.outputs.package_version }} - framework: '["net7.0"]' + framework: '["net8.0"]' test-macos: uses: ./.github/workflows/test-macos.yml name: Test diff --git a/.github/workflows/test-android.yml b/.github/workflows/test-android.yml index 967ceb6431..eb1a969bed 100755 --- a/.github/workflows/test-android.yml +++ b/.github/workflows/test-android.yml @@ -113,7 +113,7 @@ jobs: - name: Configure .NET uses: actions/setup-dotnet@607fce577a46308457984d59e4954e075820f10a with: - dotnet-version: 7.0.x + dotnet-version: 8.0.x - name: Setup workloads run: dotnet workload install maui - name: Setup JDK diff --git a/.github/workflows/test-code-coverage.yml b/.github/workflows/test-code-coverage.yml index f5b4105f18..12c93aa8fa 100755 --- a/.github/workflows/test-code-coverage.yml +++ b/.github/workflows/test-code-coverage.yml @@ -138,10 +138,10 @@ jobs: dotnet tool install dotnet-reportgenerator-globaltool --tool-path tools echo "${{ github.workspace }}/tools" >> $GITHUB_PATH - name: Publish Tests/Realm.Tests - run: dotnet publish Tests/Realm.Tests -c Release -f net7.0 -r linux-x64 -p:RealmTestsStandaloneExe=true --no-self-contained + run: dotnet publish Tests/Realm.Tests -c Release -f net8.0 -r linux-x64 -p:RealmTestsStandaloneExe=true --no-self-contained - name: Output executable path id: dotnet-publish - run: echo 'executable-path=./Tests/Realm.Tests/bin/Release/net7.0/linux-x64' >> $GITHUB_OUTPUT + run: echo 'executable-path=./Tests/Realm.Tests/bin/Release/net8.0/linux-x64' >> $GITHUB_OUTPUT shell: bash - name: Run the tests env: diff --git a/.github/workflows/test-ios.yml b/.github/workflows/test-ios.yml index 340c947dc8..21d49528dc 100755 --- a/.github/workflows/test-ios.yml +++ b/.github/workflows/test-ios.yml @@ -97,7 +97,7 @@ jobs: - name: Configure .NET uses: actions/setup-dotnet@607fce577a46308457984d59e4954e075820f10a with: - dotnet-version: 7.0.x + dotnet-version: 8.0.x - name: Setup workloads run: dotnet workload install maui - name: Build the tests diff --git a/.github/workflows/test-macos.yml b/.github/workflows/test-macos.yml index 201d1c26cc..3bebc18e54 100755 --- a/.github/workflows/test-macos.yml +++ b/.github/workflows/test-macos.yml @@ -87,7 +87,7 @@ jobs: - name: Configure .NET uses: actions/setup-dotnet@607fce577a46308457984d59e4954e075820f10a with: - dotnet-version: 7.0.x + dotnet-version: 8.0.x - name: Setup workloads run: dotnet workload install maui - name: Build the tests diff --git a/.github/workflows/test-net-core.yml b/.github/workflows/test-net-core.yml index 1d48224273..26e4a28b64 100755 --- a/.github/workflows/test-net-core.yml +++ b/.github/workflows/test-net-core.yml @@ -31,11 +31,11 @@ jobs: runtime: osx-x64 framework: ${{ fromJson(inputs.framework) }} include: - - framework: net7.0 + - framework: net8.0 os: runner: macos-14 runtime: osx-arm64 - - framework: net7.0 + - framework: net8.0 os: runner: win81 runtime: win-x64 diff --git a/.github/workflows/test-source-generation.yml b/.github/workflows/test-source-generation.yml index 11de3d0de5..9cfc79dce3 100644 --- a/.github/workflows/test-source-generation.yml +++ b/.github/workflows/test-source-generation.yml @@ -19,7 +19,7 @@ jobs: - name: Configure .NET uses: actions/setup-dotnet@607fce577a46308457984d59e4954e075820f10a with: - dotnet-version: 7.0.x + dotnet-version: 8.0.x - name: Setup workloads run: dotnet workload install tvos ios maccatalyst android - name: Publish Tests/SourceGenerators/Realm.SourceGenerator.Tests diff --git a/.github/workflows/test-weaver.yml b/.github/workflows/test-weaver.yml index 73df913678..68892cf209 100755 --- a/.github/workflows/test-weaver.yml +++ b/.github/workflows/test-weaver.yml @@ -31,7 +31,7 @@ jobs: - name: Configure .NET uses: actions/setup-dotnet@607fce577a46308457984d59e4954e075820f10a with: - dotnet-version: 7.0.x + dotnet-version: 8.0.x - name: Setup workloads run: dotnet workload install android ${{ (matrix.os.runner != 'ubuntu-latest' && 'tvos ios maccatalyst') || '' }} - name: Publish Tests/Weaver/Realm.Fody.Tests diff --git a/.github/workflows/test-woven-classes.yml b/.github/workflows/test-woven-classes.yml index 48d08a5e96..abf4eb74bf 100644 --- a/.github/workflows/test-woven-classes.yml +++ b/.github/workflows/test-woven-classes.yml @@ -37,10 +37,10 @@ jobs: name: Realm.${{ inputs.version }} path: ${{ github.workspace }}/Realm/packages/ - name: Publish Tests/Realm.Tests - run: dotnet publish Tests/Realm.Tests -c Release -f net7.0 -r win-x64 -p:RestoreConfigFile=Tests/Test.NuGet.Config -p:UseRealmNupkgsWithVersion=${{ inputs.version }} -p:TestWeavedClasses=true -p:RealmTestsStandaloneExe=true --no-self-contained + run: dotnet publish Tests/Realm.Tests -c Release -f net8.0 -r win-x64 -p:RestoreConfigFile=Tests/Test.NuGet.Config -p:UseRealmNupkgsWithVersion=${{ inputs.version }} -p:TestWeavedClasses=true -p:RealmTestsStandaloneExe=true --no-self-contained - name: Output executable path id: dotnet-publish - run: echo 'executable-path=./Tests/Realm.Tests/bin/Release/net7.0/win-x64' >> $GITHUB_OUTPUT + run: echo 'executable-path=./Tests/Realm.Tests/bin/Release/net8.0/win-x64' >> $GITHUB_OUTPUT shell: bash - name: Run the tests run: ${{ steps.dotnet-publish.outputs.executable-path }}/Realm.Tests --result=TestResults.WovenClasses.xml --labels=After diff --git a/Realm/Realm.PlatformHelpers/Realm.PlatformHelpers.csproj b/Realm/Realm.PlatformHelpers/Realm.PlatformHelpers.csproj index d976a3ba86..b04840911b 100644 --- a/Realm/Realm.PlatformHelpers/Realm.PlatformHelpers.csproj +++ b/Realm/Realm.PlatformHelpers/Realm.PlatformHelpers.csproj @@ -10,7 +10,7 @@ netstandard2.0 - $(TargetFrameworks);net6.0-ios;net6.0-android;net6.0-maccatalyst;net6.0-tvos + $(TargetFrameworks);net7.0-ios;net7.0-android;net7.0-maccatalyst;net7.0-tvos @@ -44,11 +44,11 @@ - + - + diff --git a/Realm/Realm/Realm.csproj b/Realm/Realm/Realm.csproj index 4634c63aff..93e7caa304 100644 --- a/Realm/Realm/Realm.csproj +++ b/Realm/Realm/Realm.csproj @@ -1,12 +1,12 @@  - netstandard2.0;net6.0 + netstandard2.0;net6.0;net8.0 Realms true true true - 10.0 + 12 Realm https://docs.mongodb.com/realm-sdks/dotnet/latest/CHANGELOG.html $(ProjectDir)..\..\global.ruleset diff --git a/Tests/Realm.Tests/Realm.Tests.csproj b/Tests/Realm.Tests/Realm.Tests.csproj index f0874b632d..dc7fa2dacc 100644 --- a/Tests/Realm.Tests/Realm.Tests.csproj +++ b/Tests/Realm.Tests/Realm.Tests.csproj @@ -6,7 +6,7 @@ in the project file, but the NUnit test adapter doesn't support .NET Standard 2.0, so it should never be first in the list. --> - $(TargetFrameworks);net6.0;net7.0 + $(TargetFrameworks);net6.0;net8.0 $(TargetFrameworks);net461 $(TargetFrameworks);netstandard2.0 9.0 diff --git a/Tests/Realm.Tests/Sync/SyncTestHelpers.cs b/Tests/Realm.Tests/Sync/SyncTestHelpers.cs index 54d4c81c42..27e473e21d 100644 --- a/Tests/Realm.Tests/Sync/SyncTestHelpers.cs +++ b/Tests/Realm.Tests/Sync/SyncTestHelpers.cs @@ -34,6 +34,8 @@ public static class SyncTestHelpers public const string DefaultPassword = "123456"; private const string DummyAppId = "myapp-123"; + private static readonly string? _baaSaasApiKey; + private static IDictionary _apps = new Dictionary { [AppConfigType.Default] = new(string.Empty, DummyAppId, AppConfigType.Default), @@ -41,7 +43,6 @@ public static class SyncTestHelpers public static Uri? BaasUri; private static BaasClient? _baasClient; - private static string? _baaSaasApiKey; static SyncTestHelpers() { diff --git a/global.json b/global.json index 1c7274b725..501e79a871 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "7.0.100", + "version": "8.0.100", "rollForward": "latestFeature" } } \ No newline at end of file From 4e4ab542d54841170525fd723898ed7067498d1c Mon Sep 17 00:00:00 2001 From: Nikola Irinchev Date: Fri, 23 Feb 2024 15:14:23 +0100 Subject: [PATCH 02/16] Fix some tfms --- .github/templates/test-net-core.yml | 2 +- .github/workflows/main.yml | 2 +- .github/workflows/publish-prerelease.yml | 2 +- .github/workflows/test-net-core.yml | 2 +- CHANGELOG.md | 1 + Realm/Realm/Sync/MongoClient.cs | 8 ++++---- Tests/Realm.Tests/Sync/MongoClientTests.cs | 3 +++ Tests/Tests.Maui/Tests.Maui.csproj | 2 +- 8 files changed, 13 insertions(+), 9 deletions(-) diff --git a/.github/templates/test-net-core.yml b/.github/templates/test-net-core.yml index 7749ab85c9..dac84cefef 100644 --- a/.github/templates/test-net-core.yml +++ b/.github/templates/test-net-core.yml @@ -26,7 +26,7 @@ jobs: os: runner: macos-14 runtime: osx-arm64 - - framework: net8.0 + - framework: net6.0 os: runner: win81 runtime: win-x64 diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 3dbcf0dc01..1722ec9fff 100755 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -56,7 +56,7 @@ jobs: - name: Configure .NET uses: actions/setup-dotnet@607fce577a46308457984d59e4954e075820f10a with: - dotnet-version: 6.0.x + dotnet-version: 8.0.x - name: Install sleet run: dotnet tool install -g sleet - name: Configure AWS Credentials diff --git a/.github/workflows/publish-prerelease.yml b/.github/workflows/publish-prerelease.yml index 98b3abf6f8..55ef316eec 100644 --- a/.github/workflows/publish-prerelease.yml +++ b/.github/workflows/publish-prerelease.yml @@ -27,7 +27,7 @@ jobs: - name: Configure .NET uses: actions/setup-dotnet@607fce577a46308457984d59e4954e075820f10a with: - dotnet-version: 6.0.x + dotnet-version: 8.0.x - name: Install sleet run: dotnet tool install -g sleet - name: Configure AWS Credentials diff --git a/.github/workflows/test-net-core.yml b/.github/workflows/test-net-core.yml index 26e4a28b64..2cabd5522d 100755 --- a/.github/workflows/test-net-core.yml +++ b/.github/workflows/test-net-core.yml @@ -35,7 +35,7 @@ jobs: os: runner: macos-14 runtime: osx-arm64 - - framework: net8.0 + - framework: net6.0 os: runner: win81 runtime: win-x64 diff --git a/CHANGELOG.md b/CHANGELOG.md index de0045eeaf..46fe41a256 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ### Breaking Changes * Added automatic serialization and deserialization of Realm classes when using methods on `MongoClient.Collection`, without the need to annotate classes with `MongoDB.Bson`attributes. This feature required to change the default serialization for various types (including `DateTimeOffset`). If you prefer to use the previous serialization, you need to call `Realm.SetLegacySerialization` before any kind of serialization is done, otherwise it may not work as epxected. [#3459](https://github.com/realm/realm-dotnet/pull/3459) +* The returned value from `MongoClient.Collection.FindOneAsync` is now a nullable document to more explicitly convey that `null` may be returned in case no object matched the filter. ### Enhancements * Add support for passing a key paths collection (`KeyPathsCollection`) when using `IRealmCollection.SubscribeForNotifications`. Passing a `KeyPathsCollection` allows to specify which changes in properties should raise a notification. diff --git a/Realm/Realm/Sync/MongoClient.cs b/Realm/Realm/Sync/MongoClient.cs index 289b1057ee..dd5f7dcb04 100644 --- a/Realm/Realm/Sync/MongoClient.cs +++ b/Realm/Realm/Sync/MongoClient.cs @@ -345,8 +345,8 @@ public Task FindAsync(object? filter = null, object? sort = null, o /// An awaitable representing the remote find one operation. The result of the task is the first document that matches the find criteria. /// /// - public Task FindOneAsync(object? filter = null, object? sort = null, object? projection = null) - => InvokeOperationAsync("findOne", "query", filter, "project", projection, "sort", sort); + public Task FindOneAsync(object? filter = null, object? sort = null, object? projection = null) + => InvokeOperationAsync("findOne", "query", filter, "project", projection, "sort", sort); /// /// Finds the first document in the collection that satisfies the query criteria. @@ -435,8 +435,8 @@ public async Task FindOneAndReplaceAsync(object? filter, TDocument re /// An awaitable representing the remote find one operation. The result of the task is the first document that matches the find criteria. /// /// - public Task FindOneAndDeleteAsync(object? filter = null, object? sort = null, object? projection = null) - => InvokeOperationAsync("findOneAndDelete", "filter", filter, "projection", projection, "sort", sort); + public Task FindOneAndDeleteAsync(object? filter = null, object? sort = null, object? projection = null) + => InvokeOperationAsync("findOneAndDelete", "filter", filter, "projection", projection, "sort", sort); /// /// Executes an aggregation pipeline on the collection and returns the results as a array. diff --git a/Tests/Realm.Tests/Sync/MongoClientTests.cs b/Tests/Realm.Tests/Sync/MongoClientTests.cs index d6eb2e553a..7300b80184 100644 --- a/Tests/Realm.Tests/Sync/MongoClientTests.cs +++ b/Tests/Realm.Tests/Sync/MongoClientTests.cs @@ -797,6 +797,9 @@ public void MongoCollection_FindOne() { var collection = await GetCollection(); + var nonexistent = await collection.FindOneAsync(); + Assert.That(nonexistent, Is.Null); + var inserted = await InsertSomeData(collection, 3); var result = await collection.FindOneAsync(); diff --git a/Tests/Tests.Maui/Tests.Maui.csproj b/Tests/Tests.Maui/Tests.Maui.csproj index 13047ffd2b..43aa5e08dc 100644 --- a/Tests/Tests.Maui/Tests.Maui.csproj +++ b/Tests/Tests.Maui/Tests.Maui.csproj @@ -1,7 +1,7 @@ - net6.0-android;net6.0-ios;net6.0-maccatalyst + net8.0-android;net8.0-ios;net8.0-maccatalyst $(TargetFrameworks);net6.0-windows10.0.19041 Exe Tests.Maui From 7a8b796dd66d3b8b4213ea547c99b94defde706f Mon Sep 17 00:00:00 2001 From: Nikola Irinchev Date: Fri, 23 Feb 2024 16:11:49 +0100 Subject: [PATCH 03/16] More tfm fixes --- .github/templates/test-android.yml | 4 ++-- .github/templates/test-ios.yml | 4 ++-- .github/templates/test-macos.yml | 4 ++-- .github/workflows/test-android.yml | 4 ++-- .github/workflows/test-ios.yml | 4 ++-- .github/workflows/test-macos.yml | 4 ++-- global.json | 6 ------ 7 files changed, 12 insertions(+), 18 deletions(-) delete mode 100644 global.json diff --git a/.github/templates/test-android.yml b/.github/templates/test-android.yml index 1671ca899f..522a8599df 100644 --- a/.github/templates/test-android.yml +++ b/.github/templates/test-android.yml @@ -36,13 +36,13 @@ jobs: - #@ template.replace(setupWorkloads()) - #@ setupJDK() - name: Build the tests - run: #@ "dotnet publish Tests/Tests.Maui -c Release -f net6.0-android -p:RestoreConfigFile=Tests/Test.NuGet.Config -p:UseRealmNupkgsWithVersion=${{ inputs.version }}" + run: #@ "dotnet publish Tests/Tests.Maui -c Release -f net8.0-android -p:RestoreConfigFile=Tests/Test.NuGet.Config -p:UseRealmNupkgsWithVersion=${{ inputs.version }}" - #@ template.replace(configureAWSCredentials("AWS_DEVICEFARM_ACCESS_KEY_ID", "AWS_DEVICEFARM_SECRET_ACCESS_KEY", "us-west-2")) - name: Run the tests uses: ./.github/actions/run-android-device-farm-test id: run_tests with: - apk-path: ${{ github.workspace }}/Tests/Tests.Maui/bin/Release/net6.0-android/publish/io.realm.mauitests-Signed.apk + apk-path: ${{ github.workspace }}/Tests/Tests.Maui/bin/Release/net8.0-android/publish/io.realm.mauitests-Signed.apk app-id: io.realm.mauitests project-arn: ${{ secrets.DEVICEFARM_PROJECT_ARN }} device-pool-arn: ${{ secrets.DEVICEFARM_ANDROID_POOL_ARN }} diff --git a/.github/templates/test-ios.yml b/.github/templates/test-ios.yml index 4397ce2eed..6cf821091a 100644 --- a/.github/templates/test-ios.yml +++ b/.github/templates/test-ios.yml @@ -36,11 +36,11 @@ jobs: echo "MD_APPLE_SDK_ROOT=/Applications/Xcode_14.3.app" >> $GITHUB_ENV - #@ template.replace(setupWorkloads()) - name: Build the tests - run: #@ "dotnet build Tests/Tests.Maui -c " + configuration + " -f net6.0-ios -p:RestoreConfigFile=Tests/Test.NuGet.Config -p:UseRealmNupkgsWithVersion=${{ inputs.version }}" + run: #@ "dotnet build Tests/Tests.Maui -c " + configuration + " -f net8.0-ios -p:RestoreConfigFile=Tests/Test.NuGet.Config -p:UseRealmNupkgsWithVersion=${{ inputs.version }}" - name: Run the tests uses: #@ actionRuniOSSimulator with: - appPath: #@ "Tests/Tests.Maui/bin/" + configuration + "/net6.0-ios/iossimulator-x64/Tests.Maui.app" + appPath: #@ "Tests/Tests.Maui/bin/" + configuration + "/net8.0-ios/iossimulator-x64/Tests.Maui.app" bundleId: 'io.realm.mauitests' iphoneToSimulate: 'iPhone-8' arguments: #@ "--headless --result=${{ github.workspace }}/TestResults.iOS.xml --labels=After" diff --git a/.github/templates/test-macos.yml b/.github/templates/test-macos.yml index 079ec0999a..3b25641d65 100644 --- a/.github/templates/test-macos.yml +++ b/.github/templates/test-macos.yml @@ -25,7 +25,7 @@ jobs: - #@ template.replace(fetchPackageArtifacts()) - #@ template.replace(setupWorkloads()) - name: Build the tests - run: #@ "dotnet build Tests/Tests.Maui -c " + configuration + " -f net6.0-maccatalyst -p:RestoreConfigFile=Tests/Test.NuGet.Config -p:UseRealmNupkgsWithVersion=${{ inputs.version }}" + run: #@ "dotnet build Tests/Tests.Maui -c " + configuration + " -f net8.0-maccatalyst -p:RestoreConfigFile=Tests/Test.NuGet.Config -p:UseRealmNupkgsWithVersion=${{ inputs.version }}" - name: Run the tests - run: #@ "Tests/Tests.Maui/bin/" + configuration + "/net6.0-maccatalyst/maccatalyst-x64/Tests.Maui.app/Contents/MacOS/Tests.Maui --headless --result=${{ github.workspace }}/TestResults.MacCatalyst.xml --labels=All" + baasTestArgs("maccatalyst") + run: #@ "Tests/Tests.Maui/bin/" + configuration + "/net8.0-maccatalyst/maccatalyst-x64/Tests.Maui.app/Contents/MacOS/Tests.Maui --headless --result=${{ github.workspace }}/TestResults.MacCatalyst.xml --labels=All" + baasTestArgs("maccatalyst") - #@ publishTestsResults("TestResults.MacCatalyst.xml", "Maui.MacCatalyst") \ No newline at end of file diff --git a/.github/workflows/test-android.yml b/.github/workflows/test-android.yml index eb1a969bed..e96131b928 100755 --- a/.github/workflows/test-android.yml +++ b/.github/workflows/test-android.yml @@ -122,7 +122,7 @@ jobs: distribution: microsoft java-version: 11 - name: Build the tests - run: dotnet publish Tests/Tests.Maui -c Release -f net6.0-android -p:RestoreConfigFile=Tests/Test.NuGet.Config -p:UseRealmNupkgsWithVersion=${{ inputs.version }} + run: dotnet publish Tests/Tests.Maui -c Release -f net8.0-android -p:RestoreConfigFile=Tests/Test.NuGet.Config -p:UseRealmNupkgsWithVersion=${{ inputs.version }} - name: Configure AWS Credentials uses: aws-actions/configure-aws-credentials@v1-node16 with: @@ -133,7 +133,7 @@ jobs: uses: ./.github/actions/run-android-device-farm-test id: run_tests with: - apk-path: ${{ github.workspace }}/Tests/Tests.Maui/bin/Release/net6.0-android/publish/io.realm.mauitests-Signed.apk + apk-path: ${{ github.workspace }}/Tests/Tests.Maui/bin/Release/net8.0-android/publish/io.realm.mauitests-Signed.apk app-id: io.realm.mauitests project-arn: ${{ secrets.DEVICEFARM_PROJECT_ARN }} device-pool-arn: ${{ secrets.DEVICEFARM_ANDROID_POOL_ARN }} diff --git a/.github/workflows/test-ios.yml b/.github/workflows/test-ios.yml index 21d49528dc..e4b20b7736 100755 --- a/.github/workflows/test-ios.yml +++ b/.github/workflows/test-ios.yml @@ -101,11 +101,11 @@ jobs: - name: Setup workloads run: dotnet workload install maui - name: Build the tests - run: dotnet build Tests/Tests.Maui -c Release -f net6.0-ios -p:RestoreConfigFile=Tests/Test.NuGet.Config -p:UseRealmNupkgsWithVersion=${{ inputs.version }} + run: dotnet build Tests/Tests.Maui -c Release -f net8.0-ios -p:RestoreConfigFile=Tests/Test.NuGet.Config -p:UseRealmNupkgsWithVersion=${{ inputs.version }} - name: Run the tests uses: realm/ci-actions/run-ios-simulator@fa20eb972b9f018654fdb4e2c7afb52b0532f907 with: - appPath: Tests/Tests.Maui/bin/Release/net6.0-ios/iossimulator-x64/Tests.Maui.app + appPath: Tests/Tests.Maui/bin/Release/net8.0-ios/iossimulator-x64/Tests.Maui.app bundleId: io.realm.mauitests iphoneToSimulate: iPhone-8 arguments: --headless --result=${{ github.workspace }}/TestResults.iOS.xml --labels=After diff --git a/.github/workflows/test-macos.yml b/.github/workflows/test-macos.yml index 3bebc18e54..91cb97a654 100755 --- a/.github/workflows/test-macos.yml +++ b/.github/workflows/test-macos.yml @@ -91,9 +91,9 @@ jobs: - name: Setup workloads run: dotnet workload install maui - name: Build the tests - run: dotnet build Tests/Tests.Maui -c Release -f net6.0-maccatalyst -p:RestoreConfigFile=Tests/Test.NuGet.Config -p:UseRealmNupkgsWithVersion=${{ inputs.version }} + run: dotnet build Tests/Tests.Maui -c Release -f net8.0-maccatalyst -p:RestoreConfigFile=Tests/Test.NuGet.Config -p:UseRealmNupkgsWithVersion=${{ inputs.version }} - name: Run the tests - run: Tests/Tests.Maui/bin/Release/net6.0-maccatalyst/maccatalyst-x64/Tests.Maui.app/Contents/MacOS/Tests.Maui --headless --result=${{ github.workspace }}/TestResults.MacCatalyst.xml --labels=All --baasaas-api-key=${{ secrets.BaaSaasApiKey}} --baas-differentiator=maccatalyst + run: Tests/Tests.Maui/bin/Release/net8.0-maccatalyst/maccatalyst-x64/Tests.Maui.app/Contents/MacOS/Tests.Maui --headless --result=${{ github.workspace }}/TestResults.MacCatalyst.xml --labels=All --baasaas-api-key=${{ secrets.BaaSaasApiKey}} --baas-differentiator=maccatalyst - name: Publish Unit Test Results uses: LaPeste/test-reporter@510caf50a955b1003bec48a6494be4d6537f3a0b if: always() diff --git a/global.json b/global.json deleted file mode 100644 index 501e79a871..0000000000 --- a/global.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "sdk": { - "version": "8.0.100", - "rollForward": "latestFeature" - } -} \ No newline at end of file From c4b786e40393db3485d31b68b413288a0364f1f2 Mon Sep 17 00:00:00 2001 From: Nikola Irinchev Date: Fri, 23 Feb 2024 16:33:41 +0100 Subject: [PATCH 04/16] Update apple workflows to run with latest xcode --- .github/templates/build-packages.yml | 2 +- .github/templates/common.lib.yml | 2 +- .github/templates/test-ios.yml | 5 ----- .github/templates/test-macos.yml | 2 +- .github/templates/test-net-core.yml | 3 ++- .github/workflows/test-ios.yml | 5 ----- .github/workflows/test-macos.yml | 2 +- .github/workflows/test-net-core.yml | 4 ++++ 8 files changed, 10 insertions(+), 15 deletions(-) diff --git a/.github/templates/build-packages.yml b/.github/templates/build-packages.yml index 777337796b..5337ee4153 100644 --- a/.github/templates/build-packages.yml +++ b/.github/templates/build-packages.yml @@ -15,7 +15,7 @@ Invoke-WebRequest -Uri https://github.com/dotnet/docfx/releases/download/v2.75.2/docfx-win-x64-v2.75.2.zip -OutFile C:\docfx.zip Expand-Archive -Path C:\docfx.zip -DestinationPath C:\docfx shell: powershell - - _: #@ template.replace(setupDotnet("8.0.x", ifCondition = "inputs.build-docs")) + - _: #@ template.replace(setupDotnet(ifCondition = "inputs.build-docs")) - name: Build docs if: inputs.build-docs env: diff --git a/.github/templates/common.lib.yml b/.github/templates/common.lib.yml index a5806c910a..b2c0d3ddf4 100644 --- a/.github/templates/common.lib.yml +++ b/.github/templates/common.lib.yml @@ -231,7 +231,7 @@ with: #@ end --- #@ def setupWorkloads(workloads = 'maui'): - - _: #@ template.replace(setupDotnet("8.0.x")) + - _: #@ template.replace(setupDotnet()) - name: Setup workloads run: #@ "dotnet workload install " + workloads #@ end diff --git a/.github/templates/test-ios.yml b/.github/templates/test-ios.yml index 6cf821091a..e98bd79f89 100644 --- a/.github/templates/test-ios.yml +++ b/.github/templates/test-ios.yml @@ -29,11 +29,6 @@ jobs: steps: - #@ template.replace(checkoutCode()) - #@ template.replace(fetchPackageArtifacts()) - - name: Set XCode Version - shell: bash - run: | - sudo xcode-select -s "/Applications/Xcode_14.3.app" - echo "MD_APPLE_SDK_ROOT=/Applications/Xcode_14.3.app" >> $GITHUB_ENV - #@ template.replace(setupWorkloads()) - name: Build the tests run: #@ "dotnet build Tests/Tests.Maui -c " + configuration + " -f net8.0-ios -p:RestoreConfigFile=Tests/Test.NuGet.Config -p:UseRealmNupkgsWithVersion=${{ inputs.version }}" diff --git a/.github/templates/test-macos.yml b/.github/templates/test-macos.yml index 3b25641d65..24b5720ec4 100644 --- a/.github/templates/test-macos.yml +++ b/.github/templates/test-macos.yml @@ -17,7 +17,7 @@ jobs: run: #@ "Tests/Tests.XamarinMac/bin/" + configuration + "/Tests.XamarinMac.app/Contents/MacOS/Tests.XamarinMac --headless --result=${{ github.workspace }}/TestResults.XamarinMac.xml --labels=All" + baasTestArgs("xamarinmacos") - #@ publishTestsResults("TestResults.XamarinMac.xml", "Xamarin.macOS") test-maui: - runs-on: macos-12 + runs-on: macos-latest name: Maui.MacCatalyst timeout-minutes: 60 steps: diff --git a/.github/templates/test-net-core.yml b/.github/templates/test-net-core.yml index dac84cefef..3a1afe15a9 100644 --- a/.github/templates/test-net-core.yml +++ b/.github/templates/test-net-core.yml @@ -1,5 +1,5 @@ #@ load("@ytt:template", "template") -#@ load("common.lib.yml", "checkoutCode", "uploadArtifacts") +#@ load("common.lib.yml", "checkoutCode", "uploadArtifacts", "setupDotnet") #@ load("test.lib.yml", "baasTestArgs", "publishTestsResults", "testDefinition", "buildTests", "dotnetBuildTests", "prepareTest") --- @@ -33,6 +33,7 @@ jobs: steps: - #@ template.replace(prepareTest(cleanupWorkspace = True)) + - _: #@ template.replace(setupDotnet()) - #@ template.replace(dotnetBuildTests("Tests/Realm.Tests", "${{ matrix.framework }}", "${{ matrix.os.runtime }}")) - name: Run the tests env: diff --git a/.github/workflows/test-ios.yml b/.github/workflows/test-ios.yml index e4b20b7736..6883830e34 100755 --- a/.github/workflows/test-ios.yml +++ b/.github/workflows/test-ios.yml @@ -89,11 +89,6 @@ jobs: with: name: Realm.${{ inputs.version }} path: ${{ github.workspace }}/Realm/packages/ - - name: Set XCode Version - shell: bash - run: | - sudo xcode-select -s "/Applications/Xcode_14.3.app" - echo "MD_APPLE_SDK_ROOT=/Applications/Xcode_14.3.app" >> $GITHUB_ENV - name: Configure .NET uses: actions/setup-dotnet@607fce577a46308457984d59e4954e075820f10a with: diff --git a/.github/workflows/test-macos.yml b/.github/workflows/test-macos.yml index 91cb97a654..de40a92fe2 100755 --- a/.github/workflows/test-macos.yml +++ b/.github/workflows/test-macos.yml @@ -61,7 +61,7 @@ jobs: path-replace-backslashes: true fail-on-error: false test-maui: - runs-on: macos-12 + runs-on: macos-latest name: Maui.MacCatalyst timeout-minutes: 60 steps: diff --git a/.github/workflows/test-net-core.yml b/.github/workflows/test-net-core.yml index 2cabd5522d..fc50e7b88e 100755 --- a/.github/workflows/test-net-core.yml +++ b/.github/workflows/test-net-core.yml @@ -61,6 +61,10 @@ jobs: with: name: Realm.${{ inputs.version }} path: ${{ github.workspace }}/Realm/packages/ + - name: Configure .NET + uses: actions/setup-dotnet@607fce577a46308457984d59e4954e075820f10a + with: + dotnet-version: 8.0.x - name: Publish Tests/Realm.Tests run: dotnet publish Tests/Realm.Tests -c Release -f ${{ matrix.framework }} -r ${{ matrix.os.runtime }} -p:RestoreConfigFile=Tests/Test.NuGet.Config -p:UseRealmNupkgsWithVersion=${{ inputs.version }} -p:RealmTestsStandaloneExe=true --no-self-contained - name: Output executable path From 0211aaefcdf1a889fc62d5a2731d135ee5ddb43a Mon Sep 17 00:00:00 2001 From: Nikola Irinchev Date: Fri, 23 Feb 2024 17:08:09 +0100 Subject: [PATCH 05/16] Setup xcode --- .github/templates/common.lib.yml | 13 +++++++------ .github/templates/test-ios.yml | 5 +++-- .github/templates/test-macos.yml | 3 ++- .github/templates/wrappers.yml | 6 +++++- .github/workflows/build-packages.yml | 6 ++++-- .github/workflows/codeql.yml | 3 ++- .github/workflows/main.yml | 3 ++- .github/workflows/publish-prerelease.yml | 3 ++- .github/workflows/test-android.yml | 3 ++- .github/workflows/test-ios.yml | 9 +++++++-- .github/workflows/test-macos.yml | 7 ++++++- .github/workflows/test-net-core.yml | 3 ++- .github/workflows/test-source-generation.yml | 3 ++- .github/workflows/test-weaver.yml | 3 ++- .github/workflows/wrappers.yml | 2 +- 15 files changed, 49 insertions(+), 23 deletions(-) diff --git a/.github/templates/common.lib.yml b/.github/templates/common.lib.yml index b2c0d3ddf4..1c41cd8a10 100644 --- a/.github/templates/common.lib.yml +++ b/.github/templates/common.lib.yml @@ -8,14 +8,14 @@ #@ actionUploadArtifact = "actions/upload-artifact@v3" #@ actionDownloadArtifact = "actions/download-artifact@v3" #@ actionSetupMSBuild = "microsoft/setup-msbuild@0b44c6745b7e81956596964100aadb92d667c497" -#@ actionSetupDotnet = "actions/setup-dotnet@607fce577a46308457984d59e4954e075820f10a" +#@ actionSetupDotnet = "actions/setup-dotnet@3e6b9fe3930cac7c59c651af5de1514b47a805b9" #! 4.0.0 #@ actionCodeQLInit = "github/codeql-action/init@40542d38bc4936c2ca7da883aeb050a6081b4b31" #@ actionCodeQLAnalyze = "github/codeql-action/analyze@40542d38bc4936c2ca7da883aeb050a6081b4b31" #@ actionSetupNode = "actions/setup-node@16352bb09bc672a073e326c2cc1d3d7d2a3e577e" #@ actionAWSConfigureCredentials = "aws-actions/configure-aws-credentials@v1-node16" #@ actionRuniOSSimulator = "realm/ci-actions/run-ios-simulator@fa20eb972b9f018654fdb4e2c7afb52b0532f907" #@ actionReleaseToSlack = "realm/ci-actions/release-to-slack@fa20eb972b9f018654fdb4e2c7afb52b0532f907" -#@ actionSetupXcode = "maxim-lobanov/setup-xcode@9a697e2b393340c3cacd97468baa318e4c883d98" +#@ actionSetupXcode = "maxim-lobanov/setup-xcode@60606e260d2fc5762a71e64e74b2174e8ea3c8bd" #@ actionSetupAndroid = "android-actions/setup-android@7c5672355aaa8fde5f97a91aa9a99616d1ace6bc" #@ actionSetupJDK = "actions/setup-java@0ab4596768b603586c0de567f2430c30f5b0d2b0" @@ -198,13 +198,14 @@ if: #@ ifCondition #@ end with: dotnet-version: #@ version + cache: true #@ end --- #@ def setupXcode(version = "14.0.1"): -- name: Setup Xcode - uses: #@ actionSetupXcode - with: - xcode-version: #@ version +name: Setup Xcode +uses: #@ actionSetupXcode +with: + xcode-version: #@ version #@ end --- #@ def uploadToNpm(tag = "latest", versionExpression = "steps.get-version.outputs.version", expectShortPath = False): diff --git a/.github/templates/test-ios.yml b/.github/templates/test-ios.yml index e98bd79f89..83d0efeedc 100644 --- a/.github/templates/test-ios.yml +++ b/.github/templates/test-ios.yml @@ -1,5 +1,5 @@ #@ load("@ytt:template", "template") -#@ load("common.lib.yml", "checkoutCode", "configuration", "actionRuniOSSimulator", "fetchPackageArtifacts", "setupWorkloads") +#@ load("common.lib.yml", "checkoutCode", "configuration", "actionRuniOSSimulator", "fetchPackageArtifacts", "setupWorkloads", "setupXcode") #@ load("test.lib.yml", "baasTestArgs", "publishTestsResults", "testDefinition", "buildTests", "prepareTest") --- @@ -23,12 +23,13 @@ jobs: - #@ publishTestsResults("TestResults.iOS.xml", "Xamarin.iOS") test-maui: - runs-on: macos-13 + runs-on: macos-latest name: Maui.iOS timeout-minutes: 45 steps: - #@ template.replace(checkoutCode()) - #@ template.replace(fetchPackageArtifacts()) + - #@ setupXcode("latest-stable") - #@ template.replace(setupWorkloads()) - name: Build the tests run: #@ "dotnet build Tests/Tests.Maui -c " + configuration + " -f net8.0-ios -p:RestoreConfigFile=Tests/Test.NuGet.Config -p:UseRealmNupkgsWithVersion=${{ inputs.version }}" diff --git a/.github/templates/test-macos.yml b/.github/templates/test-macos.yml index 24b5720ec4..0c549df82b 100644 --- a/.github/templates/test-macos.yml +++ b/.github/templates/test-macos.yml @@ -1,5 +1,5 @@ #@ load("@ytt:template", "template") -#@ load("common.lib.yml", "checkoutCode", "configuration", "fetchPackageArtifacts", "setupWorkloads") +#@ load("common.lib.yml", "checkoutCode", "configuration", "fetchPackageArtifacts", "setupWorkloads", "setupXcode") #@ load("test.lib.yml", "baasTestArgs", "publishTestsResults", "testDefinition", "buildTests", "prepareTest") --- @@ -23,6 +23,7 @@ jobs: steps: - #@ template.replace(checkoutCode()) - #@ template.replace(fetchPackageArtifacts()) + - #@ setupXcode("latest-stable") - #@ template.replace(setupWorkloads()) - name: Build the tests run: #@ "dotnet build Tests/Tests.Maui -c " + configuration + " -f net8.0-maccatalyst -p:RestoreConfigFile=Tests/Test.NuGet.Config -p:UseRealmNupkgsWithVersion=${{ inputs.version }}" diff --git a/.github/templates/wrappers.yml b/.github/templates/wrappers.yml index 3d3ffcd51c..60d57ae2dc 100644 --- a/.github/templates/wrappers.yml +++ b/.github/templates/wrappers.yml @@ -36,6 +36,10 @@ with: if: #@ wrappersCacheCondition #@ end --- +#@ def setupXcodeStep(): + - #@ setupXcode() +#@ end +--- #@ def buildWrappers(cmd, outputVar, intermediateSteps = [], enableLto = True, artifactsPath = "wrappers/build/**", cacheVariable = ""): #@ if cacheVariable == "": #@ cacheVariable = outputVar @@ -105,7 +109,7 @@ jobs: matrix: platform: #@ applePlatforms target: [ 'Device', 'Simulator' ] - _: #@ template.replace(buildWrappers("pwsh ./wrappers/build-apple-platform.ps1 ${{ matrix.platform }} -Targets ${{ matrix.target }}", "wrappers-${{ matrix.platform }}-${{ matrix.target }}", enableLto = False, intermediateSteps = [setupXcode()])) + _: #@ template.replace(buildWrappers("pwsh ./wrappers/build-apple-platform.ps1 ${{ matrix.platform }} -Targets ${{ matrix.target }}", "wrappers-${{ matrix.platform }}-${{ matrix.target }}", enableLto = False, intermediateSteps = [setupXcodeStep()])) #@yaml/map-key-override if: #@ " || ".join([ "needs.check-cache.outputs.wrappers-" + x + "-Device != 'true'" for x in applePlatforms ] + [ "needs.check-cache.outputs.wrappers-" + x + "-Simulator != 'true'" for x in applePlatforms ]) linux: diff --git a/.github/workflows/build-packages.yml b/.github/workflows/build-packages.yml index 0d0b2d1448..76eb27609a 100755 --- a/.github/workflows/build-packages.yml +++ b/.github/workflows/build-packages.yml @@ -39,9 +39,10 @@ jobs: distribution: microsoft java-version: 11 - name: Configure .NET - uses: actions/setup-dotnet@607fce577a46308457984d59e4954e075820f10a + uses: actions/setup-dotnet@3e6b9fe3930cac7c59c651af5de1514b47a805b9 with: dotnet-version: 8.0.x + cache: true - name: Setup workloads run: dotnet workload install tvos ios maccatalyst android - name: Set version suffix @@ -227,10 +228,11 @@ jobs: Expand-Archive -Path C:\docfx.zip -DestinationPath C:\docfx shell: powershell - name: Configure .NET - uses: actions/setup-dotnet@607fce577a46308457984d59e4954e075820f10a + uses: actions/setup-dotnet@3e6b9fe3930cac7c59c651af5de1514b47a805b9 if: inputs.build-docs with: dotnet-version: 8.0.x + cache: true - name: Build docs if: inputs.build-docs env: diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index efd7e97795..dbd7781937 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -51,9 +51,10 @@ jobs: distribution: microsoft java-version: 11 - name: Configure .NET - uses: actions/setup-dotnet@607fce577a46308457984d59e4954e075820f10a + uses: actions/setup-dotnet@3e6b9fe3930cac7c59c651af5de1514b47a805b9 with: dotnet-version: 8.0.x + cache: true - name: Setup workloads run: dotnet workload install tvos ios maccatalyst android - name: Add msbuild to PATH diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 1722ec9fff..b161082e05 100755 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -54,9 +54,10 @@ jobs: name: Realm.${{ needs.build-packages.outputs.package_version }} path: ${{ github.workspace }}/Realm/packages/ - name: Configure .NET - uses: actions/setup-dotnet@607fce577a46308457984d59e4954e075820f10a + uses: actions/setup-dotnet@3e6b9fe3930cac7c59c651af5de1514b47a805b9 with: dotnet-version: 8.0.x + cache: true - name: Install sleet run: dotnet tool install -g sleet - name: Configure AWS Credentials diff --git a/.github/workflows/publish-prerelease.yml b/.github/workflows/publish-prerelease.yml index 55ef316eec..f23f7b6413 100644 --- a/.github/workflows/publish-prerelease.yml +++ b/.github/workflows/publish-prerelease.yml @@ -25,9 +25,10 @@ jobs: echo "version=$pkgVersion" >> $GITHUB_OUTPUT shell: bash - name: Configure .NET - uses: actions/setup-dotnet@607fce577a46308457984d59e4954e075820f10a + uses: actions/setup-dotnet@3e6b9fe3930cac7c59c651af5de1514b47a805b9 with: dotnet-version: 8.0.x + cache: true - name: Install sleet run: dotnet tool install -g sleet - name: Configure AWS Credentials diff --git a/.github/workflows/test-android.yml b/.github/workflows/test-android.yml index e96131b928..2373e25d0a 100755 --- a/.github/workflows/test-android.yml +++ b/.github/workflows/test-android.yml @@ -111,9 +111,10 @@ jobs: name: Realm.${{ inputs.version }} path: ${{ github.workspace }}/Realm/packages/ - name: Configure .NET - uses: actions/setup-dotnet@607fce577a46308457984d59e4954e075820f10a + uses: actions/setup-dotnet@3e6b9fe3930cac7c59c651af5de1514b47a805b9 with: dotnet-version: 8.0.x + cache: true - name: Setup workloads run: dotnet workload install maui - name: Setup JDK diff --git a/.github/workflows/test-ios.yml b/.github/workflows/test-ios.yml index 6883830e34..123ba721f8 100755 --- a/.github/workflows/test-ios.yml +++ b/.github/workflows/test-ios.yml @@ -66,7 +66,7 @@ jobs: path-replace-backslashes: true fail-on-error: false test-maui: - runs-on: macos-13 + runs-on: macos-latest name: Maui.iOS timeout-minutes: 45 steps: @@ -89,10 +89,15 @@ jobs: with: name: Realm.${{ inputs.version }} path: ${{ github.workspace }}/Realm/packages/ + - name: Setup Xcode + uses: maxim-lobanov/setup-xcode@60606e260d2fc5762a71e64e74b2174e8ea3c8bd + with: + xcode-version: latest-stable - name: Configure .NET - uses: actions/setup-dotnet@607fce577a46308457984d59e4954e075820f10a + uses: actions/setup-dotnet@3e6b9fe3930cac7c59c651af5de1514b47a805b9 with: dotnet-version: 8.0.x + cache: true - name: Setup workloads run: dotnet workload install maui - name: Build the tests diff --git a/.github/workflows/test-macos.yml b/.github/workflows/test-macos.yml index de40a92fe2..c6a00a0854 100755 --- a/.github/workflows/test-macos.yml +++ b/.github/workflows/test-macos.yml @@ -84,10 +84,15 @@ jobs: with: name: Realm.${{ inputs.version }} path: ${{ github.workspace }}/Realm/packages/ + - name: Setup Xcode + uses: maxim-lobanov/setup-xcode@60606e260d2fc5762a71e64e74b2174e8ea3c8bd + with: + xcode-version: latest-stable - name: Configure .NET - uses: actions/setup-dotnet@607fce577a46308457984d59e4954e075820f10a + uses: actions/setup-dotnet@3e6b9fe3930cac7c59c651af5de1514b47a805b9 with: dotnet-version: 8.0.x + cache: true - name: Setup workloads run: dotnet workload install maui - name: Build the tests diff --git a/.github/workflows/test-net-core.yml b/.github/workflows/test-net-core.yml index fc50e7b88e..b23379b8a9 100755 --- a/.github/workflows/test-net-core.yml +++ b/.github/workflows/test-net-core.yml @@ -62,9 +62,10 @@ jobs: name: Realm.${{ inputs.version }} path: ${{ github.workspace }}/Realm/packages/ - name: Configure .NET - uses: actions/setup-dotnet@607fce577a46308457984d59e4954e075820f10a + uses: actions/setup-dotnet@3e6b9fe3930cac7c59c651af5de1514b47a805b9 with: dotnet-version: 8.0.x + cache: true - name: Publish Tests/Realm.Tests run: dotnet publish Tests/Realm.Tests -c Release -f ${{ matrix.framework }} -r ${{ matrix.os.runtime }} -p:RestoreConfigFile=Tests/Test.NuGet.Config -p:UseRealmNupkgsWithVersion=${{ inputs.version }} -p:RealmTestsStandaloneExe=true --no-self-contained - name: Output executable path diff --git a/.github/workflows/test-source-generation.yml b/.github/workflows/test-source-generation.yml index 9cfc79dce3..792b8cc667 100644 --- a/.github/workflows/test-source-generation.yml +++ b/.github/workflows/test-source-generation.yml @@ -17,9 +17,10 @@ jobs: - name: Register msvc problem matcher run: echo "::add-matcher::.github/problem-matchers/msvc.json" - name: Configure .NET - uses: actions/setup-dotnet@607fce577a46308457984d59e4954e075820f10a + uses: actions/setup-dotnet@3e6b9fe3930cac7c59c651af5de1514b47a805b9 with: dotnet-version: 8.0.x + cache: true - name: Setup workloads run: dotnet workload install tvos ios maccatalyst android - name: Publish Tests/SourceGenerators/Realm.SourceGenerator.Tests diff --git a/.github/workflows/test-weaver.yml b/.github/workflows/test-weaver.yml index 68892cf209..e5eae2a60e 100755 --- a/.github/workflows/test-weaver.yml +++ b/.github/workflows/test-weaver.yml @@ -29,9 +29,10 @@ jobs: - name: Register msvc problem matcher run: echo "::add-matcher::.github/problem-matchers/msvc.json" - name: Configure .NET - uses: actions/setup-dotnet@607fce577a46308457984d59e4954e075820f10a + uses: actions/setup-dotnet@3e6b9fe3930cac7c59c651af5de1514b47a805b9 with: dotnet-version: 8.0.x + cache: true - name: Setup workloads run: dotnet workload install android ${{ (matrix.os.runner != 'ubuntu-latest' && 'tvos ios maccatalyst') || '' }} - name: Publish Tests/Weaver/Realm.Fody.Tests diff --git a/.github/workflows/wrappers.yml b/.github/workflows/wrappers.yml index fe45ebe2c2..ea7020c00f 100755 --- a/.github/workflows/wrappers.yml +++ b/.github/workflows/wrappers.yml @@ -467,7 +467,7 @@ jobs: path: ./wrappers/build/** key: wrappers-${{ matrix.platform }}-${{ matrix.target }}-Release-${{hashFiles('./wrappers/**')}} - name: Setup Xcode - uses: maxim-lobanov/setup-xcode@9a697e2b393340c3cacd97468baa318e4c883d98 + uses: maxim-lobanov/setup-xcode@60606e260d2fc5762a71e64e74b2174e8ea3c8bd with: xcode-version: 14.0.1 - name: Build wrappers From c9edd7d276ca9a179dbd8cd2090979099dbfb989 Mon Sep 17 00:00:00 2001 From: Nikola Irinchev Date: Fri, 23 Feb 2024 17:23:54 +0100 Subject: [PATCH 06/16] Disable caching --- .github/templates/common.lib.yml | 1 - .github/workflows/build-packages.yml | 2 -- .github/workflows/codeql.yml | 1 - .github/workflows/main.yml | 1 - .github/workflows/publish-prerelease.yml | 1 - .github/workflows/test-android.yml | 1 - .github/workflows/test-ios.yml | 1 - .github/workflows/test-macos.yml | 1 - .github/workflows/test-net-core.yml | 1 - .github/workflows/test-source-generation.yml | 1 - .github/workflows/test-weaver.yml | 1 - 11 files changed, 12 deletions(-) diff --git a/.github/templates/common.lib.yml b/.github/templates/common.lib.yml index 1c41cd8a10..8a477c04c9 100644 --- a/.github/templates/common.lib.yml +++ b/.github/templates/common.lib.yml @@ -198,7 +198,6 @@ if: #@ ifCondition #@ end with: dotnet-version: #@ version - cache: true #@ end --- #@ def setupXcode(version = "14.0.1"): diff --git a/.github/workflows/build-packages.yml b/.github/workflows/build-packages.yml index 76eb27609a..051719deb3 100755 --- a/.github/workflows/build-packages.yml +++ b/.github/workflows/build-packages.yml @@ -42,7 +42,6 @@ jobs: uses: actions/setup-dotnet@3e6b9fe3930cac7c59c651af5de1514b47a805b9 with: dotnet-version: 8.0.x - cache: true - name: Setup workloads run: dotnet workload install tvos ios maccatalyst android - name: Set version suffix @@ -232,7 +231,6 @@ jobs: if: inputs.build-docs with: dotnet-version: 8.0.x - cache: true - name: Build docs if: inputs.build-docs env: diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index dbd7781937..533a060bec 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -54,7 +54,6 @@ jobs: uses: actions/setup-dotnet@3e6b9fe3930cac7c59c651af5de1514b47a805b9 with: dotnet-version: 8.0.x - cache: true - name: Setup workloads run: dotnet workload install tvos ios maccatalyst android - name: Add msbuild to PATH diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index b161082e05..753f437c2d 100755 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -57,7 +57,6 @@ jobs: uses: actions/setup-dotnet@3e6b9fe3930cac7c59c651af5de1514b47a805b9 with: dotnet-version: 8.0.x - cache: true - name: Install sleet run: dotnet tool install -g sleet - name: Configure AWS Credentials diff --git a/.github/workflows/publish-prerelease.yml b/.github/workflows/publish-prerelease.yml index f23f7b6413..f5c9a36f02 100644 --- a/.github/workflows/publish-prerelease.yml +++ b/.github/workflows/publish-prerelease.yml @@ -28,7 +28,6 @@ jobs: uses: actions/setup-dotnet@3e6b9fe3930cac7c59c651af5de1514b47a805b9 with: dotnet-version: 8.0.x - cache: true - name: Install sleet run: dotnet tool install -g sleet - name: Configure AWS Credentials diff --git a/.github/workflows/test-android.yml b/.github/workflows/test-android.yml index 2373e25d0a..eead6d79d0 100755 --- a/.github/workflows/test-android.yml +++ b/.github/workflows/test-android.yml @@ -114,7 +114,6 @@ jobs: uses: actions/setup-dotnet@3e6b9fe3930cac7c59c651af5de1514b47a805b9 with: dotnet-version: 8.0.x - cache: true - name: Setup workloads run: dotnet workload install maui - name: Setup JDK diff --git a/.github/workflows/test-ios.yml b/.github/workflows/test-ios.yml index 123ba721f8..40d66f8672 100755 --- a/.github/workflows/test-ios.yml +++ b/.github/workflows/test-ios.yml @@ -97,7 +97,6 @@ jobs: uses: actions/setup-dotnet@3e6b9fe3930cac7c59c651af5de1514b47a805b9 with: dotnet-version: 8.0.x - cache: true - name: Setup workloads run: dotnet workload install maui - name: Build the tests diff --git a/.github/workflows/test-macos.yml b/.github/workflows/test-macos.yml index c6a00a0854..f8a1cd759a 100755 --- a/.github/workflows/test-macos.yml +++ b/.github/workflows/test-macos.yml @@ -92,7 +92,6 @@ jobs: uses: actions/setup-dotnet@3e6b9fe3930cac7c59c651af5de1514b47a805b9 with: dotnet-version: 8.0.x - cache: true - name: Setup workloads run: dotnet workload install maui - name: Build the tests diff --git a/.github/workflows/test-net-core.yml b/.github/workflows/test-net-core.yml index b23379b8a9..f83842c6e7 100755 --- a/.github/workflows/test-net-core.yml +++ b/.github/workflows/test-net-core.yml @@ -65,7 +65,6 @@ jobs: uses: actions/setup-dotnet@3e6b9fe3930cac7c59c651af5de1514b47a805b9 with: dotnet-version: 8.0.x - cache: true - name: Publish Tests/Realm.Tests run: dotnet publish Tests/Realm.Tests -c Release -f ${{ matrix.framework }} -r ${{ matrix.os.runtime }} -p:RestoreConfigFile=Tests/Test.NuGet.Config -p:UseRealmNupkgsWithVersion=${{ inputs.version }} -p:RealmTestsStandaloneExe=true --no-self-contained - name: Output executable path diff --git a/.github/workflows/test-source-generation.yml b/.github/workflows/test-source-generation.yml index 792b8cc667..6a612b0aa8 100644 --- a/.github/workflows/test-source-generation.yml +++ b/.github/workflows/test-source-generation.yml @@ -20,7 +20,6 @@ jobs: uses: actions/setup-dotnet@3e6b9fe3930cac7c59c651af5de1514b47a805b9 with: dotnet-version: 8.0.x - cache: true - name: Setup workloads run: dotnet workload install tvos ios maccatalyst android - name: Publish Tests/SourceGenerators/Realm.SourceGenerator.Tests diff --git a/.github/workflows/test-weaver.yml b/.github/workflows/test-weaver.yml index e5eae2a60e..b2f63535ba 100755 --- a/.github/workflows/test-weaver.yml +++ b/.github/workflows/test-weaver.yml @@ -32,7 +32,6 @@ jobs: uses: actions/setup-dotnet@3e6b9fe3930cac7c59c651af5de1514b47a805b9 with: dotnet-version: 8.0.x - cache: true - name: Setup workloads run: dotnet workload install android ${{ (matrix.os.runner != 'ubuntu-latest' && 'tvos ios maccatalyst') || '' }} - name: Publish Tests/Weaver/Realm.Fody.Tests From ba8aa565ec90c72f23796c2b781d0e5fd3ddb9b6 Mon Sep 17 00:00:00 2001 From: Nikola Irinchev Date: Fri, 23 Feb 2024 17:46:26 +0100 Subject: [PATCH 07/16] Use macos-13 --- .github/templates/test-ios.yml | 2 +- .github/templates/test-macos.yml | 2 +- .github/workflows/test-ios.yml | 2 +- .github/workflows/test-macos.yml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/templates/test-ios.yml b/.github/templates/test-ios.yml index 83d0efeedc..4d713620d3 100644 --- a/.github/templates/test-ios.yml +++ b/.github/templates/test-ios.yml @@ -23,7 +23,7 @@ jobs: - #@ publishTestsResults("TestResults.iOS.xml", "Xamarin.iOS") test-maui: - runs-on: macos-latest + runs-on: macos-13 name: Maui.iOS timeout-minutes: 45 steps: diff --git a/.github/templates/test-macos.yml b/.github/templates/test-macos.yml index 0c549df82b..53e88658c7 100644 --- a/.github/templates/test-macos.yml +++ b/.github/templates/test-macos.yml @@ -17,7 +17,7 @@ jobs: run: #@ "Tests/Tests.XamarinMac/bin/" + configuration + "/Tests.XamarinMac.app/Contents/MacOS/Tests.XamarinMac --headless --result=${{ github.workspace }}/TestResults.XamarinMac.xml --labels=All" + baasTestArgs("xamarinmacos") - #@ publishTestsResults("TestResults.XamarinMac.xml", "Xamarin.macOS") test-maui: - runs-on: macos-latest + runs-on: macos-13 name: Maui.MacCatalyst timeout-minutes: 60 steps: diff --git a/.github/workflows/test-ios.yml b/.github/workflows/test-ios.yml index 40d66f8672..f26b8cd13a 100755 --- a/.github/workflows/test-ios.yml +++ b/.github/workflows/test-ios.yml @@ -66,7 +66,7 @@ jobs: path-replace-backslashes: true fail-on-error: false test-maui: - runs-on: macos-latest + runs-on: macos-13 name: Maui.iOS timeout-minutes: 45 steps: diff --git a/.github/workflows/test-macos.yml b/.github/workflows/test-macos.yml index f8a1cd759a..74ed1449c8 100755 --- a/.github/workflows/test-macos.yml +++ b/.github/workflows/test-macos.yml @@ -61,7 +61,7 @@ jobs: path-replace-backslashes: true fail-on-error: false test-maui: - runs-on: macos-latest + runs-on: macos-13 name: Maui.MacCatalyst timeout-minutes: 60 steps: From 954a5262476a6dfaf44eaa1c76e433901e72f891 Mon Sep 17 00:00:00 2001 From: Nikola Irinchev Date: Fri, 23 Feb 2024 18:10:41 +0100 Subject: [PATCH 08/16] Use iphone 15 --- .github/templates/test-ios.yml | 2 +- .github/templates/test-net-core.yml | 8 ++++---- .github/workflows/test-ios.yml | 2 +- .github/workflows/test-net-core.yml | 4 ---- 4 files changed, 6 insertions(+), 10 deletions(-) diff --git a/.github/templates/test-ios.yml b/.github/templates/test-ios.yml index 4d713620d3..229402b642 100644 --- a/.github/templates/test-ios.yml +++ b/.github/templates/test-ios.yml @@ -38,6 +38,6 @@ jobs: with: appPath: #@ "Tests/Tests.Maui/bin/" + configuration + "/net8.0-ios/iossimulator-x64/Tests.Maui.app" bundleId: 'io.realm.mauitests' - iphoneToSimulate: 'iPhone-8' + iphoneToSimulate: 'iPhone-15' arguments: #@ "--headless --result=${{ github.workspace }}/TestResults.iOS.xml --labels=After" - #@ publishTestsResults("TestResults.iOS.xml", "Maui.iOS") \ No newline at end of file diff --git a/.github/templates/test-net-core.yml b/.github/templates/test-net-core.yml index 3a1afe15a9..93c19785b3 100644 --- a/.github/templates/test-net-core.yml +++ b/.github/templates/test-net-core.yml @@ -26,10 +26,10 @@ jobs: os: runner: macos-14 runtime: osx-arm64 - - framework: net6.0 - os: - runner: win81 - runtime: win-x64 + #! - framework: net6.0 // Need to install net8 sdk to the win81 runner + #! os: + #! runner: win81 + #! runtime: win-x64 steps: - #@ template.replace(prepareTest(cleanupWorkspace = True)) diff --git a/.github/workflows/test-ios.yml b/.github/workflows/test-ios.yml index f26b8cd13a..ec14d9db15 100755 --- a/.github/workflows/test-ios.yml +++ b/.github/workflows/test-ios.yml @@ -106,7 +106,7 @@ jobs: with: appPath: Tests/Tests.Maui/bin/Release/net8.0-ios/iossimulator-x64/Tests.Maui.app bundleId: io.realm.mauitests - iphoneToSimulate: iPhone-8 + iphoneToSimulate: iPhone-15 arguments: --headless --result=${{ github.workspace }}/TestResults.iOS.xml --labels=After - name: Publish Unit Test Results uses: LaPeste/test-reporter@510caf50a955b1003bec48a6494be4d6537f3a0b diff --git a/.github/workflows/test-net-core.yml b/.github/workflows/test-net-core.yml index f83842c6e7..3f8f4592b6 100755 --- a/.github/workflows/test-net-core.yml +++ b/.github/workflows/test-net-core.yml @@ -35,10 +35,6 @@ jobs: os: runner: macos-14 runtime: osx-arm64 - - framework: net6.0 - os: - runner: win81 - runtime: win-x64 steps: - name: Checkout code uses: actions/checkout@v3 From c157d5dcfc76942e2e89666a12b34fad2fdc1177 Mon Sep 17 00:00:00 2001 From: Nikola Irinchev Date: Fri, 23 Feb 2024 22:15:37 +0100 Subject: [PATCH 09/16] Enable the intepreter for apple platforms on maui --- Tests/Tests.Maui/Tests.Maui.csproj | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/Tests/Tests.Maui/Tests.Maui.csproj b/Tests/Tests.Maui/Tests.Maui.csproj index 43aa5e08dc..6fb22e54ae 100644 --- a/Tests/Tests.Maui/Tests.Maui.csproj +++ b/Tests/Tests.Maui/Tests.Maui.csproj @@ -25,13 +25,18 @@ True - 11.0 - 13.2 - 21.0 + 11.0 + 13.2 + 21.0 10.0.17763.0 10.0.17763.0 + + + true + + @@ -59,7 +64,7 @@ - + Framework False @@ -70,7 +75,7 @@ - + Framework False @@ -82,7 +87,7 @@ - + lib\x86\librealm-wrappers.so PreserveNewest From 6dc787e19080572305170d36e7a9bb3bc56ac476 Mon Sep 17 00:00:00 2001 From: Nikola Irinchev Date: Fri, 23 Feb 2024 22:19:13 +0100 Subject: [PATCH 10/16] Revert "Enable the intepreter for apple platforms on maui" This reverts commit c157d5dcfc76942e2e89666a12b34fad2fdc1177. --- Tests/Tests.Maui/Tests.Maui.csproj | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/Tests/Tests.Maui/Tests.Maui.csproj b/Tests/Tests.Maui/Tests.Maui.csproj index 6fb22e54ae..43aa5e08dc 100644 --- a/Tests/Tests.Maui/Tests.Maui.csproj +++ b/Tests/Tests.Maui/Tests.Maui.csproj @@ -25,18 +25,13 @@ True - 11.0 - 13.2 - 21.0 + 11.0 + 13.2 + 21.0 10.0.17763.0 10.0.17763.0 - - - true - - @@ -64,7 +59,7 @@ - + Framework False @@ -75,7 +70,7 @@ - + Framework False @@ -87,7 +82,7 @@ - + lib\x86\librealm-wrappers.so PreserveNewest From 0da95911bc6ca814d268d1cd4cfab4d6b4722f23 Mon Sep 17 00:00:00 2001 From: Nikola Irinchev Date: Fri, 23 Feb 2024 22:31:03 +0100 Subject: [PATCH 11/16] Run transforms outside of the test --- .github/templates/test-android.yml | 4 +-- .github/templates/test-code-coverage.yml | 2 +- .github/templates/test-ios.yml | 4 +-- .github/templates/test-macos.yml | 4 +-- .github/templates/test-net-core.yml | 2 +- .github/templates/test-net-framework.yml | 2 +- .github/templates/test-source-generation.yml | 2 +- .github/templates/test-tvos.yml | 2 +- .github/templates/test-unity.yml | 4 +-- .github/templates/test-uwp-managed.yml | 2 +- .github/templates/test-weaver.yml | 2 +- .github/templates/test-woven-classes.yml | 2 +- .github/templates/test.lib.yml | 30 ++++++++++++-------- .github/workflows/test-android.yml | 4 ++- .github/workflows/test-ios.yml | 4 ++- .github/workflows/test-macos.yml | 4 ++- Tests/Tests.Maui/MainPage.xaml.cs | 10 +------ 17 files changed, 44 insertions(+), 40 deletions(-) diff --git a/.github/templates/test-android.yml b/.github/templates/test-android.yml index 522a8599df..b9188d306c 100644 --- a/.github/templates/test-android.yml +++ b/.github/templates/test-android.yml @@ -25,7 +25,7 @@ jobs: project-arn: ${{ secrets.DEVICEFARM_PROJECT_ARN }} device-pool-arn: ${{ secrets.DEVICEFARM_ANDROID_POOL_ARN }} arguments: (@= baasTestArgs('android') @) - - #@ publishTestsResults("${{ steps.run_tests.outputs.test-results-path }}", "Xamarin.Android") + - #@ template.replace(publishTestsResults("${{ steps.run_tests.outputs.test-results-path }}", "Xamarin.Android")) test-maui: runs-on: windows-latest name: Maui.Android @@ -46,4 +46,4 @@ jobs: app-id: io.realm.mauitests project-arn: ${{ secrets.DEVICEFARM_PROJECT_ARN }} device-pool-arn: ${{ secrets.DEVICEFARM_ANDROID_POOL_ARN }} - - #@ publishTestsResults("${{ steps.run_tests.outputs.test-results-path }}", "Maui.Android") \ No newline at end of file + - #@ template.replace(publishTestsResults("${{ steps.run_tests.outputs.test-results-path }}", "Maui.Android", run_transform=True)) \ No newline at end of file diff --git a/.github/templates/test-code-coverage.yml b/.github/templates/test-code-coverage.yml index cbfae59535..5e01ad8d95 100644 --- a/.github/templates/test-code-coverage.yml +++ b/.github/templates/test-code-coverage.yml @@ -39,4 +39,4 @@ jobs: compare-sha: ${{ github.event.pull_request.base.sha }} - name: Output Coveralls response run: echo ${{ steps.publish-coveralls.outputs.coveralls-api-result }} - - #@ publishTestsResults("TestResults.Linux.xml", "Code Coverage") + - #@ template.replace(publishTestsResults("TestResults.Linux.xml", "Code Coverage")) diff --git a/.github/templates/test-ios.yml b/.github/templates/test-ios.yml index 229402b642..4049686088 100644 --- a/.github/templates/test-ios.yml +++ b/.github/templates/test-ios.yml @@ -20,7 +20,7 @@ jobs: bundleId: 'io.realm.dotnettests' iphoneToSimulate: 'iPhone-8' arguments: #@ "--headless --result=${{ github.workspace }}/TestResults.iOS.xml" + baasTestArgs("ios") - - #@ publishTestsResults("TestResults.iOS.xml", "Xamarin.iOS") + - #@ template.replace(publishTestsResults("TestResults.iOS.xml", "Xamarin.iOS")) test-maui: runs-on: macos-13 @@ -40,4 +40,4 @@ jobs: bundleId: 'io.realm.mauitests' iphoneToSimulate: 'iPhone-15' arguments: #@ "--headless --result=${{ github.workspace }}/TestResults.iOS.xml --labels=After" - - #@ publishTestsResults("TestResults.iOS.xml", "Maui.iOS") \ No newline at end of file + - #@ template.replace(publishTestsResults("TestResults.iOS.xml", "Maui.iOS", run_transform=True)) \ No newline at end of file diff --git a/.github/templates/test-macos.yml b/.github/templates/test-macos.yml index 53e88658c7..34893a2b74 100644 --- a/.github/templates/test-macos.yml +++ b/.github/templates/test-macos.yml @@ -15,7 +15,7 @@ jobs: - #@ template.replace(buildTests("Tests/Tests.XamarinMac")) - name: Run the tests run: #@ "Tests/Tests.XamarinMac/bin/" + configuration + "/Tests.XamarinMac.app/Contents/MacOS/Tests.XamarinMac --headless --result=${{ github.workspace }}/TestResults.XamarinMac.xml --labels=All" + baasTestArgs("xamarinmacos") - - #@ publishTestsResults("TestResults.XamarinMac.xml", "Xamarin.macOS") + - #@ template.replace(publishTestsResults("TestResults.XamarinMac.xml", "Xamarin.macOS")) test-maui: runs-on: macos-13 name: Maui.MacCatalyst @@ -29,4 +29,4 @@ jobs: run: #@ "dotnet build Tests/Tests.Maui -c " + configuration + " -f net8.0-maccatalyst -p:RestoreConfigFile=Tests/Test.NuGet.Config -p:UseRealmNupkgsWithVersion=${{ inputs.version }}" - name: Run the tests run: #@ "Tests/Tests.Maui/bin/" + configuration + "/net8.0-maccatalyst/maccatalyst-x64/Tests.Maui.app/Contents/MacOS/Tests.Maui --headless --result=${{ github.workspace }}/TestResults.MacCatalyst.xml --labels=All" + baasTestArgs("maccatalyst") - - #@ publishTestsResults("TestResults.MacCatalyst.xml", "Maui.MacCatalyst") \ No newline at end of file + - #@ template.replace(publishTestsResults("TestResults.MacCatalyst.xml", "Maui.MacCatalyst", run_transform=True)) \ No newline at end of file diff --git a/.github/templates/test-net-core.yml b/.github/templates/test-net-core.yml index 93c19785b3..35e4cfc1d8 100644 --- a/.github/templates/test-net-core.yml +++ b/.github/templates/test-net-core.yml @@ -46,4 +46,4 @@ jobs: with: name: crash-report-net-core-${{ matrix.runner }}-${{ matrix.runtime }} path: /tmp/coredump* - - #@ publishTestsResults("TestResults.xml", ".NET (${{ matrix.os.runner }}, ${{ matrix.framework }})") + - #@ template.replace(publishTestsResults("TestResults.xml", ".NET (${{ matrix.os.runner }}, ${{ matrix.framework }})")) diff --git a/.github/templates/test-net-framework.yml b/.github/templates/test-net-framework.yml index 558b48d925..3afe46653e 100644 --- a/.github/templates/test-net-framework.yml +++ b/.github/templates/test-net-framework.yml @@ -15,4 +15,4 @@ jobs: - #@ template.replace(buildTests("Tests/Realm.Tests", TargetFramework="net461", RealmTestsStandaloneExe="true")) - name: Run the tests run: #@ "./Tests/Realm.Tests/bin/" + configuration + "/net461/Realm.Tests.exe --result=TestResults.Windows.xml --labels=After" + baasTestArgs("net-framework") - - #@ publishTestsResults("TestResults.Windows.xml", ".NET Framework") + - #@ template.replace(publishTestsResults("TestResults.Windows.xml", ".NET Framework")) diff --git a/.github/templates/test-source-generation.yml b/.github/templates/test-source-generation.yml index 39eb311a04..56b06b3525 100644 --- a/.github/templates/test-source-generation.yml +++ b/.github/templates/test-source-generation.yml @@ -17,4 +17,4 @@ jobs: - #@ template.replace(dotnetPublish("Tests/SourceGenerators/Realm.SourceGenerator.Tests", "net6.0", "win-x64")) - name: Run the tests run: #@ "${{ steps.dotnet-publish.outputs.executable-path }}/Realm.SourceGenerator.Tests --result=TestResults.SourceGeneration.xml" - - #@ publishTestsResults("TestResults.SourceGeneration.xml", "Source Generation") + - #@ template.replace(publishTestsResults("TestResults.SourceGeneration.xml", "Source Generation")) diff --git a/.github/templates/test-tvos.yml b/.github/templates/test-tvos.yml index 6a4aea1502..941acc252b 100644 --- a/.github/templates/test-tvos.yml +++ b/.github/templates/test-tvos.yml @@ -21,4 +21,4 @@ jobs: iphoneToSimulate: 'Apple-TV-1080p' arguments: #@ "--headless --result=${{ github.workspace }}/TestResults.tvOS.xml --labels=All" + baasTestArgs("tvos") os: 'tvOS' - - #@ publishTestsResults("TestResults.tvOS.xml", "Xamarin.tvOS") \ No newline at end of file + - #@ template.replace(publishTestsResults("TestResults.tvOS.xml", "Xamarin.tvOS")) \ No newline at end of file diff --git a/.github/templates/test-unity.yml b/.github/templates/test-unity.yml index f3ccb8f6f4..18ce107bd9 100644 --- a/.github/templates/test-unity.yml +++ b/.github/templates/test-unity.yml @@ -72,7 +72,7 @@ jobs: run: | chmod +x ${{ github.workspace }}/TestRunner/PlayerWithTests.x86_64 xvfb-run --auto-servernum --server-args='-screen 0 640x480x24:32' ${{ github.workspace }}/TestRunner/PlayerWithTests.x86_64 -logFile - --result=${{ github.workspace }}/TestResults.xml - - #@ publishTestsResults("TestResults.xml", "Unity Linux Mono_Net4") + - #@ template.replace(publishTestsResults("TestResults.xml", "Unity Linux Mono_Net4")) run-tests-windows: runs-on: windows-latest @@ -93,4 +93,4 @@ jobs: Start-Process ${{ github.workspace }}\TestRunner\PlayerWithTests.exe -Wait -ArgumentList "-logFile","${{ github.workspace }}\test.log","--result=${{ github.workspace }}\TestResults.xml" cat ${{ github.workspace }}\test.log shell: powershell - - #@ publishTestsResults("TestResults.xml", "Unity Windows Mono_Net4") + - #@ template.replace(publishTestsResults("TestResults.xml", "Unity Windows Mono_Net4")) diff --git a/.github/templates/test-uwp-managed.yml b/.github/templates/test-uwp-managed.yml index 8b95ef43c0..402023fc66 100644 --- a/.github/templates/test-uwp-managed.yml +++ b/.github/templates/test-uwp-managed.yml @@ -23,4 +23,4 @@ jobs: - name: Run the tests run: #@ "./Tests/Tests.UWP/RunTests.ps1 -ExtraAppArgs '" + baasTestArgs("uwp-managed") + "'" shell: powershell - - #@ publishTestsResults("${{ env.TEST_RESULTS }}", "UWP Managed") + - #@ template.replace(publishTestsResults("${{ env.TEST_RESULTS }}", "UWP Managed")) diff --git a/.github/templates/test-weaver.yml b/.github/templates/test-weaver.yml index 0452dd2ab2..096278169b 100644 --- a/.github/templates/test-weaver.yml +++ b/.github/templates/test-weaver.yml @@ -29,4 +29,4 @@ jobs: - #@ template.replace(dotnetPublish("Tests/Weaver/Realm.Fody.Tests", "net6.0", "${{ matrix.os.runtime }}")) - name: Run Tests run: ${{ steps.dotnet-publish.outputs.executable-path }}/Realm.Fody.Tests --result=TestResults.Weaver.xml --labels=After - - #@ publishTestsResults("TestResults.Weaver.xml", "Weaver ${{ matrix.os.runtime }}") + - #@ template.replace(publishTestsResults("TestResults.Weaver.xml", "Weaver ${{ matrix.os.runtime }}")) diff --git a/.github/templates/test-woven-classes.yml b/.github/templates/test-woven-classes.yml index d98a39d670..741014778d 100644 --- a/.github/templates/test-woven-classes.yml +++ b/.github/templates/test-woven-classes.yml @@ -16,4 +16,4 @@ jobs: - #@ template.replace(wovenClassesBuildTests("Tests/Realm.Tests", "net8.0", "win-x64")) - name: Run the tests run: #@ "${{ steps.dotnet-publish.outputs.executable-path }}/Realm.Tests --result=TestResults.WovenClasses.xml --labels=After" - - #@ publishTestsResults("TestResults.WovenClasses.xml", "Woven classes") + - #@ template.replace(publishTestsResults("TestResults.WovenClasses.xml", "Woven classes")) diff --git a/.github/templates/test.lib.yml b/.github/templates/test.lib.yml index e3df7d41e8..aceafd06bc 100644 --- a/.github/templates/test.lib.yml +++ b/.github/templates/test.lib.yml @@ -5,18 +5,24 @@ #@ return " --baasaas-api-key=${{ secrets.BaaSaasApiKey}} --baas-differentiator=" + differentiator #@ end --- -#@ def publishTestsResults(files, test_title): -name: Publish Unit Test Results -uses: LaPeste/test-reporter@510caf50a955b1003bec48a6494be4d6537f3a0b -if: always() -with: - name: #@ "Results " + test_title - path: #@ files - reporter: java-junit - list-suites: failed - list-tests: failed - path-replace-backslashes: true - fail-on-error: false +#@ def publishTestsResults(file, test_title, run_transform=False): + #@ output_file = file + #@ if run_transform: + #@ output_file = file + "_transformed.xml" + - name: Transform Results + run: #@ "xsltproc --output " + output_file + " Tests/Realm.Tests/EmbeddedResources/nunit3-junit.xslt " + file + #@ end + - name: Publish Unit Test Results + uses: LaPeste/test-reporter@510caf50a955b1003bec48a6494be4d6537f3a0b + if: always() + with: + name: #@ "Results " + test_title + path: #@ output_file + reporter: java-junit + list-suites: failed + list-tests: failed + path-replace-backslashes: true + fail-on-error: false #@ end --- #@ def testDefinition(additionalSecrets = [], additionalInputs = []): diff --git a/.github/workflows/test-android.yml b/.github/workflows/test-android.yml index eead6d79d0..031c004313 100755 --- a/.github/workflows/test-android.yml +++ b/.github/workflows/test-android.yml @@ -137,12 +137,14 @@ jobs: app-id: io.realm.mauitests project-arn: ${{ secrets.DEVICEFARM_PROJECT_ARN }} device-pool-arn: ${{ secrets.DEVICEFARM_ANDROID_POOL_ARN }} + - name: Transform Results + run: xsltproc --output ${{ steps.run_tests.outputs.test-results-path }}_transformed.xml Tests/Realm.Tests/EmbeddedResources/nunit3-junit.xslt ${{ steps.run_tests.outputs.test-results-path }} - name: Publish Unit Test Results uses: LaPeste/test-reporter@510caf50a955b1003bec48a6494be4d6537f3a0b if: always() with: name: Results Maui.Android - path: ${{ steps.run_tests.outputs.test-results-path }} + path: ${{ steps.run_tests.outputs.test-results-path }}_transformed.xml reporter: java-junit list-suites: failed list-tests: failed diff --git a/.github/workflows/test-ios.yml b/.github/workflows/test-ios.yml index ec14d9db15..ecc40a28ab 100755 --- a/.github/workflows/test-ios.yml +++ b/.github/workflows/test-ios.yml @@ -108,12 +108,14 @@ jobs: bundleId: io.realm.mauitests iphoneToSimulate: iPhone-15 arguments: --headless --result=${{ github.workspace }}/TestResults.iOS.xml --labels=After + - name: Transform Results + run: xsltproc --output TestResults.iOS.xml_transformed.xml Tests/Realm.Tests/EmbeddedResources/nunit3-junit.xslt TestResults.iOS.xml - name: Publish Unit Test Results uses: LaPeste/test-reporter@510caf50a955b1003bec48a6494be4d6537f3a0b if: always() with: name: Results Maui.iOS - path: TestResults.iOS.xml + path: TestResults.iOS.xml_transformed.xml reporter: java-junit list-suites: failed list-tests: failed diff --git a/.github/workflows/test-macos.yml b/.github/workflows/test-macos.yml index 74ed1449c8..16bad6d323 100755 --- a/.github/workflows/test-macos.yml +++ b/.github/workflows/test-macos.yml @@ -98,12 +98,14 @@ jobs: run: dotnet build Tests/Tests.Maui -c Release -f net8.0-maccatalyst -p:RestoreConfigFile=Tests/Test.NuGet.Config -p:UseRealmNupkgsWithVersion=${{ inputs.version }} - name: Run the tests run: Tests/Tests.Maui/bin/Release/net8.0-maccatalyst/maccatalyst-x64/Tests.Maui.app/Contents/MacOS/Tests.Maui --headless --result=${{ github.workspace }}/TestResults.MacCatalyst.xml --labels=All --baasaas-api-key=${{ secrets.BaaSaasApiKey}} --baas-differentiator=maccatalyst + - name: Transform Results + run: xsltproc --output TestResults.MacCatalyst.xml_transformed.xml Tests/Realm.Tests/EmbeddedResources/nunit3-junit.xslt TestResults.MacCatalyst.xml - name: Publish Unit Test Results uses: LaPeste/test-reporter@510caf50a955b1003bec48a6494be4d6537f3a0b if: always() with: name: Results Maui.MacCatalyst - path: TestResults.MacCatalyst.xml + path: TestResults.MacCatalyst.xml_transformed.xml reporter: java-junit list-suites: failed list-tests: failed diff --git a/Tests/Tests.Maui/MainPage.xaml.cs b/Tests/Tests.Maui/MainPage.xaml.cs index 5776457dd2..4951620b43 100644 --- a/Tests/Tests.Maui/MainPage.xaml.cs +++ b/Tests/Tests.Maui/MainPage.xaml.cs @@ -93,15 +93,7 @@ private async Task RunTests() } }); }); - var failed = autorun.Execute(arguments.Where(a => a != "--headless").ToArray(), writer, reader); - - var resultPath = TestHelpers.GetResultsPath(MauiProgram.Args); - if (!string.IsNullOrEmpty(resultPath)) - { - TestHelpers.TransformTestResults(resultPath); - } - - return failed; + return autorun.Execute(arguments.Where(a => a != "--headless").ToArray(), writer, reader); }); ResultsLabel.Text = $"Test run complete. Failed: {result}"; From a5276aa4fefb33e67d81d2f77ebfa6ed08d12f4b Mon Sep 17 00:00:00 2001 From: Nikola Irinchev Date: Mon, 26 Feb 2024 21:39:53 +0100 Subject: [PATCH 12/16] Rename the android test results to something more normal --- .github/actions/run-android-device-farm-test/action.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/actions/run-android-device-farm-test/action.yml b/.github/actions/run-android-device-farm-test/action.yml index 659d94a001..ff76194fe1 100644 --- a/.github/actions/run-android-device-farm-test/action.yml +++ b/.github/actions/run-android-device-farm-test/action.yml @@ -54,7 +54,8 @@ runs: Customer Artifacts.zip - run: | Expand-Archive 'Customer Artifacts.zip' -DestinationPath artifacts - echo "results-path=${{ github.workspace }}/artifacts/Host_Machine_Files/`$DEVICEFARM_LOG_DIR/TestResults.Android.xml" | Out-File -FilePath $Env:GITHUB_OUTPUT -Encoding utf8 -Append + Move-Item -Path ${{ github.workspace }}/artifacts/Host_Machine_Files/`$DEVICEFARM_LOG_DIR/TestResults.Android.xml -Destination ${{ github.workspace }}/TestResults.Android.xml + echo "results-path=${{ github.workspace }}/TestResults.Android.xml" | Out-File -FilePath $Env:GITHUB_OUTPUT -Encoding utf8 -Append name: Fetch test artifacts shell: pwsh id: get-test-results From 43a4098f4a6420454543b25db437ca8c3a86d44b Mon Sep 17 00:00:00 2001 From: Nikola Irinchev Date: Mon, 26 Feb 2024 23:15:47 +0100 Subject: [PATCH 13/16] Use bash for xslt transform --- .github/templates/common.lib.yml | 2 +- .github/templates/test.lib.yml | 1 + .github/workflows/test-android.yml | 1 + .github/workflows/test-ios.yml | 5 +++-- .github/workflows/test-macos.yml | 1 + .github/workflows/test-tvos.yml | 2 +- 6 files changed, 8 insertions(+), 4 deletions(-) diff --git a/.github/templates/common.lib.yml b/.github/templates/common.lib.yml index 8a477c04c9..8f3ebdcc4a 100644 --- a/.github/templates/common.lib.yml +++ b/.github/templates/common.lib.yml @@ -13,7 +13,7 @@ #@ actionCodeQLAnalyze = "github/codeql-action/analyze@40542d38bc4936c2ca7da883aeb050a6081b4b31" #@ actionSetupNode = "actions/setup-node@16352bb09bc672a073e326c2cc1d3d7d2a3e577e" #@ actionAWSConfigureCredentials = "aws-actions/configure-aws-credentials@v1-node16" -#@ actionRuniOSSimulator = "realm/ci-actions/run-ios-simulator@fa20eb972b9f018654fdb4e2c7afb52b0532f907" +#@ actionRuniOSSimulator = "realm/ci-actions/run-ios-simulator@fc0cd5604b46cf894ada5fbda3aa0fb6e5e01230" #@ actionReleaseToSlack = "realm/ci-actions/release-to-slack@fa20eb972b9f018654fdb4e2c7afb52b0532f907" #@ actionSetupXcode = "maxim-lobanov/setup-xcode@60606e260d2fc5762a71e64e74b2174e8ea3c8bd" #@ actionSetupAndroid = "android-actions/setup-android@7c5672355aaa8fde5f97a91aa9a99616d1ace6bc" diff --git a/.github/templates/test.lib.yml b/.github/templates/test.lib.yml index aceafd06bc..d8e9f649ee 100644 --- a/.github/templates/test.lib.yml +++ b/.github/templates/test.lib.yml @@ -11,6 +11,7 @@ #@ output_file = file + "_transformed.xml" - name: Transform Results run: #@ "xsltproc --output " + output_file + " Tests/Realm.Tests/EmbeddedResources/nunit3-junit.xslt " + file + shell: bash #@ end - name: Publish Unit Test Results uses: LaPeste/test-reporter@510caf50a955b1003bec48a6494be4d6537f3a0b diff --git a/.github/workflows/test-android.yml b/.github/workflows/test-android.yml index 031c004313..d6c2394ea2 100755 --- a/.github/workflows/test-android.yml +++ b/.github/workflows/test-android.yml @@ -139,6 +139,7 @@ jobs: device-pool-arn: ${{ secrets.DEVICEFARM_ANDROID_POOL_ARN }} - name: Transform Results run: xsltproc --output ${{ steps.run_tests.outputs.test-results-path }}_transformed.xml Tests/Realm.Tests/EmbeddedResources/nunit3-junit.xslt ${{ steps.run_tests.outputs.test-results-path }} + shell: bash - name: Publish Unit Test Results uses: LaPeste/test-reporter@510caf50a955b1003bec48a6494be4d6537f3a0b if: always() diff --git a/.github/workflows/test-ios.yml b/.github/workflows/test-ios.yml index ecc40a28ab..ff344963df 100755 --- a/.github/workflows/test-ios.yml +++ b/.github/workflows/test-ios.yml @@ -48,7 +48,7 @@ jobs: - name: Build Tests/Tests.iOS run: msbuild Tests/Tests.iOS -p:Configuration=Release -restore -p:RestoreConfigFile=Tests/Test.NuGet.Config -p:UseRealmNupkgsWithVersion=${{ inputs.version }} -p:Platform=iPhoneSimulator - name: Run the tests - uses: realm/ci-actions/run-ios-simulator@fa20eb972b9f018654fdb4e2c7afb52b0532f907 + uses: realm/ci-actions/run-ios-simulator@fc0cd5604b46cf894ada5fbda3aa0fb6e5e01230 with: appPath: Tests/Tests.iOS/bin/iPhoneSimulator/Release/Tests.iOS.app bundleId: io.realm.dotnettests @@ -102,7 +102,7 @@ jobs: - name: Build the tests run: dotnet build Tests/Tests.Maui -c Release -f net8.0-ios -p:RestoreConfigFile=Tests/Test.NuGet.Config -p:UseRealmNupkgsWithVersion=${{ inputs.version }} - name: Run the tests - uses: realm/ci-actions/run-ios-simulator@fa20eb972b9f018654fdb4e2c7afb52b0532f907 + uses: realm/ci-actions/run-ios-simulator@fc0cd5604b46cf894ada5fbda3aa0fb6e5e01230 with: appPath: Tests/Tests.Maui/bin/Release/net8.0-ios/iossimulator-x64/Tests.Maui.app bundleId: io.realm.mauitests @@ -110,6 +110,7 @@ jobs: arguments: --headless --result=${{ github.workspace }}/TestResults.iOS.xml --labels=After - name: Transform Results run: xsltproc --output TestResults.iOS.xml_transformed.xml Tests/Realm.Tests/EmbeddedResources/nunit3-junit.xslt TestResults.iOS.xml + shell: bash - name: Publish Unit Test Results uses: LaPeste/test-reporter@510caf50a955b1003bec48a6494be4d6537f3a0b if: always() diff --git a/.github/workflows/test-macos.yml b/.github/workflows/test-macos.yml index 16bad6d323..fdd921b36f 100755 --- a/.github/workflows/test-macos.yml +++ b/.github/workflows/test-macos.yml @@ -100,6 +100,7 @@ jobs: run: Tests/Tests.Maui/bin/Release/net8.0-maccatalyst/maccatalyst-x64/Tests.Maui.app/Contents/MacOS/Tests.Maui --headless --result=${{ github.workspace }}/TestResults.MacCatalyst.xml --labels=All --baasaas-api-key=${{ secrets.BaaSaasApiKey}} --baas-differentiator=maccatalyst - name: Transform Results run: xsltproc --output TestResults.MacCatalyst.xml_transformed.xml Tests/Realm.Tests/EmbeddedResources/nunit3-junit.xslt TestResults.MacCatalyst.xml + shell: bash - name: Publish Unit Test Results uses: LaPeste/test-reporter@510caf50a955b1003bec48a6494be4d6537f3a0b if: always() diff --git a/.github/workflows/test-tvos.yml b/.github/workflows/test-tvos.yml index ff14b7aefc..cab5fc5ac8 100755 --- a/.github/workflows/test-tvos.yml +++ b/.github/workflows/test-tvos.yml @@ -42,7 +42,7 @@ jobs: - name: Build Tests/Tests.XamarinTVOS run: msbuild Tests/Tests.XamarinTVOS -p:Configuration=Release -restore -p:RestoreConfigFile=Tests/Test.NuGet.Config -p:UseRealmNupkgsWithVersion=${{ inputs.version }} -p:Platform=iPhoneSimulator - name: Run the tests - uses: realm/ci-actions/run-ios-simulator@fa20eb972b9f018654fdb4e2c7afb52b0532f907 + uses: realm/ci-actions/run-ios-simulator@fc0cd5604b46cf894ada5fbda3aa0fb6e5e01230 with: appPath: Tests/Tests.XamarinTVOS/bin/iPhoneSimulator/Release/Tests.XamarinTVOS.app bundleId: io.realm.Tests-XamarinTVOS From e5adcbd9fb49d440e71335afb7f7ef3ef66ce360 Mon Sep 17 00:00:00 2001 From: Nikola Irinchev Date: Tue, 27 Feb 2024 01:54:43 +0100 Subject: [PATCH 14/16] Try to fix android paths, update simulator action --- .github/actions/run-android-device-farm-test/action.yml | 4 ++-- .github/templates/common.lib.yml | 2 +- .github/workflows/test-ios.yml | 4 ++-- .github/workflows/test-tvos.yml | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/actions/run-android-device-farm-test/action.yml b/.github/actions/run-android-device-farm-test/action.yml index ff76194fe1..deee639ace 100644 --- a/.github/actions/run-android-device-farm-test/action.yml +++ b/.github/actions/run-android-device-farm-test/action.yml @@ -54,8 +54,8 @@ runs: Customer Artifacts.zip - run: | Expand-Archive 'Customer Artifacts.zip' -DestinationPath artifacts - Move-Item -Path ${{ github.workspace }}/artifacts/Host_Machine_Files/`$DEVICEFARM_LOG_DIR/TestResults.Android.xml -Destination ${{ github.workspace }}/TestResults.Android.xml - echo "results-path=${{ github.workspace }}/TestResults.Android.xml" | Out-File -FilePath $Env:GITHUB_OUTPUT -Encoding utf8 -Append + Move-Item -Path artifacts/Host_Machine_Files/`$DEVICEFARM_LOG_DIR/TestResults.Android.xml -Destination TestResults.Android.xml + echo "results-path=TestResults.Android.xml" | Out-File -FilePath $Env:GITHUB_OUTPUT -Encoding utf8 -Append name: Fetch test artifacts shell: pwsh id: get-test-results diff --git a/.github/templates/common.lib.yml b/.github/templates/common.lib.yml index 8f3ebdcc4a..23bc1d104e 100644 --- a/.github/templates/common.lib.yml +++ b/.github/templates/common.lib.yml @@ -13,7 +13,7 @@ #@ actionCodeQLAnalyze = "github/codeql-action/analyze@40542d38bc4936c2ca7da883aeb050a6081b4b31" #@ actionSetupNode = "actions/setup-node@16352bb09bc672a073e326c2cc1d3d7d2a3e577e" #@ actionAWSConfigureCredentials = "aws-actions/configure-aws-credentials@v1-node16" -#@ actionRuniOSSimulator = "realm/ci-actions/run-ios-simulator@fc0cd5604b46cf894ada5fbda3aa0fb6e5e01230" +#@ actionRuniOSSimulator = "realm/ci-actions/run-ios-simulator@cd3efc67e2583fc5257d6a94edf29f7ccfbb9897" #@ actionReleaseToSlack = "realm/ci-actions/release-to-slack@fa20eb972b9f018654fdb4e2c7afb52b0532f907" #@ actionSetupXcode = "maxim-lobanov/setup-xcode@60606e260d2fc5762a71e64e74b2174e8ea3c8bd" #@ actionSetupAndroid = "android-actions/setup-android@7c5672355aaa8fde5f97a91aa9a99616d1ace6bc" diff --git a/.github/workflows/test-ios.yml b/.github/workflows/test-ios.yml index ff344963df..9c2fae18f8 100755 --- a/.github/workflows/test-ios.yml +++ b/.github/workflows/test-ios.yml @@ -48,7 +48,7 @@ jobs: - name: Build Tests/Tests.iOS run: msbuild Tests/Tests.iOS -p:Configuration=Release -restore -p:RestoreConfigFile=Tests/Test.NuGet.Config -p:UseRealmNupkgsWithVersion=${{ inputs.version }} -p:Platform=iPhoneSimulator - name: Run the tests - uses: realm/ci-actions/run-ios-simulator@fc0cd5604b46cf894ada5fbda3aa0fb6e5e01230 + uses: realm/ci-actions/run-ios-simulator@cd3efc67e2583fc5257d6a94edf29f7ccfbb9897 with: appPath: Tests/Tests.iOS/bin/iPhoneSimulator/Release/Tests.iOS.app bundleId: io.realm.dotnettests @@ -102,7 +102,7 @@ jobs: - name: Build the tests run: dotnet build Tests/Tests.Maui -c Release -f net8.0-ios -p:RestoreConfigFile=Tests/Test.NuGet.Config -p:UseRealmNupkgsWithVersion=${{ inputs.version }} - name: Run the tests - uses: realm/ci-actions/run-ios-simulator@fc0cd5604b46cf894ada5fbda3aa0fb6e5e01230 + uses: realm/ci-actions/run-ios-simulator@cd3efc67e2583fc5257d6a94edf29f7ccfbb9897 with: appPath: Tests/Tests.Maui/bin/Release/net8.0-ios/iossimulator-x64/Tests.Maui.app bundleId: io.realm.mauitests diff --git a/.github/workflows/test-tvos.yml b/.github/workflows/test-tvos.yml index cab5fc5ac8..09dfb69c70 100755 --- a/.github/workflows/test-tvos.yml +++ b/.github/workflows/test-tvos.yml @@ -42,7 +42,7 @@ jobs: - name: Build Tests/Tests.XamarinTVOS run: msbuild Tests/Tests.XamarinTVOS -p:Configuration=Release -restore -p:RestoreConfigFile=Tests/Test.NuGet.Config -p:UseRealmNupkgsWithVersion=${{ inputs.version }} -p:Platform=iPhoneSimulator - name: Run the tests - uses: realm/ci-actions/run-ios-simulator@fc0cd5604b46cf894ada5fbda3aa0fb6e5e01230 + uses: realm/ci-actions/run-ios-simulator@cd3efc67e2583fc5257d6a94edf29f7ccfbb9897 with: appPath: Tests/Tests.XamarinTVOS/bin/iPhoneSimulator/Release/Tests.XamarinTVOS.app bundleId: io.realm.Tests-XamarinTVOS From 795970d884adff917b449a311e1a6e33fe0d0530 Mon Sep 17 00:00:00 2001 From: Nikola Irinchev Date: Tue, 27 Feb 2024 02:44:05 +0100 Subject: [PATCH 15/16] Fix warnings --- Realm.sln.DotSettings | 1 + Tests/Realm.Tests/Sync/MongoClientTests.cs | 6 +- Tests/Realm.Tests/Sync/StaticQueriesTests.cs | 72 ++++++++++---------- Tests/Realm.Tests/TestHelpers.cs | 7 ++ 4 files changed, 48 insertions(+), 38 deletions(-) diff --git a/Realm.sln.DotSettings b/Realm.sln.DotSettings index c84c41511a..083a674bfb 100644 --- a/Realm.sln.DotSettings +++ b/Realm.sln.DotSettings @@ -94,6 +94,7 @@ True True True + True True True True diff --git a/Tests/Realm.Tests/Sync/MongoClientTests.cs b/Tests/Realm.Tests/Sync/MongoClientTests.cs index 7300b80184..6dc426b85a 100644 --- a/Tests/Realm.Tests/Sync/MongoClientTests.cs +++ b/Tests/Realm.Tests/Sync/MongoClientTests.cs @@ -2108,7 +2108,8 @@ public void MongoCollection_FindOneAndDelete_FilterSortProjection() var projection = BsonDocument.Parse("{ LongValue: 1 }"); var result = await collection.FindOneAndDeleteAsync(filter, sort, projection); - Assert.That(result.Id, Is.EqualTo(inserted[1].Id)); + Assert.That(result, Is.Not.Null); + Assert.That(result!.Id, Is.EqualTo(inserted[1].Id)); Assert.That(result.StringValue, Is.Null); Assert.That(result.LongValue, Is.EqualTo(inserted[1].LongValue)); @@ -2126,7 +2127,8 @@ public void MongoCollection_FindOne_Remapped() var inserted = await InsertRemappedData(collection); var result = await collection.FindOneAsync(); - Assert.That(result.Id, Is.EqualTo(inserted[0].Id)); + Assert.That(result, Is.Not.Null); + Assert.That(result!.Id, Is.EqualTo(inserted[0].Id)); Assert.That(result.StringValue, Is.EqualTo(inserted[0].StringValue)); Assert.That(result.MappedLink!.Id, Is.EqualTo(inserted[1].Id)); Assert.That(result.MappedList[0].Id, Is.EqualTo(inserted[2].Id)); diff --git a/Tests/Realm.Tests/Sync/StaticQueriesTests.cs b/Tests/Realm.Tests/Sync/StaticQueriesTests.cs index 0879cd696e..f4864edec7 100644 --- a/Tests/Realm.Tests/Sync/StaticQueriesTests.cs +++ b/Tests/Realm.Tests/Sync/StaticQueriesTests.cs @@ -28,7 +28,6 @@ using Realms.Schema; using Realms.Sync; using Realms.Sync.Exceptions; - using static Realms.Tests.TestHelpers; namespace Realms.Tests.Sync @@ -63,15 +62,15 @@ public void RealmObjectAPI_Collections() var syncObj1 = syncObjects.Single(); - AssertProps(obj1, syncObj1); + AssertCollectionProps(obj1, syncObj1); realm.Write(() => realm.Add(syncObj2)); var filter = new { _id = syncObj2.Id }; - var obj2 = await WaitForConditionAsync(() => collection.FindOneAsync(filter), item => Task.FromResult(item != null)); + var obj2 = await WaitForNonNullObjectAsync(() => collection.FindOneAsync(filter)); - AssertProps(syncObj2, obj2); + AssertCollectionProps(syncObj2, obj2); void FillCollectionProps(SyncCollectionsObject obj) { @@ -81,7 +80,7 @@ void FillCollectionProps(SyncCollectionsObject obj) } } - void AssertProps(SyncCollectionsObject expected, SyncCollectionsObject actual) + void AssertCollectionProps(SyncCollectionsObject expected, SyncCollectionsObject actual) { foreach (var prop in props) { @@ -94,7 +93,7 @@ void AssertProps(SyncCollectionsObject expected, SyncCollectionsObject actual) }, timeout: 120000); } - public static readonly object[] PrimitiveTestCases = new[] + public static readonly object[] PrimitiveTestCases = { new object[] { CreateTestCase("Empty object", new SyncAllTypesObject()) }, new object[] @@ -175,7 +174,7 @@ public void RealmObjectAPI_Primitive_RealmToAtlas(TestCaseData collection.FindOneAsync(filter), item => Task.FromResult(item != null)); + var syncObj = await WaitForNonNullObjectAsync(() => collection.FindOneAsync(filter)); AssertProps(props, obj, syncObj); }, timeout: 120000); @@ -189,7 +188,7 @@ public void RealmObjectAPI_Primitive_RealmToAtlas(TestCaseData te }, timeout: 120000); } - public static readonly object[] DateTimeTestCasesRealmToAtlas = new[] + public static readonly object[] DateTimeTestCasesRealmToAtlas = { new object[] { CreateTestCase("PostEpoch", new DateTimeOffset(638404890727190000, TimeSpan.Zero)) }, new object[] { CreateTestCase("PostEpoch-subprecision", new DateTimeOffset(638404890727196472, TimeSpan.Zero)) }, @@ -238,7 +237,7 @@ public void RealmObjectAPI_DateTime_RealmToAtlas(TestCaseData te var filter = new { _id = obj.Id }; - var syncObj = await WaitForConditionAsync(() => collection.FindOneAsync(filter), item => Task.FromResult(item != null)); + var syncObj = await WaitForNonNullObjectAsync(() => collection.FindOneAsync(filter)); AssertAreEqual(syncObj.DateTimeOffsetProperty, obj.DateTimeOffsetProperty); }, timeout: 120000); @@ -261,7 +260,7 @@ public void RealmObjectAPI_DateTime_RealmToAtlas_SpecialCase() var filter = new { _id = obj.Id }; - var syncObj = await WaitForConditionAsync(() => collection.FindOneAsync(filter), item => Task.FromResult(item != null)); + var syncObj = await WaitForNonNullObjectAsync(() => collection.FindOneAsync(filter)); var originalUnixMs = obj.DateTimeOffsetProperty.ToUnixTimeMilliseconds(); var expectedUnixMs = syncObj.DateTimeOffsetProperty.ToUnixTimeMilliseconds(); @@ -270,7 +269,7 @@ public void RealmObjectAPI_DateTime_RealmToAtlas_SpecialCase() }, timeout: 120000); } - public static readonly object[] CounterTestCases = new[] + public static readonly object[] CounterTestCases = { new object[] { @@ -342,13 +341,13 @@ public void RealmObjectAPI_Counter_RealmToAtlas(TestCaseData test var filter = new { _id = obj.Id }; - var syncObj = await WaitForConditionAsync(() => collection.FindOneAsync(filter), item => Task.FromResult(item != null)); + var syncObj = await WaitForNonNullObjectAsync(() => collection.FindOneAsync(filter)); AssertProps(props, obj, syncObj); }, timeout: 120000); } - public static readonly object[] AsymmetricTestCases = new[] + public static readonly object[] AsymmetricTestCases = { new object[] { @@ -370,13 +369,13 @@ public void RealmObjectAPI_Asymmetric_RealmToAtlas(TestCaseData realm.Add(obj)); - var syncObj = await WaitForConditionAsync(() => collection.FindOneAsync(filter), item => Task.FromResult(item != null)); + var syncObj = await WaitForNonNullObjectAsync(() => collection.FindOneAsync(filter)); Assert.That(stringProperty, Is.EqualTo(syncObj.PartitionLike)); }, timeout: 120000); } - public static readonly object[] ObjectTestCases = new[] + public static readonly object[] ObjectTestCases = { new object[] { @@ -433,8 +432,8 @@ public void RealmObjectAPI_Object_RealmToAtlas(TestCaseData await realm.All().Where(o => o.Id == obj.ObjectProperty!.Id).SubscribeAsync(); realm.Write(() => realm.Add(obj)); - var syncAllTypeObj = await WaitForConditionAsync(() => syncAllTypesCollection.FindOneAsync(new { _id = obj.Id }), item => Task.FromResult(item != null)); - var intPropertyObj = await WaitForConditionAsync(() => intPropertyCollection.FindOneAsync(new { _id = obj.ObjectProperty!.Id }), item => Task.FromResult(item != null)); + var syncAllTypeObj = await WaitForNonNullObjectAsync(() => syncAllTypesCollection.FindOneAsync(new { _id = obj.Id })); + var intPropertyObj = await WaitForNonNullObjectAsync(() => intPropertyCollection.FindOneAsync(new { _id = obj.ObjectProperty!.Id })); Assert.That(syncAllTypeObj.ObjectProperty!.Id, Is.EqualTo(obj.ObjectProperty!.Id)); Assert.That(syncAllTypeObj.ObjectProperty!.Int, Is.Not.EqualTo(obj.ObjectProperty!.Int)); @@ -444,7 +443,7 @@ public void RealmObjectAPI_Object_RealmToAtlas(TestCaseData }, timeout: 120000); } - public static readonly object[] LinksTestCases = new[] + public static readonly object[] LinksTestCases = { new object[] { @@ -536,7 +535,7 @@ public void RealmObjectAPI_Links_AtlasToRealm(TestCaseData testCase await collection.InsertManyAsync(elementsToInsert!); // How many objects we expect - var totalCount = obj.List.Count + obj.Set.Count + obj.Dictionary.Where(d => d.Value != null).Count() + 1 + (obj.Link is null ? 0 : 1); + var totalCount = obj.List.Count + obj.Set.Count + obj.Dictionary.Count(d => d.Value != null) + 1 + (obj.Link is null ? 0 : 1); using var realm = await GetFLXIntegrationRealmAsync(); var linkObjs = await realm.All().SubscribeAsync(); @@ -582,8 +581,8 @@ static void AssertEqual(LinksObject? retrieved, LinksObject? original) else { Assert.That(retrieved, Is.Not.Null); - Assert.That(retrieved!.Id, Is.EqualTo(original!.Id)); - Assert.That(retrieved!.Value, Is.EqualTo(original!.Value)); + Assert.That(retrieved!.Id, Is.EqualTo(original.Id)); + Assert.That(retrieved.Value, Is.EqualTo(original.Value)); } } }, timeout: 120000); @@ -606,7 +605,7 @@ public void RealmObjectAPI_Links_RealmToAtlas(TestCaseData testCase realm.Write(() => realm.Add(obj)); await WaitForUploadAsync(realm); - var linkObj = await WaitForConditionAsync(() => collection.FindOneAsync(new { _id = obj.Id }), item => Task.FromResult(item != null)); + var linkObj = await WaitForNonNullObjectAsync(() => collection.FindOneAsync(new { _id = obj.Id })); await AssertEqual(collection, linkObj.Link, obj.Link); @@ -646,7 +645,7 @@ static async Task AssertEqual(MongoClient.Collection collection, Li Assert.That(partiallyRetrieved!.Id, Is.EqualTo(original.Id)); Assert.That(partiallyRetrieved.Value, Is.Not.EqualTo(original.Value)); - var fullyRetrieved = await WaitForConditionAsync(() => collection.FindOneAsync(new { _id = original.Id }), item => Task.FromResult(item != null)); + var fullyRetrieved = await WaitForNonNullObjectAsync(() => collection.FindOneAsync(new { _id = original.Id })); Assert.That(fullyRetrieved.Id, Is.EqualTo(original.Id)); Assert.That(fullyRetrieved.Value, Is.EqualTo(original.Value)); @@ -654,7 +653,7 @@ static async Task AssertEqual(MongoClient.Collection collection, Li }, timeout: 120000); } - public static readonly object[] RealmValueLinkTestCases = new[] + public static readonly object[] RealmValueLinkTestCases = { new object[] { @@ -734,18 +733,18 @@ public void RealmObjectAPI_RealmValueLinks_AtlasToRealm(TestCaseData o.As()) - .Concat(obj.RealmValueSet.Select(o => o.As()) - .Concat(obj.RealmValueDictionary.Values.Select(o => o.As()).Where(v => v is not null))); + .Concat(obj.RealmValueSet.Select(o => o.As()) + .Concat(obj.RealmValueDictionary.Values.Select(o => o.As()).Where(v => v is not null))); if (obj.RealmValueProperty != RealmValue.Null) { elementsToInsert = elementsToInsert.Concat(new[] { obj.RealmValueProperty.As() }); } - await intCollection.InsertManyAsync(elementsToInsert!); + await intCollection.InsertManyAsync(elementsToInsert); // How many objects we expect - var totalCount = obj.RealmValueList.Count + obj.RealmValueSet.Count + obj.RealmValueDictionary.Where(d => d.Value != RealmValue.Null).Count(); + var totalCount = obj.RealmValueList.Count + obj.RealmValueSet.Count + obj.RealmValueDictionary.Count(d => d.Value != RealmValue.Null); using var realm = await GetFLXIntegrationRealmAsync(); var intObjs = await realm.All().SubscribeAsync(); @@ -820,7 +819,7 @@ public void RealmObjectAPI_RealmValueLinks_RealmToAtlas(TestCaseData realm.Add(obj)); await WaitForUploadAsync(realm); - var realmValObj = await WaitForConditionAsync(() => realmValCollection.FindOneAsync(new { _id = obj.Id }), item => Task.FromResult(item != null)); + var realmValObj = await WaitForNonNullObjectAsync(() => realmValCollection.FindOneAsync(new { _id = obj.Id })); await AssertEqual(intCollection, realmValObj.RealmValueProperty, obj.RealmValueProperty); @@ -864,7 +863,7 @@ static async Task AssertEqual(MongoClient.Collection collecti Assert.That(retrievedAsObj.Id, Is.EqualTo(originalAsObj.Id)); Assert.That(retrievedAsObj.Int, Is.Not.EqualTo(originalAsObj.Int)); - var fullyRetrieved = await WaitForConditionAsync(() => collection.FindOneAsync(new { _id = originalAsObj.Id }), item => Task.FromResult(item != null)); + var fullyRetrieved = await WaitForNonNullObjectAsync(() => collection.FindOneAsync(new { _id = originalAsObj.Id })); Assert.That(fullyRetrieved.Id, Is.EqualTo(originalAsObj.Id)); Assert.That(fullyRetrieved.Int, Is.EqualTo(originalAsObj.Int)); @@ -1059,7 +1058,7 @@ public void RealmObjectAPI_Embedded_RealmToAtlas(TestCaseData realm.Add(obj)); await WaitForUploadAsync(realm); - var syncObj = await WaitForConditionAsync(() => collection.FindOneAsync(new { _id = obj.PrimaryKey }), item => Task.FromResult(item != null)); + var syncObj = await WaitForNonNullObjectAsync(() => collection.FindOneAsync(new { _id = obj.PrimaryKey })); AssertEmbedded(syncObj, obj); }, timeout: 120000); @@ -1132,7 +1131,7 @@ public void RealmObjectAPI_ExtraFields_IgnoredWhenUsingTypedCollection() var retrieved = await typedCollection.FindOneAsync(new { _id = primaryKey }); Assert.That(retrieved, Is.Not.Null); - Assert.That(retrieved.Value, Is.EqualTo(doc["Value"].AsString)); + Assert.That(retrieved!.Value, Is.EqualTo(doc["Value"].AsString)); }, timeout: 120000); } @@ -1151,7 +1150,7 @@ public void RealmObjectAPI_MismatchedType_ThrowsOnInsertWhenCollectionInSchema() { "Value", ObjectId.GenerateNewId() }, // Wrong type }; - var ex = await TestHelpers.AssertThrows(() => collection.InsertOneAsync(doc)); + var ex = await AssertThrows(() => collection.InsertOneAsync(doc)); Assert.That(ex.Message, Does.Contain("insert not permitted")); }, timeout: 120000); } @@ -1206,7 +1205,7 @@ public void RealmObjectAPI_MissingField_ThrowsOnInsertWhenCollectionInSchema() { "Int", 23 }, // Missing the GuidProperty field }; - var ex = await TestHelpers.AssertThrows(() => collection.InsertOneAsync(doc)); + var ex = await AssertThrows(() => collection.InsertOneAsync(doc)); Assert.That(ex.Message, Does.Contain("insert not permitted")); }, timeout: 120000); } @@ -1242,7 +1241,8 @@ public void RealmObjectAPI_MissingField_GetsDefaultValueWhenDeserialized() var typedCollection = db.GetCollection(collectionName); var retrieved = await typedCollection.FindOneAsync(new { _id = primaryKey }); - Assert.That(retrieved.Id, Is.EqualTo(primaryKey)); + Assert.That(retrieved, Is.Not.Null); + Assert.That(retrieved!.Id, Is.EqualTo(primaryKey)); Assert.That(retrieved.Int, Is.EqualTo(doc["Int"].AsInt32)); Assert.That(retrieved.GuidProperty, Is.EqualTo(default(Guid))); }, timeout: 120000); diff --git a/Tests/Realm.Tests/TestHelpers.cs b/Tests/Realm.Tests/TestHelpers.cs index 6157b290ce..7fda65121c 100644 --- a/Tests/Realm.Tests/TestHelpers.cs +++ b/Tests/Realm.Tests/TestHelpers.cs @@ -286,6 +286,13 @@ public static async Task WaitForConditionAsync(Func> producer, Fun return value; } + public static async Task WaitForNonNullObjectAsync(Func> producer) + { + var value = await WaitForConditionAsync(producer, v => Task.FromResult(v != null)); + Assert.That(value, Is.Not.Null); + return value!; + } + public static void RunAsyncTest(Func testFunc, int timeout = 30000, Task? errorTask = null) { AsyncContext.Run(async () => From 701de6f16cb9442ac8293cd2d6ae91d91dd39114 Mon Sep 17 00:00:00 2001 From: Nikola Irinchev Date: Tue, 27 Feb 2024 03:27:43 +0100 Subject: [PATCH 16/16] Update ci-actions commit sha --- .github/templates/common.lib.yml | 4 ++-- .github/workflows/prepare-release.yml | 2 +- .github/workflows/publish-release.yml | 2 +- .github/workflows/test-ios.yml | 4 ++-- .github/workflows/test-tvos.yml | 2 +- .github/workflows/wipe-clusters.yml | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/templates/common.lib.yml b/.github/templates/common.lib.yml index 23bc1d104e..cd4e6cb582 100644 --- a/.github/templates/common.lib.yml +++ b/.github/templates/common.lib.yml @@ -13,8 +13,8 @@ #@ actionCodeQLAnalyze = "github/codeql-action/analyze@40542d38bc4936c2ca7da883aeb050a6081b4b31" #@ actionSetupNode = "actions/setup-node@16352bb09bc672a073e326c2cc1d3d7d2a3e577e" #@ actionAWSConfigureCredentials = "aws-actions/configure-aws-credentials@v1-node16" -#@ actionRuniOSSimulator = "realm/ci-actions/run-ios-simulator@cd3efc67e2583fc5257d6a94edf29f7ccfbb9897" -#@ actionReleaseToSlack = "realm/ci-actions/release-to-slack@fa20eb972b9f018654fdb4e2c7afb52b0532f907" +#@ actionRuniOSSimulator = "realm/ci-actions/run-ios-simulator@6418e15ed9bbdb19b7d456a347e5623779f95cdf" +#@ actionReleaseToSlack = "realm/ci-actions/release-to-slack@6418e15ed9bbdb19b7d456a347e5623779f95cdf" #@ actionSetupXcode = "maxim-lobanov/setup-xcode@60606e260d2fc5762a71e64e74b2174e8ea3c8bd" #@ actionSetupAndroid = "android-actions/setup-android@7c5672355aaa8fde5f97a91aa9a99616d1ace6bc" #@ actionSetupJDK = "actions/setup-java@0ab4596768b603586c0de567f2430c30f5b0d2b0" diff --git a/.github/workflows/prepare-release.yml b/.github/workflows/prepare-release.yml index d360ed472a..67ebe19cfa 100644 --- a/.github/workflows/prepare-release.yml +++ b/.github/workflows/prepare-release.yml @@ -31,7 +31,7 @@ jobs: include: Realm/Realm.Weaver/Analytics/Analytics.cs - name: Update Changelog id: update-changelog - uses: realm/ci-actions/update-changelog@fa20eb972b9f018654fdb4e2c7afb52b0532f907 + uses: realm/ci-actions/update-changelog@6418e15ed9bbdb19b7d456a347e5623779f95cdf with: changelog: ${{ github.workspace }}/CHANGELOG.md version: ${{ inputs.version }} diff --git a/.github/workflows/publish-release.yml b/.github/workflows/publish-release.yml index 12cbd47de4..cda9bc4d06 100755 --- a/.github/workflows/publish-release.yml +++ b/.github/workflows/publish-release.yml @@ -106,7 +106,7 @@ jobs: number: ${{ steps.vnext-pr.outputs.pull-request-number }} method: squash - name: 'Post to #realm-releases' - uses: realm/ci-actions/release-to-slack@fa20eb972b9f018654fdb4e2c7afb52b0532f907 + uses: realm/ci-actions/release-to-slack@6418e15ed9bbdb19b7d456a347e5623779f95cdf with: changelog: Realm/packages/ExtractedChangelog/ExtractedChangelog.md sdk: .NET diff --git a/.github/workflows/test-ios.yml b/.github/workflows/test-ios.yml index 9c2fae18f8..27d7783b00 100755 --- a/.github/workflows/test-ios.yml +++ b/.github/workflows/test-ios.yml @@ -48,7 +48,7 @@ jobs: - name: Build Tests/Tests.iOS run: msbuild Tests/Tests.iOS -p:Configuration=Release -restore -p:RestoreConfigFile=Tests/Test.NuGet.Config -p:UseRealmNupkgsWithVersion=${{ inputs.version }} -p:Platform=iPhoneSimulator - name: Run the tests - uses: realm/ci-actions/run-ios-simulator@cd3efc67e2583fc5257d6a94edf29f7ccfbb9897 + uses: realm/ci-actions/run-ios-simulator@6418e15ed9bbdb19b7d456a347e5623779f95cdf with: appPath: Tests/Tests.iOS/bin/iPhoneSimulator/Release/Tests.iOS.app bundleId: io.realm.dotnettests @@ -102,7 +102,7 @@ jobs: - name: Build the tests run: dotnet build Tests/Tests.Maui -c Release -f net8.0-ios -p:RestoreConfigFile=Tests/Test.NuGet.Config -p:UseRealmNupkgsWithVersion=${{ inputs.version }} - name: Run the tests - uses: realm/ci-actions/run-ios-simulator@cd3efc67e2583fc5257d6a94edf29f7ccfbb9897 + uses: realm/ci-actions/run-ios-simulator@6418e15ed9bbdb19b7d456a347e5623779f95cdf with: appPath: Tests/Tests.Maui/bin/Release/net8.0-ios/iossimulator-x64/Tests.Maui.app bundleId: io.realm.mauitests diff --git a/.github/workflows/test-tvos.yml b/.github/workflows/test-tvos.yml index 09dfb69c70..e2176c1efa 100755 --- a/.github/workflows/test-tvos.yml +++ b/.github/workflows/test-tvos.yml @@ -42,7 +42,7 @@ jobs: - name: Build Tests/Tests.XamarinTVOS run: msbuild Tests/Tests.XamarinTVOS -p:Configuration=Release -restore -p:RestoreConfigFile=Tests/Test.NuGet.Config -p:UseRealmNupkgsWithVersion=${{ inputs.version }} -p:Platform=iPhoneSimulator - name: Run the tests - uses: realm/ci-actions/run-ios-simulator@cd3efc67e2583fc5257d6a94edf29f7ccfbb9897 + uses: realm/ci-actions/run-ios-simulator@6418e15ed9bbdb19b7d456a347e5623779f95cdf with: appPath: Tests/Tests.XamarinTVOS/bin/iPhoneSimulator/Release/Tests.XamarinTVOS.app bundleId: io.realm.Tests-XamarinTVOS diff --git a/.github/workflows/wipe-clusters.yml b/.github/workflows/wipe-clusters.yml index 5a87e46fc9..7393299d67 100644 --- a/.github/workflows/wipe-clusters.yml +++ b/.github/workflows/wipe-clusters.yml @@ -7,7 +7,7 @@ jobs: runs-on: ubuntu-latest name: Wipe all clusters and apps steps: - - uses: realm/ci-actions/mdb-realm/deleteAllClusters@fa20eb972b9f018654fdb4e2c7afb52b0532f907 + - uses: realm/ci-actions/mdb-realm/deleteAllClusters@6418e15ed9bbdb19b7d456a347e5623779f95cdf with: realmUrl: https://realm-qa.mongodb.com atlasUrl: https://cloud-qa.mongodb.com