Skip to content

Commit

Permalink
Merge pull request #3268 from unoplatform/dev/eb/template-tests
Browse files Browse the repository at this point in the history
ci: Add dotnet templates integration tests
  • Loading branch information
ebariche authored Jun 5, 2020
2 parents 9683598 + 28c0550 commit a2e08f0
Show file tree
Hide file tree
Showing 3 changed files with 104 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .vsts-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ jobs:
parameters:
vmImage: '$(windowsVMImage)'

- template: build/ci/.azure-devops-project-template-tests.yml
parameters:
vmImage: $(windowsVMImage)

- template: build/ci/.azure-devops-uap.yml
parameters:
vmImage: '$(windowsVMImage)'
Expand Down
26 changes: 26 additions & 0 deletions build/ci/.azure-devops-project-template-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
parameters:
vmImage: ''

jobs:
- job: Dotnet_Template_Tests

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

dependsOn: VS_Latest

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

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

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

- powershell: build\run-template-tests.ps1
displayName: Run Project Templates Tests
env:
NUGET_CI_CONFIG: $(Build.SourcesDirectory)\src\nuget.ci.config
74 changes: 74 additions & 0 deletions build/run-template-tests.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
$ErrorActionPreference = 'Stop'

function Get-TemplateConfiguration(
[bool]$uwp = $false,
[bool]$android = $false,
[bool]$iOS = $false,
[bool]$macOS = $false,
[bool]$wasm = $false,
[bool]$wasmVsCode = $false)
{
$uwpFlag = '-uwp'
$androidFlag = '-android'
$iOSFlag = '-ios'
$macOSFlag = '-macos'
$wasmFlag = '-wasm'
$wasmVsCodeFlag = '--vscodeWasm'

$a = If ($uwp) { $uwpFlag } Else { $uwpFlag + '=false' }
$b = If ($android) { $androidFlag } Else { $androidFlag + '=false' }
$c = If ($iOS) { $iOSFlag } Else { $iOSFlag + '=false' }
$d = If ($macOS) { $macOSFlag } Else { $macOSFlag + '=false' }
$e = If ($wasm) { $wasmFlag } Else { $wasmFlag + '=false' }
$f = If ($wasmVsCode) { $wasmVsCodeFlag } Else { $wasmVsCodeFlag + '=false' }

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

$msbuild = vswhere -latest -requires Microsoft.Component.MSBuild -find MSBuild\**\Bin\MSBuild.exe

$default = @('/ds', '/r', "/p:RestoreConfigFile=$env:NUGET_CI_CONFIG", '/p:PackageCertificateKeyFile=')

$debug = $default + '/p:Configuration=Debug'

$release = $default + '/p:AotAssemblies=false' + '/p:Configuration=Release'
$releaseX64 = $release + '/p:Platform=x64'
$releaseIPhone = $release + '/p:Platform=iPhone'
$releaseIPhoneSimulator = $release + '/p:Platform=iPhoneSimulator'

$templateConfigurations =
@(
(Get-TemplateConfiguration -uwp 1),
(Get-TemplateConfiguration -android 1),
(Get-TemplateConfiguration -iOS 1),
(Get-TemplateConfiguration -macOS 1),
(Get-TemplateConfiguration -wasm 1)
)

$configurations =
@(
@($templateConfigurations[0], $releaseX64),
@($templateConfigurations[1], $release),
@($templateConfigurations[2], $releaseIPhone),
@($templateConfigurations[3], $releaseIPhoneSimulator),
@($templateConfigurations[4], $release)
)

# Default
dotnet new unoapp -n UnoAppAll
& $msbuild $debug UnoAppAll\UnoAppAll.sln

# Heads - Release
for($i = 0; $i -lt $configurations.Length; $i++)
{
dotnet new unoapp -n "UnoApp$i" $configurations[$i][0]
& $msbuild $configurations[$i][1] "UnoApp$i\UnoApp$i.sln"
}

# VS Code
dotnet new unoapp -n UnoAppVsCode (Get-TemplateConfiguration -wasm 1 -wasmVsCode 1)
dotnet build -p:RestoreConfigFile=$env:NUGET_CI_CONFIG UnoAppVsCode\UnoAppVsCode.sln

# WinUI - Release
# dotnet new unoapp-winui -n UnoAppWinUI
# & $msbuild $release UnoAppWinUI\UnoAppWinUI.sln

0 comments on commit a2e08f0

Please sign in to comment.