Skip to content

Commit 63cbccd

Browse files
🩹 [CI]: Add functionality to skip tests based on input, enhancing test suite flexibility
1 parent e6dc59b commit 63cbccd

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

‎.github/workflows/Get-TestSuites.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,27 @@ jobs:
8080
@{ RunsOn = 'windows-latest'; OSName = 'Windows' }
8181
)
8282
83+
$skipTests = $env:PSMODULE_GET_TESTSUITES_INPUT_SkipTests -Split ",|\s+" | ForEach-Object { $_.Trim() }
84+
85+
if ($skipTests -contains 'All') {
86+
Write-Host "Skipping all tests as requested."
87+
Set-GitHubOutput -Name SourceCodeTestSuites -Value '[]'
88+
Set-GitHubOutput -Name ModuleTestSuites -Value '[]'
89+
Set-GitHubOutput -Name ModuleLocalTestSuites -Value '[]'
90+
exit 0
91+
}
92+
93+
# Filter out OS-specific tests early
94+
$osConfigs = $osConfigs | Where-Object { $skipTests -notcontains $_.OSName }
95+
96+
if (-not $osConfigs) {
97+
Write-Host "No OS configurations left after filtering. Exiting."
98+
Set-GitHubOutput -Name SourceCodeTestSuites -Value '[]'
99+
Set-GitHubOutput -Name ModuleTestSuites -Value '[]'
100+
Set-GitHubOutput -Name ModuleLocalTestSuites -Value '[]'
101+
exit 0
102+
}
103+
83104
# Locate the tests directory.
84105
$testsPath = Resolve-Path 'tests' -ErrorAction SilentlyContinue | Select-Object -ExpandProperty Path
85106
if (-not $testsPath -or -not (Test-Path -Path $testsPath)) {

0 commit comments

Comments
 (0)