Skip to content

Commit

Permalink
ci: Add dotnet templates integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ebariche committed Jun 4, 2020
1 parent cb6c494 commit 28c0550
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 28c0550

Please sign in to comment.