Skip to content

Commit

Permalink
ci: Add net7 template tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jeromelaban committed Oct 7, 2022
1 parent 8aede13 commit c7d7070
Show file tree
Hide file tree
Showing 3 changed files with 99 additions and 1 deletion.
32 changes: 31 additions & 1 deletion build/ci/.azure-devops-project-template-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ jobs:
- script: dotnet new -i $(System.ArtifactsDirectory)\NugetPackages\vslatest\Uno.ProjectTemplates.Dotnet*.nupkg
displayName: Install Project Templates

- powershell: build\test-scripts\run-net6-template-tests.ps1
- powershell: build\test-scripts\run-net6-mobile-template-tests.ps1
displayName: Run Project Templates Tests
env:
NUGET_CI_CONFIG: $(Build.SourcesDirectory)\src\nuget.ci.net6.config
Expand Down Expand Up @@ -103,3 +103,33 @@ jobs:
displayName: Run Project Templates Tests
env:
NUGET_CI_CONFIG: $(Build.SourcesDirectory)/src/nuget.ci.config

- job: Dotnet_Template_Tests_net7_Linux
displayName: 'dotnet new Templates Tests - Linux (net7)'

pool:
vmImage: ${{ parameters.vmImageLinux }}

container: unoplatform/wasm-build:2.3

dependsOn: Generate_Packages

steps:
- task: DownloadBuildArtifacts@0
inputs:
artifactName: NugetPackages

- template: templates/gitversion.yml

- script: cp $(System.ArtifactsDirectory)/NugetPackages/vslatest/*.nupkg $(Build.SourcesDirectory)/src/PackageCache
displayName: Copy Artifacts to PackageCache

- template: templates/dotnet-install.yml

- script: dotnet new -i $(System.ArtifactsDirectory)/NugetPackages/vslatest/Uno.ProjectTemplates.Dotnet*.nupkg
displayName: Install Project Templates

- pwsh: build/test-scripts/run-net7-template-linux.ps1
displayName: Run Project Templates Tests
env:
NUGET_CI_CONFIG: $(Build.SourcesDirectory)/src/nuget.ci.config
68 changes: 68 additions & 0 deletions build/test-scripts/run-net7-template-linux.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
Set-PSDebug -Trace 1

$ErrorActionPreference = 'Stop'

function Assert-ExitCodeIsZero()
{
if ($LASTEXITCODE -ne 0)
{
throw "Exit code must be zero."
}
}

function Get-TemplateConfiguration(
[bool]$android = $false,
[bool]$iOS = $false,
[bool]$macOS = $false,
[bool]$wasm = $false,
[bool]$skiaGtk = $false,
[bool]$skiaWpf = $false,
[bool]$skiaLinuxFB = $false,
[bool]$wasmVsCode = $false)
{
$androidFlag = '-android'
$iOSFlag = '-ios'
$macOSFlag = '-macos'
$wasmFlag = '-wasm'
$wasmVsCodeFlag = '--vscode'
$skiaWpfFlag = '--skia-wpf'
$skiaGtkFlag = '--skia-gtk'
$skiaLinuxFBFlag = '--skia-linux-fb'

$a = If ($android) { $androidFlag } Else { $androidFlag + '=false' }
$b = If ($iOS) { $iOSFlag } Else { $iOSFlag + '=false' }
$c = If ($macOS) { $macOSFlag } Else { $macOSFlag + '=false' }
$d = If ($wasm) { $wasmFlag } Else { $wasmFlag + '=false' }
$e = If ($wasmVsCode) { $wasmVsCodeFlag } Else { $wasmVsCodeFlag + '=false' }
$f = If ($skiaWpf) { $skiaWpfFlag } Else { $skiaWpfFlag + '=false' }
$g = If ($skiaGtk) { $skiaGtkFlag } Else { $skiaGtkFlag + '=false' }
$h = If ($skiaLinuxFB) { $skiaLinuxFB } Else { $skiaLinuxFBFlag + '=false' }

@($a, $b, $c, $d, $e, $f, $g, $h)
}

$default = @('-v', 'detailed', "-p:RestoreConfigFile=$env:NUGET_CI_CONFIG")

$debug = $default + '-c' + 'Debug'
$release = $default + '-c' + 'Release'

# WinUI
dotnet new unoapp -n UnoAppWinUI -Framework net7.0 (Get-TemplateConfiguration -wasm 1 -wasmVsCode 1 -skiaGtk 1 -skiaLinuxFB 1)

dotnet build $debug UnoAppWinUI/UnoAppWinUI.Wasm/UnoAppWinUI.Wasm.csproj
Assert-ExitCodeIsZero

dotnet build $release UnoAppWinUI/UnoAppWinUI.Wasm/UnoAppWinUI.Wasm.csproj
Assert-ExitCodeIsZero

dotnet build $debug UnoAppWinUI/UnoAppWinUI.Skia.Gtk/UnoAppWinUI.Skia.Gtk.csproj
Assert-ExitCodeIsZero

dotnet build $release UnoAppWinUI/UnoAppWinUI.Skia.Gtk/UnoAppWinUI.Skia.Gtk.csproj
Assert-ExitCodeIsZero

dotnet build $debug UnoAppWinUI/UnoAppWinUI.Skia.Linux.FrameBuffer/UnoAppWinUI.Skia.Linux.FrameBuffer.csproj
Assert-ExitCodeIsZero

dotnet build $release UnoAppWinUI/UnoAppWinUI.Skia.Linux.FrameBuffer/UnoAppWinUI.Skia.Linux.FrameBuffer.csproj
Assert-ExitCodeIsZero

0 comments on commit c7d7070

Please sign in to comment.