forked from unoplatform/Uno.Samples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.vsts-ci.yml
49 lines (37 loc) · 1.7 KB
/
.vsts-ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
jobs:
- job: VS_Latest
timeoutInMinutes: 600
pool:
vmImage: windows-2022
steps:
- checkout: self
clean: true
- powershell: |
if($env:System_PullRequest_TargetBranch -eq $null) { $TargetBranch = "master" } else { $TargetBranch = $env:System_PullRequest_TargetBranch; }
$dict = New-Object 'System.Collections.Generic.Dictionary[String,System.Collections.Generic.Dictionary[String,String]]'
$samples = Get-ChildItem -Path **\*.sln -Recurse | Where-Object {$_.FullName -notmatch "\\ArchivedProjects\\"}
foreach($sample in $samples){
$solutionPath=[System.IO.Path]::GetDirectoryName($sample.FullName);
Write-Host "$solutionPath"
git diff --quiet HEAD "origin/$TargetBranch" -- "$solutionPath"
# Only build if there a change in the solution path for the current PR, if we're not in a PR
if( ("$env:System_PullRequest_PullRequestId" -eq '') -or ($global:LASTEXITCODE -ne 0)) {
Write-Host "Adding $solutionPath"
$item = New-Object 'System.Collections.Generic.Dictionary[String,String]'
$item.Add("solutionPath", $sample.FullName)
$name = $sample.Name.Split(".")[0]
if(!$dict.ContainsKey($name)){
$dict.Add($name, $item)
}
}
$global:LASTEXITCODE = 0
}
$SolutionsJson = $dict | ConvertTo-Json -Compress
Write-Host $SolutionsJson
Write-Host "##vso[task.setvariable variable=samplesJson;isOutput=true]$SolutionsJson"
name: generateJson
displayName: Generate Json of Samples
- template: .azure-pipelines.BuildMatrix.yml
# - task: PublishBuildArtifacts@1
# inputs:
# pathtoPublish: $(Build.ArtifactStagingDirectory)