Skip to content

Commit

Permalink
Maui Windows on CI
Browse files Browse the repository at this point in the history
  • Loading branch information
fealebenpae committed Aug 31, 2022
1 parent 8eafee9 commit d2f6295
Show file tree
Hide file tree
Showing 15 changed files with 269 additions and 155 deletions.
4 changes: 2 additions & 2 deletions .github/templates/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/templates/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
build-docs: ${{ contains(github.head_ref, 'release') }}
_: #@ template.replace(buildUnity())
_: #@ 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))
Expand Down
2 changes: 1 addition & 1 deletion .github/templates/test-net-core.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }})")
27 changes: 0 additions & 27 deletions .github/templates/test-uwp-managed.yml

This file was deleted.

56 changes: 56 additions & 0 deletions .github/templates/test-windows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#@ 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
$(Get-Process Tests.Maui).WaitForExit()
Get-Content test.log
shell: powershell
- #@ publishTestsResults("TestResults.Windows.xml", "Maui.Windows")

9 changes: 4 additions & 5 deletions .github/templates/test.lib.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
6 changes: 3 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -268,7 +268,7 @@ jobs:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('Tests/Benchmarks/PerformanceTests/*.csproj') }}
- 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'
Expand Down
8 changes: 3 additions & 5 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,18 +56,16 @@ 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:
- build-packages
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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-net-core.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ jobs:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('Tests/Realm.Tests/*.csproj') }}
- 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 }}'
Expand Down
81 changes: 0 additions & 81 deletions .github/workflows/test-uwp-managed.yml

This file was deleted.

Loading

0 comments on commit d2f6295

Please sign in to comment.