7070 fail-fast : false
7171 matrix :
7272 os : [ windows-latest, ubuntu-latest, macos-latest ]
73+ shell : [ pwsh ]
74+ include :
75+ - os : windows-latest
76+ shell : powershell
7377 steps :
7478 - name : Download build.requires.psd1
7579 uses : actions/download-artifact@v8
@@ -79,39 +83,53 @@ jobs:
7983 uses : actions/download-artifact@v8
8084 with :
8185 name : ModuleBuilder
82- path : output /ModuleBuilder # /home/runner/work/ModuleBuilder/ModuleBuilder/output/ModuleBuilder
86+ path : Modules /ModuleBuilder # /home/runner/work/ModuleBuilder/ModuleBuilder/output/ModuleBuilder
8387 - name : Download Pester Tests
8488 uses : actions/download-artifact@v8
8589 with :
8690 name : PesterTests
8791 path : PesterTests
88- - name : Install Output Modules
92+ # Avoid installing ModuleBuilder with ModuleFast, so there's only one copy
93+ - name : Remove ModuleBuilder from build.requires
8994 shell : pwsh
9095 run : | # PowerShell
91- # https://docs.github.com/en/actions/use-cases-and-examples/building-and-testing/building-and-testing-powershell#powershell-module-locations
92- $ModuleDestination = if ($IsWindows) {
93- Join-Path ([Environment]::GetFolderPath('MyDocuments')) 'PowerShell/Modules'
94- } else {
95- Join-Path $HOME '.local/share/powershell/Modules'
96- }
97-
98- Get-ChildItem -Directory output -OutVariable Modules
99- | Move-Item -Destination { Join-Path $ModuleDestination $_.Name } -Force
100-
101- Write-Host "Installing $($Modules -join ', ') to $ModuleDestination"
102- Get-ChildItem -Directory $ModuleDestination
103- Write-Host "PSModulePath:"
104- $Env:PSModulePath -split ([IO.Path]::PathSeparator) | Out-Host
105-
106- # Avoid installing ModuleBuilder with ModuleFast, so there's only one copy
107- @(Get-Content build.requires.psd1)
108- | Where { $_ -notmatch "ModuleBuilder"}
109- | Set-Content build.requires.psd1
96+ @(Get-Content build.requires.psd1).Where({ $_ -notmatch "ModuleBuilder"}) | Set-Content build.requires.psd1
11097 - name : ⚡ Install Required Modules
11198 uses : JustinGrote/ModuleFast-action@v0.0.1
99+ env :
100+ MODULEFAST_DESTINATION : ${{ github.workspace }}/Modules
112101 - name : Invoke-Pester
102+ if : matrix.shell == 'powershell'
103+ shell : powershell
104+ env :
105+ MODULEFAST_DESTINATION : ${{ github.workspace }}/Modules
106+ run : | # PowerShell
107+ $Env:PSModulePath = $Env:MODULEFAST_DESTINATION + [IO.Path]::PathSeparator + $Env:PSModulePath
108+
109+ # For the cross-platform matrix we don't need to do coverage or anything complicated
110+ $Result = Invoke-Pester . -PassThru
111+ @(
112+ "## Pester Tests for ${{ matrix.os }}"
113+ ""
114+ $Result.Duration.ToString()
115+ "| Total | Passed | Failed |"
116+ "|------:|-------:|-------:|"
117+ "| $($Result.TotalCount) | $($Result.PassedCount) | $($Result.FailedCount) |"
118+ ""
119+ "| Duration | Total | Passed | Failed | Skipped | Name |"
120+ "|---------:|------:|-------:|-------:|--------:|:-----|"
121+ @($Result.Containers).ForEach{
122+ "| $($_.Duration) | $($_.TotalCount) | $($_.PassedCount) | $($_.FailedCount) | $($_.SkippedCount) | $($_.Name) |"
123+ }
124+ ) | Out-File -FilePath $env:GITHUB_STEP_SUMMARY
125+ - name : Invoke-Pester
126+ if : matrix.shell == 'pwsh'
113127 shell : pwsh
128+ env :
129+ MODULEFAST_DESTINATION : ${{ github.workspace }}/Modules
114130 run : | # PowerShell
131+ $Env:PSModulePath = $Env:MODULEFAST_DESTINATION + [IO.Path]::PathSeparator + $Env:PSModulePath
132+
115133 # For the cross-platform matrix we don't need to do coverage or anything complicated
116134 $Result = Invoke-Pester . -PassThru
117135 @(
0 commit comments