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 Sep 1, 2022
1 parent 4a8888a commit 29843ad
Show file tree
Hide file tree
Showing 17 changed files with 275 additions and 152 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:
_: #@ 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))
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.

58 changes: 58 additions & 0 deletions .github/templates/test-windows.yml
Original file line number Diff line number Diff line change
@@ -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")

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 @@ -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'
Expand Down
8 changes: 3 additions & 5 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,18 +67,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 @@ -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 }}'
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/test-unity.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
77 changes: 0 additions & 77 deletions .github/workflows/test-uwp-managed.yml

This file was deleted.

Loading

0 comments on commit 29843ad

Please sign in to comment.