Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Maui Windows on CI #3012

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/templates/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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("UWP Managed", 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"))
Expand Down
2 changes: 1 addition & 1 deletion .github/templates/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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("UWP Managed", 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))
Expand Down
4 changes: 2 additions & 2 deletions .github/templates/test-android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
4 changes: 2 additions & 2 deletions .github/templates/test-ios.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
4 changes: 2 additions & 2 deletions .github/templates/test-macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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")
26 changes: 0 additions & 26 deletions .github/templates/test-uwp-managed.yml

This file was deleted.

54 changes: 54 additions & 0 deletions .github/templates/test-windows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
#@ load("@ytt:template", "template")
#@ load("common.lib.yml", "checkoutCode", "setupDotnet", "setupWorkloads")
#@ load("test.lib.yml", "baasTestArgs", "publishTestsResults", "testDefinition", "buildTests", "dotnetBuildTests", "prepareTest")

#@ 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(prepareTest())
- #@ 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-latest
name: Maui.Windows
timeout-minutes: 45
steps:
- #@ template.replace(prepareTest())
- #@ setupWorkloads()
- #@ importPfx("import-pfx")
- #@ 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: |
.\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(900000)
Get-Content test.log
shell: powershell
- #@ publishTestsResults("TestResults.Windows.xml", "Maui.Windows")

6 changes: 3 additions & 3 deletions .github/templates/test.lib.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,12 @@ 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"
#@ }
#@ })
#@ return dotnetPublish(projectPath, framework, runtime, properties)
#@ end

Expand Down
6 changes: 2 additions & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,8 @@ jobs:
AtlasProjectId: ${{ secrets.ATLAS_QA_PROJECT_ID }}
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:
Expand All @@ -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
Expand Down
8 changes: 3 additions & 5 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,17 +70,15 @@ jobs:
with:
version: ${{ needs.build-packages.outputs.package_version }}
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:
- 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
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test-android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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 }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test-ios.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test-macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
90 changes: 0 additions & 90 deletions .github/workflows/test-uwp-managed.yml

This file was deleted.

Loading