Skip to content

Commit 2c6fba2

Browse files
🩹 [Refactor]: Enhance Gather-Tests workflow by improving test suite collection and output formatting for better clarity and usability
1 parent c16bf80 commit 2c6fba2

File tree

1 file changed

+24
-11
lines changed

1 file changed

+24
-11
lines changed

‎.github/workflows/Gather-Tests.yml

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -51,30 +51,43 @@ jobs:
5151
id: Gather-Tests
5252
with:
5353
ShowOutput: true
54+
WorkingDirectory: ${{ inputs.Path }}
5455
Script: |
55-
$rootPath = Resolve-Path -Path '${{ inputs.Path }}'
56-
$testsPath = Join-Path -Path $rootPath -ChildPath 'tests'
56+
$shellsToTest = @('pwsh')
57+
$OSsToTest = @('ubuntu-latest', 'macos-latest', 'windows-latest')
58+
59+
$testsPath = Resolve-Path 'tests' | Select-Object -ExpandProperty Path
5760
if (-not (Test-Path -Path $testsPath)) {
5861
Write-Host "No tests found"
5962
exit 0
6063
}
6164
6265
$testSuites = @()
63-
Get-ChildItem -Path $testsPath -Directory | ForEach-Object {
64-
$filePath = $_.FullName
65-
}
66+
Get-ChildItem -Path $testsPath -Directory
6667
if (-not $testSuites) {
6768
$testSuites += @($testsPath)
6869
}
6970
70-
'ubuntu-latest', 'macos-latest', 'windows-latest' | ForEach-Object {
71-
$testSuites = @{
72-
RunsOn = $_
73-
FullName = $filePath
71+
$tests = @()
72+
$OSsToTest | ForEach-Object {
73+
$os = $_
74+
$testSuites | ForEach-Object {
75+
$testSuite = $_
76+
$shellsToTest | ForEach-Object {
77+
$shell = $_
78+
$testPath = Resolve-Path -Path $testSuite | Select-Object -ExpandProperty Path
79+
$test = @{}
80+
$test += @{
81+
OS = $os
82+
Path = $testPath
83+
Shell = $shell
84+
}
85+
$tests += @($test)
7486
}
7587
}
88+
}
7689
7790
78-
Write-Output ($testSuites | ConvertTo-Json -Depth 10)
91+
Write-Output ($tests | ConvertTo-Json -Depth 10)
7992
80-
Set-GitHubOutput -Name TestSuites -Value ($testSuites | ConvertTo-Json -Depth 10)
93+
Set-GitHubOutput -Name Tests -Value ($tests | ConvertTo-Json -Depth 10 -Compress)

0 commit comments

Comments
 (0)