From fd30430102adf8cbf1e13de0f64c265fdd106e41 Mon Sep 17 00:00:00 2001 From: Yavor Georgiev Date: Thu, 1 Sep 2022 18:03:39 +0200 Subject: [PATCH 1/5] Maui Windows on CI --- .github/templates/main.yml | 4 +- .github/templates/pr.yml | 2 +- .github/templates/test-net-core.yml | 2 +- .github/templates/test-uwp-managed.yml | 27 ---- .github/templates/test-windows.yml | 58 ++++++++ .github/templates/test.lib.yml | 9 +- .github/workflows/main.yml | 6 +- .github/workflows/pr.yml | 8 +- .github/workflows/test-net-core.yml | 2 +- .github/workflows/test-unity.yml | 1 + .github/workflows/test-uwp-managed.yml | 77 ---------- .github/workflows/test-windows.yml | 136 ++++++++++++++++++ Tests/Tests.Maui/MainPage.xaml.cs | 54 ++++--- .../Tests.Maui/Platforms/Windows/App.xaml.cs | 9 +- .../Platforms/Windows/Package.appxmanifest | 18 ++- Tests/Tests.Maui/Tests.Maui.csproj | 12 +- 16 files changed, 273 insertions(+), 152 deletions(-) delete mode 100644 .github/templates/test-uwp-managed.yml create mode 100644 .github/templates/test-windows.yml delete mode 100755 .github/workflows/test-uwp-managed.yml create mode 100755 .github/workflows/test-windows.yml diff --git a/.github/templates/main.yml b/.github/templates/main.yml index de0654273c..5fd79db54f 100644 --- a/.github/templates/main.yml +++ b/.github/templates/main.yml @@ -53,7 +53,7 @@ jobs: - #@ template.replace(uploadPackagesToSleet("needs.build-packages.outputs.package_version", True)) _: #@ template.replace(buildUnity()) _: #@ template.replace(runTests(".NET Framework")) - _: #@ template.replace(runTests("UWP Managed", additionalSecrets = ["Pfx_Password", "Base64_Encoded_Pfx"])) + _: #@ template.replace(runTests("Windows", additionalSecrets = ["Pfx_Password", "Base64_Encoded_Pfx"])) _: #@ template.replace(runNetCoreTests("[\"netcoreapp3.1\", \"net6.0\"]")) _: #@ template.replace(runTests("macOS")) _: #@ template.replace(runTests("iOS")) @@ -87,7 +87,7 @@ jobs: - #@ template.replace(checkoutCode()) - #@ template.replace(fetchPackageArtifacts()) - #@ setupDotnet() - - #@ template.replace(dotnetBuildTests("Tests/Benchmarks/PerformanceTests", "net6.0", "linux-x64", "needs.build-packages.outputs.package_version")) + - #@ template.replace(dotnetBuildTests("Tests/Benchmarks/PerformanceTests", "net6.0", "linux-x64", "needs.build-packages.outputs.package_version", RealmTestsStandaloneExe="true")) - name: Run the tests run: #@ "${{ steps.dotnet-publish.outputs.executable-path }}/PerformanceTests -f \"*\" --join" - name: Find Results file diff --git a/.github/templates/pr.yml b/.github/templates/pr.yml index 59875f90f7..ea1137e3c9 100644 --- a/.github/templates/pr.yml +++ b/.github/templates/pr.yml @@ -35,7 +35,7 @@ jobs: _: #@ template.replace(buildUnity()) _: #@ 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(runTests("Windows", runSyncTests = False)) _: #@ template.replace(runNetCoreTests('["net6.0"]')) _: #@ template.replace(runTests("macOS", runSyncTests = False)) _: #@ template.replace(runTests("iOS", runSyncTests = False)) diff --git a/.github/templates/test-net-core.yml b/.github/templates/test-net-core.yml index 6743ddba4d..bfb3ef915e 100644 --- a/.github/templates/test-net-core.yml +++ b/.github/templates/test-net-core.yml @@ -34,7 +34,7 @@ jobs: run: git clean -fdx - #@ setupDotnet(ifCondition = "matrix.framework == 'net6.0' && matrix.os.runner != 'macos-arm'") - #@ template.replace(fetchPackageArtifacts()) - - #@ template.replace(dotnetBuildTests("Tests/Realm.Tests", "${{ matrix.framework }}", "${{ matrix.os.runtime }}")) + - #@ template.replace(dotnetBuildTests("Tests/Realm.Tests", "${{ matrix.framework }}", "${{ matrix.os.runtime }}", RealmTestsStandaloneExe="true")) - name: Run the tests run: #@ "${{ steps.dotnet-publish.outputs.executable-path }}/Realm.Tests --result=TestResults.xml --labels=After" + baasTestArgs("net-core-${{ matrix.runner }}-${{ matrix.runtime }}") - #@ publishTestsResults("TestResults.xml", ".NET (${{ matrix.os.runner }}, ${{ matrix.framework }})") diff --git a/.github/templates/test-uwp-managed.yml b/.github/templates/test-uwp-managed.yml deleted file mode 100644 index b8a6c7bbf1..0000000000 --- a/.github/templates/test-uwp-managed.yml +++ /dev/null @@ -1,27 +0,0 @@ -#@ load("@ytt:template", "template") -#@ load("common.lib.yml", "checkoutCode") -#@ load("test.lib.yml", "fetchPackageArtifacts", "baasTestArgs", "publishTestsResults", "testDefinition", "buildTests") - ---- -name: test-uwp-managed -_: #@ template.replace(testDefinition(["Base64_Encoded_Pfx", "Pfx_Password"])) -jobs: - run-tests: - runs-on: windows-2019 - name: UWP - timeout-minutes: 45 - steps: - - #@ template.replace(checkoutCode()) - - #@ template.replace(fetchPackageArtifacts()) - - name: Import test certificate - run: | - $pfx_cert_byte = [System.Convert]::FromBase64String("${{ secrets.Base64_Encoded_Pfx }}") - $currentDirectory = Get-Location - [IO.File]::WriteAllBytes("${{ github.workspace }}\Tests\Tests.UWP\Tests.UWP_TemporaryKey.pfx", $pfx_cert_byte) - certutil -f -p "${{ secrets.Pfx_Password }}" -importpfx my ${{ github.workspace }}\Tests\Tests.UWP\Tests.UWP_TemporaryKey.pfx - shell: powershell - - #@ template.replace(buildTests("Tests/Tests.UWP", AppxBundle="Always", PackageCertificateKeyFile="${{ github.workspace }}\Tests\Tests.UWP\Tests.UWP_TemporaryKey.pfx", PackageCertificatePassword='"${{ secrets.Pfx_Password }}"', UseDotNetNativeToolchain="false", AppxBundlePlatforms="x64")) - - name: Run the tests - run: #@ "./Tests/Tests.UWP/RunTests.ps1 -ExtraAppArgs '" + baasTestArgs("uwp-managed") + "'" - shell: powershell - - #@ publishTestsResults("${{ env.TEST_RESULTS }}", "UWP Managed") diff --git a/.github/templates/test-windows.yml b/.github/templates/test-windows.yml new file mode 100644 index 0000000000..6122fa86c2 --- /dev/null +++ b/.github/templates/test-windows.yml @@ -0,0 +1,58 @@ +#@ load("@ytt:template", "template") +#@ load("common.lib.yml", "checkoutCode", "setupDotnet") +#@ load("test.lib.yml", "fetchPackageArtifacts", "baasTestArgs", "publishTestsResults", "testDefinition", "buildTests", "dotnetBuildTests") + +#@ def importPfx(id): +name: Import test certificate +id: #@ id +#@yaml/text-templated-strings +run: | + $cert = New-SelfSignedCertificate -Type Custom -Subject "CN=RealmTests" -KeyUsage DigitalSignature -CertStoreLocation "Cert:\CurrentUser\My" -TextExtension @("2.5.29.37={text}1.3.6.1.5.5.7.3.3", "2.5.29.19={text}") + echo "::set-output name=thumbprint::$($cert.Thumbprint)" +shell: powershell +#@ end + +--- +name: test-windows +_: #@ template.replace(testDefinition()) +jobs: + test-uwp: + runs-on: windows-2019 + name: UWP + timeout-minutes: 45 + steps: + - #@ template.replace(checkoutCode()) + - #@ template.replace(fetchPackageArtifacts()) + - #@ importPfx("import-pfx") + - #@ template.replace(buildTests("Tests/Tests.UWP", AppxBundle="Always", PackageCertificateThumbprint="${{ steps.import-pfx.outputs.thumbprint }}", UseDotNetNativeToolchain="false", AppxBundlePlatforms="x64")) + - name: Run the tests + run: #@ "./Tests/Tests.UWP/RunTests.ps1 -ExtraAppArgs '" + baasTestArgs("uwp-managed") + "'" + shell: powershell + - #@ publishTestsResults("${{ env.TEST_RESULTS }}", "UWP Managed") + test-maui: + runs-on: windows-2019 + name: Maui.Windows + timeout-minutes: 45 + steps: + - #@ template.replace(checkoutCode()) + - #@ template.replace(fetchPackageArtifacts()) + - #@ setupDotnet() + - run: dotnet workload install maui + - #@ importPfx("import-pfx") + - #@ template.replace(dotnetBuildTests("Tests/Tests.Maui", "net6.0-windows10.0.19041", "win10-x64", GenerateAppxPackageOnBuild="true", PackageCertificateThumbprint="${{ steps.import-pfx.outputs.thumbprint }}", AppxPackageTestDir="Output/")) + - name: Run the tests + #@yaml/text-templated-strings + run: | + .\Tests\Tests.Maui\Output\Install.ps1 -Force + # Tests.Maui --headless --labels=After --result=TestResults.Windows.xml (@= baasTestArgs('Maui.Windows') @) + + $package = Get-AppxPackage -Name realm.maui.tests + Start-Process "shell:AppsFolder\$($package.PackageFamilyName)!App" -ArgumentList "--headless --labels=After --result=$(pwd)\TestResults.Windows.xml --output=$(pwd)\test.log (@= baasTestArgs('Maui.Windows') @)" + Start-Sleep 5 + echo "Waiting for tests to finish" + $(Get-Process Tests.Maui).WaitForExit(90000) + Get-Content args.txt + Get-Content test.log + shell: powershell + - #@ publishTestsResults("TestResults.Windows.xml", "Maui.Windows") + diff --git a/.github/templates/test.lib.yml b/.github/templates/test.lib.yml index 32e977a606..dc9540b38a 100644 --- a/.github/templates/test.lib.yml +++ b/.github/templates/test.lib.yml @@ -67,11 +67,10 @@ env: #@ return msbuild(projectPath, RestoreConfigFile="Tests/Test.NuGet.Config", UseRealmNupkgsWithVersion="${{ inputs.version }}", **properties) #@ end -#@ def dotnetBuildTests(projectPath, framework, runtime, version = "inputs.version"): -#@ properties = { +#@ def dotnetBuildTests(projectPath, framework, runtime, version = "inputs.version", **properties): +#@ properties.update({ #@ "RestoreConfigFile": "Tests/Test.NuGet.Config", -#@ "UseRealmNupkgsWithVersion": "${{ " + version + " }}", -#@ "RealmTestsStandaloneExe": "true" -#@ } +#@ "UseRealmNupkgsWithVersion": "${{ " + version + " }}" +#@ }) #@ return dotnetPublish(projectPath, framework, runtime, properties) #@ end \ No newline at end of file diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 8343822e8b..91833603e5 100755 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -96,8 +96,8 @@ jobs: BaseUrl: ${{ secrets.REALM_QA_BASE_URL }} AtlasPublicKey: ${{ secrets.ATLAS_QA_PUBLIC_API_KEY }} AtlasPrivateKey: ${{ secrets.ATLAS_QA_PRIVATE_API_KEY }} - test-uwp-managed: - uses: ./.github/workflows/test-uwp-managed.yml + test-windows: + uses: ./.github/workflows/test-windows.yml name: Test if: always() && !cancelled() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') needs: @@ -260,7 +260,7 @@ jobs: with: dotnet-version: 6.0.x - name: Publish Tests/Benchmarks/PerformanceTests - run: dotnet publish Tests/Benchmarks/PerformanceTests -c Release -f net6.0 -r linux-x64 -p:RestoreConfigFile=Tests/Test.NuGet.Config -p:UseRealmNupkgsWithVersion=${{ needs.build-packages.outputs.package_version }} -p:RealmTestsStandaloneExe=true --no-self-contained + run: dotnet publish Tests/Benchmarks/PerformanceTests -c Release -f net6.0 -r linux-x64 -p:RealmTestsStandaloneExe=true -p:RestoreConfigFile=Tests/Test.NuGet.Config -p:UseRealmNupkgsWithVersion=${{ needs.build-packages.outputs.package_version }} --no-self-contained - name: Output executable path id: dotnet-publish run: echo '::set-output name=executable-path::./Tests/Benchmarks/PerformanceTests/bin/Release/net6.0/linux-x64' diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 52b5753819..99101ad966 100755 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -67,8 +67,8 @@ jobs: version: ${{ needs.build-packages.outputs.package_version }} clusterName: ${{ needs.deploy-cluster.outputs.clusterName }} secrets: {} - test-uwp-managed: - uses: ./.github/workflows/test-uwp-managed.yml + test-windows: + uses: ./.github/workflows/test-windows.yml name: Test if: always() && !cancelled() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') needs: @@ -76,9 +76,7 @@ jobs: with: version: ${{ needs.build-packages.outputs.package_version }} clusterName: ${{ needs.deploy-cluster.outputs.clusterName }} - secrets: - Pfx_Password: ${{ secrets.Pfx_Password }} - Base64_Encoded_Pfx: ${{ secrets.Base64_Encoded_Pfx }} + secrets: {} test-net-core: if: always() && !cancelled() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') name: Test diff --git a/.github/workflows/test-net-core.yml b/.github/workflows/test-net-core.yml index f99514bc02..0cfec2826d 100755 --- a/.github/workflows/test-net-core.yml +++ b/.github/workflows/test-net-core.yml @@ -74,7 +74,7 @@ jobs: name: Realm.Fody.${{ inputs.version }} path: ${{ github.workspace }}/Realm/packages/ - 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 + run: dotnet publish Tests/Realm.Tests -c Release -f ${{ matrix.framework }} -r ${{ matrix.os.runtime }} -p:RealmTestsStandaloneExe=true -p:RestoreConfigFile=Tests/Test.NuGet.Config -p:UseRealmNupkgsWithVersion=${{ inputs.version }} --no-self-contained - name: Output executable path id: dotnet-publish run: echo '::set-output name=executable-path::./Tests/Realm.Tests/bin/Release/${{ matrix.framework }}/${{ matrix.os.runtime }}' diff --git a/.github/workflows/test-unity.yml b/.github/workflows/test-unity.yml index f2ca7899de..d3c06f5793 100755 --- a/.github/workflows/test-unity.yml +++ b/.github/workflows/test-unity.yml @@ -57,6 +57,7 @@ jobs: name: UnityTestsRunner.${{ matrix.platform.os }} path: ${{ github.workspace }}/Tests/Tests.Unity/Player_Standalone${{ matrix.platform.testPlatform }}_${{ matrix.settings }}/ retention-days: ${{ github.event_name != 'pull_request' && 30 || 1 }} + if-no-files-found: error run-tests-linux: runs-on: ubuntu-latest name: Unity Linux diff --git a/.github/workflows/test-uwp-managed.yml b/.github/workflows/test-uwp-managed.yml deleted file mode 100755 index 64c56c3488..0000000000 --- a/.github/workflows/test-uwp-managed.yml +++ /dev/null @@ -1,77 +0,0 @@ -name: test-uwp-managed -"on": - workflow_call: - inputs: - version: - required: true - type: string - clusterName: - required: false - type: string - secrets: - AtlasProjectId: - required: false - BaseUrl: - required: false - AtlasPublicKey: - required: false - AtlasPrivateKey: - required: false - Base64_Encoded_Pfx: - required: true - Pfx_Password: - required: true -env: - REALM_DISABLE_ANALYTICS: true - DOTNET_NOLOGO: true -jobs: - run-tests: - runs-on: windows-2019 - name: UWP - timeout-minutes: 45 - steps: - - name: Checkout code - uses: actions/checkout@v2 - with: - submodules: false - ref: ${{ github.event.pull_request.head.sha }} - - name: Register csc problem matcher - run: echo "::add-matcher::.github/problem-matchers/csc.json" - - name: Register msvc problem matcher - run: echo "::add-matcher::.github/problem-matchers/msvc.json" - - name: Fetch Realm - uses: actions/download-artifact@v2 - with: - name: Realm.${{ inputs.version }} - path: ${{ github.workspace }}/Realm/packages/ - - name: Fetch Realm.Fody - uses: actions/download-artifact@v2 - with: - name: Realm.Fody.${{ inputs.version }} - path: ${{ github.workspace }}/Realm/packages/ - - name: Import test certificate - run: | - $pfx_cert_byte = [System.Convert]::FromBase64String("${{ secrets.Base64_Encoded_Pfx }}") - $currentDirectory = Get-Location - [IO.File]::WriteAllBytes("${{ github.workspace }}\Tests\Tests.UWP\Tests.UWP_TemporaryKey.pfx", $pfx_cert_byte) - certutil -f -p "${{ secrets.Pfx_Password }}" -importpfx my ${{ github.workspace }}\Tests\Tests.UWP\Tests.UWP_TemporaryKey.pfx - shell: powershell - - name: Add msbuild to PATH - uses: microsoft/setup-msbuild@v1.0.2 - if: ${{ runner.os == 'Windows' }} - - name: Build Tests/Tests.UWP - run: msbuild Tests/Tests.UWP -p:Configuration=Release -restore -p:RestoreConfigFile=Tests/Test.NuGet.Config -p:UseRealmNupkgsWithVersion=${{ inputs.version }} -p:AppxBundle=Always -p:PackageCertificateKeyFile=${{ github.workspace }}\Tests\Tests.UWP\Tests.UWP_TemporaryKey.pfx -p:PackageCertificatePassword="${{ secrets.Pfx_Password }}" -p:UseDotNetNativeToolchain=false -p:AppxBundlePlatforms=x64 - - name: Run the tests - run: ./Tests/Tests.UWP/RunTests.ps1 -ExtraAppArgs ' --baasurl=${{ secrets.BaseUrl }} --baascluster=${{ inputs.clusterName }} --baasapikey=${{ secrets.AtlasPublicKey}} --baasprivateapikey=${{ secrets.AtlasPrivateKey}} --baasprojectid=${{ secrets.AtlasProjectId }} --baasdifferentiator=uwp-managed' - shell: powershell - - name: Publish Unit Test Results - uses: LaPeste/test-reporter@b8a650f4490e7472b930f56bbb92c7b42dc5db15 - if: always() - with: - name: Results UWP Managed - path: ${{ env.TEST_RESULTS }} - reporter: java-junit - list-suites: failed - list-tests: failed - path-replace-backslashes: true - fail-on-error: false diff --git a/.github/workflows/test-windows.yml b/.github/workflows/test-windows.yml new file mode 100755 index 0000000000..1c76ce00f8 --- /dev/null +++ b/.github/workflows/test-windows.yml @@ -0,0 +1,136 @@ +name: test-windows +"on": + workflow_call: + inputs: + version: + required: true + type: string + clusterName: + required: false + type: string + secrets: + AtlasProjectId: + required: false + BaseUrl: + required: false + AtlasPublicKey: + required: false + AtlasPrivateKey: + required: false +env: + REALM_DISABLE_ANALYTICS: true + DOTNET_NOLOGO: true +jobs: + test-uwp: + runs-on: windows-2019 + name: UWP + timeout-minutes: 45 + steps: + - name: Checkout code + uses: actions/checkout@v2 + with: + submodules: false + ref: ${{ github.event.pull_request.head.sha }} + - name: Register csc problem matcher + run: echo "::add-matcher::.github/problem-matchers/csc.json" + - name: Register msvc problem matcher + run: echo "::add-matcher::.github/problem-matchers/msvc.json" + - name: Fetch Realm + uses: actions/download-artifact@v2 + with: + name: Realm.${{ inputs.version }} + path: ${{ github.workspace }}/Realm/packages/ + - name: Fetch Realm.Fody + uses: actions/download-artifact@v2 + with: + name: Realm.Fody.${{ inputs.version }} + path: ${{ github.workspace }}/Realm/packages/ + - name: Import test certificate + id: import-pfx + run: | + $cert = New-SelfSignedCertificate -Type Custom -Subject "CN=RealmTests" -KeyUsage DigitalSignature -CertStoreLocation "Cert:\CurrentUser\My" -TextExtension @("2.5.29.37={text}1.3.6.1.5.5.7.3.3", "2.5.29.19={text}") + echo "::set-output name=thumbprint::$($cert.Thumbprint)" + shell: powershell + - name: Add msbuild to PATH + uses: microsoft/setup-msbuild@v1.0.2 + if: ${{ runner.os == 'Windows' }} + - name: Build Tests/Tests.UWP + run: msbuild Tests/Tests.UWP -p:Configuration=Release -restore -p:RestoreConfigFile=Tests/Test.NuGet.Config -p:UseRealmNupkgsWithVersion=${{ inputs.version }} -p:AppxBundle=Always -p:PackageCertificateThumbprint=${{ steps.import-pfx.outputs.thumbprint }} -p:UseDotNetNativeToolchain=false -p:AppxBundlePlatforms=x64 + - name: Run the tests + run: ./Tests/Tests.UWP/RunTests.ps1 -ExtraAppArgs ' --baasurl=${{ secrets.BaseUrl }} --baascluster=${{ inputs.clusterName }} --baasapikey=${{ secrets.AtlasPublicKey}} --baasprivateapikey=${{ secrets.AtlasPrivateKey}} --baasprojectid=${{ secrets.AtlasProjectId }} --baasdifferentiator=uwp-managed' + shell: powershell + - name: Publish Unit Test Results + uses: LaPeste/test-reporter@b8a650f4490e7472b930f56bbb92c7b42dc5db15 + if: always() + with: + name: Results UWP Managed + path: ${{ env.TEST_RESULTS }} + reporter: java-junit + list-suites: failed + list-tests: failed + path-replace-backslashes: true + fail-on-error: false + test-maui: + runs-on: windows-2019 + name: Maui.Windows + timeout-minutes: 45 + steps: + - name: Checkout code + uses: actions/checkout@v2 + with: + submodules: false + ref: ${{ github.event.pull_request.head.sha }} + - name: Register csc problem matcher + run: echo "::add-matcher::.github/problem-matchers/csc.json" + - name: Register msvc problem matcher + run: echo "::add-matcher::.github/problem-matchers/msvc.json" + - name: Fetch Realm + uses: actions/download-artifact@v2 + with: + name: Realm.${{ inputs.version }} + path: ${{ github.workspace }}/Realm/packages/ + - name: Fetch Realm.Fody + uses: actions/download-artifact@v2 + with: + name: Realm.Fody.${{ inputs.version }} + path: ${{ github.workspace }}/Realm/packages/ + - name: Configure .NET + uses: actions/setup-dotnet@v1 + with: + dotnet-version: 6.0.x + - run: dotnet workload install maui + - name: Import test certificate + id: import-pfx + run: | + $cert = New-SelfSignedCertificate -Type Custom -Subject "CN=RealmTests" -KeyUsage DigitalSignature -CertStoreLocation "Cert:\CurrentUser\My" -TextExtension @("2.5.29.37={text}1.3.6.1.5.5.7.3.3", "2.5.29.19={text}") + echo "::set-output name=thumbprint::$($cert.Thumbprint)" + shell: powershell + - name: Publish Tests/Tests.Maui + run: dotnet publish Tests/Tests.Maui -c Release -f net6.0-windows10.0.19041 -r win10-x64 -p:GenerateAppxPackageOnBuild=true -p:PackageCertificateThumbprint=${{ steps.import-pfx.outputs.thumbprint }} -p:AppxPackageTestDir=Output/ -p:RestoreConfigFile=Tests/Test.NuGet.Config -p:UseRealmNupkgsWithVersion=${{ inputs.version }} --no-self-contained + - name: Output executable path + id: dotnet-publish + run: echo '::set-output name=executable-path::./Tests/Tests.Maui/bin/Release/net6.0-windows10.0.19041/win10-x64' + - name: Run the tests + run: | + .\Tests\Tests.Maui\Output\Install.ps1 -Force + # Tests.Maui --headless --labels=After --result=TestResults.Windows.xml --baasurl=${{ secrets.BaseUrl }} --baascluster=${{ inputs.clusterName }} --baasapikey=${{ secrets.AtlasPublicKey}} --baasprivateapikey=${{ secrets.AtlasPrivateKey}} --baasprojectid=${{ secrets.AtlasProjectId }} --baasdifferentiator=Maui.Windows + + $package = Get-AppxPackage -Name realm.maui.tests + Start-Process "shell:AppsFolder\$($package.PackageFamilyName)!App" -ArgumentList "--headless --labels=After --result=$(pwd)\TestResults.Windows.xml --output=$(pwd)\test.log --baasurl=${{ secrets.BaseUrl }} --baascluster=${{ inputs.clusterName }} --baasapikey=${{ secrets.AtlasPublicKey}} --baasprivateapikey=${{ secrets.AtlasPrivateKey}} --baasprojectid=${{ secrets.AtlasProjectId }} --baasdifferentiator=Maui.Windows" + Start-Sleep 5 + echo "Waiting for tests to finish" + $(Get-Process Tests.Maui).WaitForExit(90000) + Get-Content args.txt + Get-Content test.log + shell: powershell + - name: Publish Unit Test Results + uses: LaPeste/test-reporter@b8a650f4490e7472b930f56bbb92c7b42dc5db15 + if: always() + with: + name: Results Maui.Windows + path: TestResults.Windows.xml + reporter: java-junit + list-suites: failed + list-tests: failed + path-replace-backslashes: true + fail-on-error: false diff --git a/Tests/Tests.Maui/MainPage.xaml.cs b/Tests/Tests.Maui/MainPage.xaml.cs index 5776457dd2..b09162eb2e 100644 --- a/Tests/Tests.Maui/MainPage.xaml.cs +++ b/Tests/Tests.Maui/MainPage.xaml.cs @@ -69,31 +69,43 @@ private async Task RunTests() var autorun = new AutoRun(typeof(TestHelpers).Assembly); var arguments = Realms.Tests.Sync.SyncTestHelpers.ExtractBaasSettings(MauiProgram.Args); - using var reader = new StringReader(string.Empty); - using var writer = new DebugWriter((msg, style, newLine) => + int failed = default; + + var nunitArgs = arguments.Except(new[] { "--headless" }).ToArray(); +#if !__IOS__ && !__ANDROID__ + if (nunitArgs.Length != arguments.Length) // arguments contained --headless + { + failed = autorun.Execute(nunitArgs); + } + else +#endif { - Dispatcher.Dispatch(() => + using var reader = new StringReader(string.Empty); + using var writer = new DebugWriter((msg, style, newLine) => { - var span = GetSpan(msg, style); - var label = LogsStack.Children.LastOrDefault() as Label; - if (label == null) + Dispatcher.Dispatch(() => { - label = new Label { FormattedText = new FormattedString() }; - LogsStack.Children.Add(label); - } - label.FormattedText.Spans.Add(span); - if (newLine) - { - LogsStack.Children.Add(new Label { FormattedText = new FormattedString() }); - } - - if (ScrollLogsToggle.IsToggled) - { - _ = LogsScrollView.ScrollToAsync(0, 999999, false); - } + var span = GetSpan(msg, style); + var label = LogsStack.Children.LastOrDefault() as Label; + if (label == null) + { + label = new Label { FormattedText = new FormattedString() }; + LogsStack.Children.Add(label); + } + label.FormattedText.Spans.Add(span); + if (newLine) + { + LogsStack.Children.Add(new Label { FormattedText = new FormattedString() }); + } + + if (ScrollLogsToggle.IsToggled) + { + _ = LogsScrollView.ScrollToAsync(0, 999999, false); + } + }); }); - }); - var failed = autorun.Execute(arguments.Where(a => a != "--headless").ToArray(), writer, reader); + failed = autorun.Execute(nunitArgs, writer, reader); + } var resultPath = TestHelpers.GetResultsPath(MauiProgram.Args); if (!string.IsNullOrEmpty(resultPath)) diff --git a/Tests/Tests.Maui/Platforms/Windows/App.xaml.cs b/Tests/Tests.Maui/Platforms/Windows/App.xaml.cs index 35679364bd..dc9f2b3e1e 100644 --- a/Tests/Tests.Maui/Platforms/Windows/App.xaml.cs +++ b/Tests/Tests.Maui/Platforms/Windows/App.xaml.cs @@ -16,6 +16,8 @@ // //////////////////////////////////////////////////////////////////////////// +using System; +using System.IO; using Microsoft.UI.Xaml; namespace Tests.Maui.WinUI; @@ -29,12 +31,17 @@ public App() protected override void OnLaunched(LaunchActivatedEventArgs args) { + File.AppendAllText(@"D:\a\realm-dotnet\realm-dotnet\args.txt", args.Arguments); + base.OnLaunched(args); + + // Try to attach to a parent process's console, for logging + PInvoke.Kernel32.AttachConsole(-1); } protected override MauiApp CreateMauiApp() { - var args = Environment.GetCommandLineArgs(); + var args = Environment.GetCommandLineArgs().Skip(1).ToArray(); return MauiProgram.CreateMauiApp(args); } diff --git a/Tests/Tests.Maui/Platforms/Windows/Package.appxmanifest b/Tests/Tests.Maui/Platforms/Windows/Package.appxmanifest index 0cb469c4dc..9cf6121503 100644 --- a/Tests/Tests.Maui/Platforms/Windows/Package.appxmanifest +++ b/Tests/Tests.Maui/Platforms/Windows/Package.appxmanifest @@ -2,13 +2,19 @@ - + - User Name + Tests.Maui + Realm @@ -23,6 +29,14 @@ + + + + + + + diff --git a/Tests/Tests.Maui/Tests.Maui.csproj b/Tests/Tests.Maui/Tests.Maui.csproj index 31824b4aca..661685070e 100644 --- a/Tests/Tests.Maui/Tests.Maui.csproj +++ b/Tests/Tests.Maui/Tests.Maui.csproj @@ -2,7 +2,7 @@ net6.0-android;net6.0-ios;net6.0-maccatalyst - $(TargetFrameworks);net6.0-windows10.0.19041 + $(TargetFrameworks);net6.0-windows10.0.19041 Exe Tests.Maui true @@ -31,8 +31,13 @@ 10.0.17763.0 + + True + + + @@ -100,9 +105,4 @@ - - WinExe - win10-x64 - - From c64ce8e14d8c7b9780b8f0daa6db5a64005f1089 Mon Sep 17 00:00:00 2001 From: Nikola Irinchev Date: Wed, 21 Jun 2023 02:08:33 +0200 Subject: [PATCH 2/5] merge fixes --- .github/templates/test.lib.yml | 3 ++- .github/workflows/main.yml | 2 +- .github/workflows/test-net-core.yml | 2 +- .github/workflows/test-windows.yml | 2 +- wrappers/realm-core | 2 +- 5 files changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/templates/test.lib.yml b/.github/templates/test.lib.yml index 6c5d08016e..7af87ed223 100644 --- a/.github/templates/test.lib.yml +++ b/.github/templates/test.lib.yml @@ -65,7 +65,8 @@ env: #@ def dotnetBuildTests(projectPath, framework, runtime, version = "inputs.version", **properties): #@ properties.update({ #@ "RestoreConfigFile": "Tests/Test.NuGet.Config", -#@ "UseRealmNupkgsWithVersion": "${{ " + version + " }}" +#@ "UseRealmNupkgsWithVersion": "${{ " + version + " }}", +#@ "RealmTestsStandaloneExe": "true" #@ }) #@ return dotnetPublish(projectPath, framework, runtime, properties) #@ end diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index e6074db39b..86ee19b44d 100755 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -268,7 +268,7 @@ jobs: name: Realm.${{ needs.build-packages.outputs.package_version }} path: ${{ github.workspace }}/Realm/packages/ - name: Publish Tests/Benchmarks/PerformanceTests - run: dotnet publish Tests/Benchmarks/PerformanceTests -c Release -f net6.0 -r linux-x64 -p:RestoreConfigFile=Tests/Test.NuGet.Config -p:UseRealmNupkgsWithVersion=${{ needs.build-packages.outputs.package_version }} --no-self-contained + run: dotnet publish Tests/Benchmarks/PerformanceTests -c Release -f net6.0 -r linux-x64 -p:RestoreConfigFile=Tests/Test.NuGet.Config -p:UseRealmNupkgsWithVersion=${{ needs.build-packages.outputs.package_version }} -p:RealmTestsStandaloneExe=true --no-self-contained - name: Output executable path id: dotnet-publish run: echo 'executable-path=./Tests/Benchmarks/PerformanceTests/bin/Release/net6.0/linux-x64' >> $GITHUB_OUTPUT diff --git a/.github/workflows/test-net-core.yml b/.github/workflows/test-net-core.yml index 50a8f34fbc..7c8e704b7d 100755 --- a/.github/workflows/test-net-core.yml +++ b/.github/workflows/test-net-core.yml @@ -84,7 +84,7 @@ jobs: privateApiKey: ${{ secrets.AtlasPrivateKey }} clusterSize: M10 - 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 }} --no-self-contained + 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 id: dotnet-publish run: echo 'executable-path=./Tests/Realm.Tests/bin/Release/${{ matrix.framework }}/${{ matrix.os.runtime }}' >> $GITHUB_OUTPUT diff --git a/.github/workflows/test-windows.yml b/.github/workflows/test-windows.yml index 00f88e987c..d046901d8e 100755 --- a/.github/workflows/test-windows.yml +++ b/.github/workflows/test-windows.yml @@ -129,7 +129,7 @@ jobs: echo "::set-output name=thumbprint::$($cert.Thumbprint)" shell: powershell - name: Publish Tests/Tests.Maui - run: dotnet publish Tests/Tests.Maui -c Release -f net6.0-windows10.0.19041 -r win10-x64 -p:GenerateAppxPackageOnBuild=true -p:PackageCertificateThumbprint=${{ steps.import-pfx.outputs.thumbprint }} -p:AppxPackageTestDir=Output/ -p:RestoreConfigFile=Tests/Test.NuGet.Config -p:UseRealmNupkgsWithVersion=${{ inputs.version }} --no-self-contained + run: dotnet publish Tests/Tests.Maui -c Release -f net6.0-windows10.0.19041 -r win10-x64 -p:GenerateAppxPackageOnBuild=true -p:PackageCertificateThumbprint=${{ steps.import-pfx.outputs.thumbprint }} -p:AppxPackageTestDir=Output/ -p:RestoreConfigFile=Tests/Test.NuGet.Config -p:UseRealmNupkgsWithVersion=${{ inputs.version }} -p:RealmTestsStandaloneExe=true --no-self-contained - name: Output executable path id: dotnet-publish run: echo 'executable-path=./Tests/Tests.Maui/bin/Release/net6.0-windows10.0.19041/win10-x64' >> $GITHUB_OUTPUT diff --git a/wrappers/realm-core b/wrappers/realm-core index 01d4501228..2cfb24b980 160000 --- a/wrappers/realm-core +++ b/wrappers/realm-core @@ -1 +1 @@ -Subproject commit 01d45012287055d565f80d1c697b40a988d2befa +Subproject commit 2cfb24b980345d0518f8a5d8b4fa5a0440e9b3a9 From b014193a5b56ac901cbb22335beb0a45809334ca Mon Sep 17 00:00:00 2001 From: Nikola Irinchev Date: Wed, 21 Jun 2023 02:10:02 +0200 Subject: [PATCH 3/5] remove secrets --- .github/templates/main.yml | 2 +- .github/templates/pr.yml | 2 +- .github/workflows/main.yml | 2 -- .github/workflows/pr.yml | 4 +--- 4 files changed, 3 insertions(+), 7 deletions(-) diff --git a/.github/templates/main.yml b/.github/templates/main.yml index 61c32f3ed9..ab1c7f5f89 100644 --- a/.github/templates/main.yml +++ b/.github/templates/main.yml @@ -44,7 +44,7 @@ jobs: - #@ template.replace(uploadPackagesToSleet("needs.build-packages.outputs.package_version", True)) _: #@ template.replace(buildUnity()) _: #@ template.replace(runTests(".NET Framework")) - _: #@ template.replace(runTests("Windows", additionalSecrets = ["Pfx_Password", "Base64_Encoded_Pfx"])) + _: #@ template.replace(runTests("Windows")) _: #@ template.replace(runNetCoreTests("[\"net6.0\", \"net7.0\"]")) _: #@ template.replace(runTests("macOS")) _: #@ template.replace(runTests("iOS")) diff --git a/.github/templates/pr.yml b/.github/templates/pr.yml index f4199ee695..8551475382 100644 --- a/.github/templates/pr.yml +++ b/.github/templates/pr.yml @@ -42,7 +42,7 @@ jobs: _: #@ template.replace(buildUnity()) _: #@ template.replace(testUnity('["Mono-Net4"]', '[{ "os": "windows", "testPlatform": "Windows64" }, { "os": "linux", "testPlatform": "Linux64" }]')) _: #@ template.replace(runTests(".NET Framework", runSyncTests = False)) - _: #@ template.replace(runTests("Windows", runSyncTests = False, additionalSecrets = ["Pfx_Password", "Base64_Encoded_Pfx"])) + _: #@ template.replace(runTests("Windows", runSyncTests = False)) _: #@ template.replace(runNetCoreTests('["net7.0"]')) _: #@ template.replace(runTests("macOS", runSyncTests = False)) _: #@ template.replace(runTests("iOS", runSyncTests = False)) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 86ee19b44d..10f9ae848d 100755 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -113,8 +113,6 @@ jobs: AtlasProjectId: ${{ secrets.ATLAS_QA_PROJECT_ID }} AtlasPublicKey: ${{ secrets.ATLAS_QA_PUBLIC_API_KEY }} AtlasPrivateKey: ${{ secrets.ATLAS_QA_PRIVATE_API_KEY }} - Pfx_Password: ${{ secrets.Pfx_Password }} - Base64_Encoded_Pfx: ${{ secrets.Base64_Encoded_Pfx }} test-net-core: if: always() && !cancelled() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') name: Test diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index a3b17f54a6..bc1861f288 100755 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -78,9 +78,7 @@ jobs: - build-packages with: version: ${{ needs.build-packages.outputs.package_version }} - secrets: - Pfx_Password: ${{ secrets.Pfx_Password }} - Base64_Encoded_Pfx: ${{ secrets.Base64_Encoded_Pfx }} + secrets: {} test-net-core: if: always() && !cancelled() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') name: Test From 57f5cf641a578d883e280212aa0a92e6af795130 Mon Sep 17 00:00:00 2001 From: Nikola Irinchev Date: Wed, 21 Jun 2023 10:41:45 +0200 Subject: [PATCH 4/5] Try to update to net7 --- .github/templates/test-android.yml | 4 ++-- .github/templates/test-ios.yml | 4 ++-- .github/templates/test-windows.yml | 5 ++--- .github/workflows/test-android.yml | 4 ++-- .github/workflows/test-ios.yml | 4 ++-- .github/workflows/test-windows.yml | 10 +++------- Tests/Tests.Maui/Tests.Maui.csproj | 16 ++++++++-------- 7 files changed, 21 insertions(+), 26 deletions(-) diff --git a/.github/templates/test-android.yml b/.github/templates/test-android.yml index 10d93348b5..9a3f4aa549 100644 --- a/.github/templates/test-android.yml +++ b/.github/templates/test-android.yml @@ -34,13 +34,13 @@ jobs: - #@ template.replace(fetchPackageArtifacts()) - #@ setupWorkloads() - 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 net7.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/net7.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 b06fedfeb5..9c9d8bedf9 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 - #@ 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 net7.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 + "/net7.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-windows.yml b/.github/templates/test-windows.yml index 92d4bca6f3..62eeac8c82 100644 --- a/.github/templates/test-windows.yml +++ b/.github/templates/test-windows.yml @@ -29,15 +29,14 @@ jobs: shell: powershell - #@ publishTestsResults("${{ env.TEST_RESULTS }}", "UWP Managed") test-maui: - runs-on: windows-2019 + runs-on: windows-latest name: Maui.Windows timeout-minutes: 45 steps: - #@ template.replace(prepareTest()) - - #@ setupDotnet() - #@ setupWorkloads() - #@ importPfx("import-pfx") - - #@ template.replace(dotnetBuildTests("Tests/Tests.Maui", "net6.0-windows10.0.19041", "win10-x64", GenerateAppxPackageOnBuild="true", PackageCertificateThumbprint="${{ steps.import-pfx.outputs.thumbprint }}", AppxPackageTestDir="Output/")) + - #@ template.replace(dotnetBuildTests("Tests/Tests.Maui", "net7.0-windows10.0.19041", "win10-x64", GenerateAppxPackageOnBuild="true", PackageCertificateThumbprint="${{ steps.import-pfx.outputs.thumbprint }}", AppxPackageTestDir="Output/")) - name: Run the tests #@yaml/text-templated-strings run: | diff --git a/.github/workflows/test-android.yml b/.github/workflows/test-android.yml index 8e9353c80f..7269a9f726 100755 --- a/.github/workflows/test-android.yml +++ b/.github/workflows/test-android.yml @@ -124,7 +124,7 @@ jobs: - name: Setup workloads run: dotnet workload install maui - 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 net7.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: @@ -135,7 +135,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/net7.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 1f498a3f09..f580f39061 100755 --- a/.github/workflows/test-ios.yml +++ b/.github/workflows/test-ios.yml @@ -113,11 +113,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 net7.0-ios -p:RestoreConfigFile=Tests/Test.NuGet.Config -p:UseRealmNupkgsWithVersion=${{ inputs.version }} - name: Run the tests uses: realm/ci-actions/run-ios-simulator@729a80d203351eab7df4eca564daa275e76ec52f with: - appPath: Tests/Tests.Maui/bin/Release/net6.0-ios/iossimulator-x64/Tests.Maui.app + appPath: Tests/Tests.Maui/bin/Release/net7.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-windows.yml b/.github/workflows/test-windows.yml index d046901d8e..96084980cd 100755 --- a/.github/workflows/test-windows.yml +++ b/.github/workflows/test-windows.yml @@ -84,7 +84,7 @@ jobs: path-replace-backslashes: true fail-on-error: false test-maui: - runs-on: windows-2019 + runs-on: windows-latest name: Maui.Windows timeout-minutes: 45 steps: @@ -116,10 +116,6 @@ jobs: apiKey: ${{ secrets.AtlasPublicKey}} privateApiKey: ${{ secrets.AtlasPrivateKey }} clusterSize: M10 - - name: Configure .NET - uses: actions/setup-dotnet@607fce577a46308457984d59e4954e075820f10a - with: - dotnet-version: 6.0.x - name: Setup workloads run: dotnet workload install maui - name: Import test certificate @@ -129,10 +125,10 @@ jobs: echo "::set-output name=thumbprint::$($cert.Thumbprint)" shell: powershell - name: Publish Tests/Tests.Maui - run: dotnet publish Tests/Tests.Maui -c Release -f net6.0-windows10.0.19041 -r win10-x64 -p:GenerateAppxPackageOnBuild=true -p:PackageCertificateThumbprint=${{ steps.import-pfx.outputs.thumbprint }} -p:AppxPackageTestDir=Output/ -p:RestoreConfigFile=Tests/Test.NuGet.Config -p:UseRealmNupkgsWithVersion=${{ inputs.version }} -p:RealmTestsStandaloneExe=true --no-self-contained + run: dotnet publish Tests/Tests.Maui -c Release -f net7.0-windows10.0.19041 -r win10-x64 -p:GenerateAppxPackageOnBuild=true -p:PackageCertificateThumbprint=${{ steps.import-pfx.outputs.thumbprint }} -p:AppxPackageTestDir=Output/ -p:RestoreConfigFile=Tests/Test.NuGet.Config -p:UseRealmNupkgsWithVersion=${{ inputs.version }} -p:RealmTestsStandaloneExe=true --no-self-contained - name: Output executable path id: dotnet-publish - run: echo 'executable-path=./Tests/Tests.Maui/bin/Release/net6.0-windows10.0.19041/win10-x64' >> $GITHUB_OUTPUT + run: echo 'executable-path=./Tests/Tests.Maui/bin/Release/net7.0-windows10.0.19041/win10-x64' >> $GITHUB_OUTPUT shell: bash - name: Run the tests run: | diff --git a/Tests/Tests.Maui/Tests.Maui.csproj b/Tests/Tests.Maui/Tests.Maui.csproj index aff86fc4c9..5048dc90af 100644 --- a/Tests/Tests.Maui/Tests.Maui.csproj +++ b/Tests/Tests.Maui/Tests.Maui.csproj @@ -1,8 +1,8 @@ - net6.0-android;net6.0-ios;net6.0-maccatalyst - $(TargetFrameworks);net6.0-windows10.0.19041 + net7.0-android;net7.0-ios;net7.0-maccatalyst + $(TargetFrameworks);net7.0-windows10.0.19041 Exe Tests.Maui true @@ -25,9 +25,9 @@ True - 11.0 - 13.2 - 21.0 + 11.0 + 13.2 + 21.0 10.0.17763.0 10.0.17763.0 @@ -64,7 +64,7 @@ - + Framework False @@ -75,7 +75,7 @@ - + Framework False @@ -87,7 +87,7 @@ - + lib\x86\librealm-wrappers.so PreserveNewest From c40657634c74f50c8440d274706af9738140f31e Mon Sep 17 00:00:00 2001 From: Nikola Irinchev Date: Wed, 21 Jun 2023 11:35:45 +0200 Subject: [PATCH 5/5] wait longer --- .github/templates/test-macos.yml | 4 ++-- .github/templates/test-windows.yml | 3 +-- .github/workflows/test-macos.yml | 4 ++-- .github/workflows/test-windows.yml | 3 +-- 4 files changed, 6 insertions(+), 8 deletions(-) diff --git a/.github/templates/test-macos.yml b/.github/templates/test-macos.yml index 2b3cda6266..3a19e78f64 100644 --- a/.github/templates/test-macos.yml +++ b/.github/templates/test-macos.yml @@ -25,7 +25,7 @@ jobs: - #@ template.replace(fetchPackageArtifacts()) - #@ 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 net7.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 + "/net7.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/templates/test-windows.yml b/.github/templates/test-windows.yml index 62eeac8c82..e6a27a95ed 100644 --- a/.github/templates/test-windows.yml +++ b/.github/templates/test-windows.yml @@ -47,8 +47,7 @@ jobs: Start-Process "shell:AppsFolder\$($package.PackageFamilyName)!App" -ArgumentList "--headless --labels=After --result=$(pwd)\TestResults.Windows.xml --output=$(pwd)\test.log (@= baasTestArgs('Maui.Windows') @)" Start-Sleep 5 echo "Waiting for tests to finish" - $(Get-Process Tests.Maui).WaitForExit(90000) - Get-Content args.txt + $(Get-Process Tests.Maui).WaitForExit(900000) Get-Content test.log shell: powershell - #@ publishTestsResults("TestResults.Windows.xml", "Maui.Windows") diff --git a/.github/workflows/test-macos.yml b/.github/workflows/test-macos.yml index c279d1e753..c4e0bdaf35 100755 --- a/.github/workflows/test-macos.yml +++ b/.github/workflows/test-macos.yml @@ -103,9 +103,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 net7.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 --baasurl=${{ inputs.realmUrl }} --baascluster=${{ inputs.clusterName }} --baasapikey=${{ secrets.AtlasPublicKey}} --baasprivateapikey=${{ secrets.AtlasPrivateKey}} --baasprojectid=${{ secrets.AtlasProjectId }} --baasdifferentiator=maccatalyst + run: Tests/Tests.Maui/bin/Release/net7.0-maccatalyst/maccatalyst-x64/Tests.Maui.app/Contents/MacOS/Tests.Maui --headless --result=${{ github.workspace }}/TestResults.MacCatalyst.xml --labels=All --baasurl=${{ inputs.realmUrl }} --baascluster=${{ inputs.clusterName }} --baasapikey=${{ secrets.AtlasPublicKey}} --baasprivateapikey=${{ secrets.AtlasPrivateKey}} --baasprojectid=${{ secrets.AtlasProjectId }} --baasdifferentiator=maccatalyst - name: Publish Unit Test Results uses: LaPeste/test-reporter@510caf50a955b1003bec48a6494be4d6537f3a0b if: always() diff --git a/.github/workflows/test-windows.yml b/.github/workflows/test-windows.yml index 96084980cd..6d5f4754c8 100755 --- a/.github/workflows/test-windows.yml +++ b/.github/workflows/test-windows.yml @@ -139,8 +139,7 @@ jobs: Start-Process "shell:AppsFolder\$($package.PackageFamilyName)!App" -ArgumentList "--headless --labels=After --result=$(pwd)\TestResults.Windows.xml --output=$(pwd)\test.log --baasurl=${{ inputs.realmUrl }} --baascluster=${{ inputs.clusterName }} --baasapikey=${{ secrets.AtlasPublicKey}} --baasprivateapikey=${{ secrets.AtlasPrivateKey}} --baasprojectid=${{ secrets.AtlasProjectId }} --baasdifferentiator=Maui.Windows" Start-Sleep 5 echo "Waiting for tests to finish" - $(Get-Process Tests.Maui).WaitForExit(90000) - Get-Content args.txt + $(Get-Process Tests.Maui).WaitForExit(900000) Get-Content test.log shell: powershell - name: Publish Unit Test Results