Skip to content

Commit ed0e1a7

Browse files
committed
Test PowerShell daily in CI
1 parent bcec9f6 commit ed0e1a7

File tree

3 files changed

+34
-3
lines changed

3 files changed

+34
-3
lines changed

.github/workflows/ci-test.yml

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,36 @@ 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 daily 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 daily
61+
continue-on-error: true
62+
run: ./pwsh/tools/install-powershell.ps1 -Daily -Destination ./daily
63+
shell: pwsh
64+
65+
- name: Test daily
66+
continue-on-error: true
67+
run: |
68+
if ($isWindows) {
69+
$pwsh = (Resolve-Path .\daily\pwsh.exe)
70+
} else {
71+
$pwsh = (Resolve-Path .\daily\pwsh)
72+
}
73+
./build.ps1 -Test -WithPowerShell:$pwsh
74+
shell: pwsh
75+
5276
- name: Upload build artifacts
5377
uses: actions/upload-artifact@v4
5478
if: always()

build.ps1

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ param(
3232

3333
[Parameter(ParameterSetName='Test')]
3434
[switch] $InProcess,
35+
[string] $WithPowerShell,
3536

3637
[Parameter(ParameterSetName='BuildAll')]
3738
[switch] $Catalog,
@@ -85,7 +86,7 @@ END {
8586
Start-CreatePackage
8687
}
8788
"Test" {
88-
Test-ScriptAnalyzer -InProcess:$InProcess
89+
Test-ScriptAnalyzer -InProcess:$InProcess -WithPowerShell:$WithPowerShell
8990
return
9091
}
9192
default {

build.psm1

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,10 @@ function New-Catalog
308308
function 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

0 commit comments

Comments
 (0)