summaryrefslogtreecommitdiff
path: root/.github/scripts
diff options
context:
space:
mode:
authorAdonais Romero González <[email protected]>2023-01-30 15:00:49 -0800
committerGitHub <[email protected]>2023-01-30 15:00:49 -0800
commit07779ee84973f2f63a1f2ced6377463b1c01baaf (patch)
treed28fc10efc8f5dee97ec5df162bb533f6e801585 /.github/scripts
parent2c0c8763300988d92ddd139cadf012f5ab1b12e1 (diff)
Build scripts update (#844)
--------- Co-authored-by: Jakob Lichtenberg (170957) <[email protected]>
Diffstat (limited to '.github/scripts')
-rw-r--r--.github/scripts/Build-ChangedProjects.ps134
-rw-r--r--.github/scripts/Build-ChangedSamples.ps140
2 files changed, 40 insertions, 34 deletions
diff --git a/.github/scripts/Build-ChangedProjects.ps1 b/.github/scripts/Build-ChangedProjects.ps1
deleted file mode 100644
index a13e3501..00000000
--- a/.github/scripts/Build-ChangedProjects.ps1
+++ /dev/null
@@ -1,34 +0,0 @@
-param (
- [array]$ChangedFiles
-)
-
-$root = (Get-Location).Path
-
-# To include in CI gate
-$projectSet = @{}
-foreach ($file in $ChangedFiles)
-{
- if (-not (Test-Path $file)) {
- Write-Output "`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-Output "`u{2754} Changed file $file does not match a project."
- continue
- }
- $projectName = $dir.Replace($root, '').Trim('\').Replace('\', '.').ToLower()
- Write-Output "`u{1F50E} Found project [$projectName] at $dir from changed file $file"
- if (-not ($projectSet.ContainsKey($projectName)))
- {
- $projectSet[$projectName] = $dir
- }
-}
-
-.\Build-ProjectSet -ProjectSet $projectSet
-
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")
+