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 29, 2022
1 parent 8eafee9 commit ea576af
Show file tree
Hide file tree
Showing 14 changed files with 224 additions and 134 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.

49 changes: 49 additions & 0 deletions .github/templates/test-windows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#@ 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: Deploy
run: .\Tests\Tests.Maui\Output\Install.ps1 -Force
- name: Run
#@yaml/text-templated-strings
run: Tests.Maui.exe --headless --labels=After --result=TestResults.Windows.xml (@= baasTestArgs('Maui.Windows') @)
- #@ 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.

135 changes: 135 additions & 0 deletions .github/workflows/test-windows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
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/[email protected]
if: ${{ runner.os == 'Windows' }}
- uses: actions/cache@v2
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('Tests/Tests.UWP/*.csproj') }}
- 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
- uses: actions/cache@v2
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('Tests/Tests.Maui/*.csproj') }}
- 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: Deploy
run: .\Tests\Tests.Maui\Output\Install.ps1 -Force
- name: Run
run: Tests.Maui.exe --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
- 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
Loading

0 comments on commit ea576af

Please sign in to comment.