diff options
| author | Adonais Romero González <[email protected]> | 2023-02-03 14:36:05 -0800 |
|---|---|---|
| committer | Adonais Romero González <[email protected]> | 2023-02-03 14:36:05 -0800 |
| commit | c0174c77c5dbed96d4e537c08b1504cd6b9a3134 (patch) | |
| tree | 36dbbe54aee9cd4f381975a5d0c6eea75bfb956f /.github/scripts/Build-ChangedSamples.ps1 | |
| parent | 520c37087776a198544ab9b721d802dd30864736 (diff) | |
| parent | 07779ee84973f2f63a1f2ced6377463b1c01baaf (diff) | |
Merge branch 'main' into develop-2302-merge
Diffstat (limited to '.github/scripts/Build-ChangedSamples.ps1')
| -rw-r--r-- | .github/scripts/Build-ChangedSamples.ps1 | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/.github/scripts/Build-ChangedSamples.ps1 b/.github/scripts/Build-ChangedSamples.ps1 new file mode 100644 index 00000000..82096cd6 --- /dev/null +++ b/.github/scripts/Build-ChangedSamples.ps1 @@ -0,0 +1,40 @@ +[CmdletBinding()] +param ( + [array]$ChangedFiles +) + +$Verbose = $false +if ($PSBoundParameters.ContainsKey('Verbose')) { + $Verbose = $PsBoundParameters.Get_Item('Verbose') +} + +$root = (Get-Location).Path + +# To include in CI gate +$sampleSet = @{} +foreach ($file in $ChangedFiles) +{ + if (-not (Test-Path $file)) { + Write-Verbose "`u{2754} Changed file $file cannot be found" + continue + } + $dir = (Get-Item $file).DirectoryName + while ((-not ($slnItems = (Get-ChildItem $dir '*.sln'))) -and ($dir -ne $root)) + { + $dir = (Get-Item $dir).Parent.FullName + } + if ($dir -eq $root) + { + Write-Verbose "`u{2754} Changed file $file does not match a sample." + continue + } + $sampleName = $dir.Replace($root, '').Trim('\').Replace('\', '.').ToLower() + Write-Verbose "`u{1F50E} Found sample [$sampleName] at $dir from changed file $file" + if (-not ($sampleSet.ContainsKey($sampleName))) + { + $sampleSet[$sampleName] = $dir + } +} + +.\Build-SampleSet -SampleSet $sampleSet -Verbose:$Verbose -LogFilesDirectory (Join-Path $root "_logs") + |
