@@ -3,6 +3,11 @@ name: Get-TestSuites
33on :
44 workflow_call :
55 inputs :
6+ SkipTests :
7+ type : string
8+ description : Defines what types of tests to skip. Allowed values are 'All', 'SourceCode', 'Module', 'None', 'macOS', 'Windows', 'Linux'.
9+ required : false
10+ default : None
611 Debug :
712 type : boolean
813 description : Enable debug output.
3035 default : ' .'
3136
3237 outputs :
33- TestSuites :
34- description : The test suites to run.
35- value : ${{ jobs.Get-TestSuites.outputs.TestSuites }}
38+ SourceCodeTestSuites :
39+ description : Source Code test suites to run.
40+ value : ${{ jobs.Get-TestSuites.outputs.SourceCodeTestSuites }}
41+ ModuleTestSuites :
42+ description : Module test suites to run.
43+ value : ${{ jobs.Get-TestSuites.outputs.ModuleTestSuites }}
3644
3745permissions :
3846 contents : read # to checkout the repo
@@ -42,14 +50,17 @@ jobs:
4250 name : Get-TestSuites
4351 runs-on : ubuntu-latest
4452 outputs :
45- TestSuites : ${{ fromJson(steps.Get-TestSuites.outputs.result).TestSuites }}
53+ SourceCodeTestSuites : ${{ fromJson(steps.Get-TestSuites.outputs.result).SourceCodeTestSuites }}
54+ ModuleTestSuites : ${{ fromJson(steps.Get-TestSuites.outputs.result).ModuleTestSuites }}
4655 steps :
4756 - name : Checkout Code
4857 uses : actions/checkout@v4
4958
5059 - name : Get-TestSuites
5160 uses : PSModule/GitHub-Script@v1
5261 id : Get-TestSuites
62+ env :
63+ PSMODULE_GET_TESTSUITES_INPUT_SkipTests : ${{ inputs.SkipTests }}
5364 with :
5465 ShowOutput : true
5566 Debug : ${{ inputs.Debug }}
6071 Script : |
6172 # Define test configurations as an array of hashtables.
6273 $osConfigs = @(
63- @{ runson = 'ubuntu-latest'; name = 'Linux' }
64- @{ runson = 'macos-latest'; name = 'macOS' }
65- @{ runson = 'windows-latest'; name = 'Windows' }
74+ @{ RunsOn = 'ubuntu-latest'; OSName = 'Linux' }
75+ @{ RunsOn = 'macos-latest'; OSName = 'macOS' }
76+ @{ RunsOn = 'windows-latest'; OSName = 'Windows' }
6677 )
6778
6879 # Locate the tests directory.
@@ -113,17 +124,24 @@ jobs:
113124 foreach ($item in $testItems) {
114125 foreach ($osConfig in $osConfigs) {
115126 [pscustomobject]@{
116- RunsOn = $osConfig.runson
117- OSName = $osConfig.name
127+ RunsOn = $osConfig.RunsOn
128+ OSName = $osConfig.OSName
118129 TestPath = Resolve-Path -Path $item.FullName -Relative
119130 TestName = $item.BaseName
120131 }
121132 }
122133 }
123134 }
124135
125- # (Optional) Display the generated matrix in a table for verification.
126- $testSuites | Format-Table -AutoSize
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
138+
139+ # Display the generated matrices for verification.
140+ Write-Host "Source Code Test Suites:"
141+ $sourceCodeTestSuites | Format-Table -AutoSize | Out-String
142+ Write-Host "Module Test Suites:"
143+ $testSuites | Format-Table -AutoSize | Out-String
127144
128- # Pass the final object to GitHub Actions output.
129- Set-GitHubOutput -Name TestSuites -Value $testSuites
145+ # Pass the final objects to GitHub Actions output.
146+ Set-GitHubOutput -Name SourceCodeTestSuites -Value $sourceCodeTestSuites
147+ Set-GitHubOutput -Name ModuleTestSuites -Value $testSuites
0 commit comments