File tree Expand file tree Collapse file tree 3 files changed +33
-3
lines changed Expand file tree Collapse file tree 3 files changed +33
-3
lines changed Original file line number Diff line number Diff line change @@ -43,12 +43,35 @@ jobs:
4343 shell : pwsh
4444
4545 - name : Test Windows PowerShell
46+ if : matrix.os == 'windows-latest'
4647 run : |
4748 Install-Module Pester -Scope CurrentUser -Force -SkipPublisherCheck
4849 ./build.ps1 -Test
49- if : matrix.os == 'windows-latest'
5050 shell : powershell
5151
52+ - name : Download PowerShell install script
53+ uses : actions/checkout@v4
54+ with :
55+ repository : PowerShell/PowerShell
56+ path : pwsh
57+ sparse-checkout : tools/install-powershell.ps1
58+ sparse-checkout-cone-mode : false
59+
60+ - name : Install preview
61+ continue-on-error : true
62+ run : ./pwsh/tools/install-powershell.ps1 -Preview
63+ shell : pwsh
64+
65+ - name : Test preview
66+ run : |
67+ $PwshPreview = if ($isWindows) {
68+ "$env:LOCALAPPDATA/Microsoft/powershell-preview/pwsh.exe"
69+ } else {
70+ "$HOME/.powershell-preview/pwsh"
71+ }
72+ ./build.ps1 -Test -WithPowerShell:$PwshPreview
73+ shell : pwsh
74+
5275 - name : Upload build artifacts
5376 uses : actions/upload-artifact@v4
5477 if : always()
Original file line number Diff line number Diff line change 3232
3333 [Parameter (ParameterSetName = ' Test' )]
3434 [switch ] $InProcess ,
35+ [string ] $WithPowerShell ,
3536
3637 [Parameter (ParameterSetName = ' BuildAll' )]
3738 [switch ] $Catalog ,
8586 Start-CreatePackage
8687 }
8788 " Test" {
88- Test-ScriptAnalyzer - InProcess:$InProcess
89+ Test-ScriptAnalyzer - InProcess:$InProcess - WithPowerShell: $WithPowerShell
8990 return
9091 }
9192 default {
Original file line number Diff line number Diff line change @@ -308,7 +308,10 @@ function New-Catalog
308308function Test-ScriptAnalyzer
309309{
310310 [CmdletBinding ()]
311- param ( [switch ] $InProcess )
311+ param (
312+ [switch ] $InProcess ,
313+ [string ] $WithPowerShell
314+ )
312315
313316 END {
314317 # versions 3 and 4 don't understand versioned module paths, so we need to rename the directory of the version to
@@ -349,6 +352,9 @@ function Test-ScriptAnalyzer
349352 if ( $InProcess ) {
350353 & $scriptBlock
351354 }
355+ elseif ( $WithPowerShell ) {
356+ & ${WithPowerShell} - Command $scriptBlock
357+ }
352358 else {
353359 $powershell = (Get-Process - id $PID ).MainModule.FileName
354360 & ${powershell} - NoProfile - Command $scriptBlock
You can’t perform that action at this time.
0 commit comments