Skip to content

Commit 7430ebd

Browse files
🩹 [CI]: Enhance Get-TestSuites workflow to support skipping specified tests based on input parameters
1 parent 137a622 commit 7430ebd

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

ā€Ž.github/workflows/Get-TestSuites.yml

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,10 +119,22 @@ jobs:
119119
120120
$allTestFolders = @($testsPath) + (Find-TestDirectories -Path $testsPath)
121121
122+
$skipTests = $env:PSMODULE_GET_TESTSUITES_INPUT_SkipTests -Split ",|\s+" | ForEach-Object { $_.Trim() }
123+
124+
Write-Host "The following tests will be skipped:"
125+
$skipTests | ForEach-Object { " - $_ " }
126+
122127
$testSuites = foreach ($folder in $allTestFolders) {
123128
$testItems = Get-TestItemsFromFolder -FolderPath $folder
124129
foreach ($item in $testItems) {
125130
foreach ($osConfig in $osConfigs) {
131+
if ($skipTests -contains 'All' -or
132+
$skipTests -contains $osConfig.OSName -or
133+
($skipTests -contains 'Module' -and $item.Name -match '\.Tests\.ps1$') -or
134+
($skipTests -contains 'SourceCode' -and $item.Name -match '\.(Configuration|Container)\.ps1$')) {
135+
continue
136+
}
137+
126138
[pscustomobject]@{
127139
RunsOn = $osConfig.RunsOn
128140
OSName = $osConfig.OSName
@@ -133,8 +145,10 @@ jobs:
133145
}
134146
}
135147
136-
# Create separate outputs for source code tests (OS only) and module tests (existing detailed output)
137-
$sourceCodeTestSuites = $osConfigs | Select-Object -Property RunsOn, OSName -Unique
148+
# Adjust source code test suites based on SkipTests
149+
$sourceCodeTestSuites = $osConfigs | Where-Object {
150+
-not ($skipTests -contains 'All' -or $skipTests -contains $_.OSName -or $skipTests -contains 'SourceCode')
151+
} | Select-Object -Property RunsOn, OSName -Unique
138152
139153
# Display the generated matrices for verification.
140154
Write-Host "Source Code Test Suites:"

0 commit comments

Comments
Ā (0)