Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,40 @@ jobs:
shell: pwsh
run: Invoke-Pester tests/powershell/ -Output Detailed

powershell51-tests:
name: PowerShell 5.1 tests (Pester)
needs: detect-changes
# Advisory only: not registered in the ruleset's required-check set
# yet, so a failure here does not block merges (#166). Promotion to
# required is a later decision once this leg proves stable.
# always() overrides the default "skip if a need failed" behavior
# so a failed/cancelled detect-changes fails open to running the
# real job, rather than silently skipping it (which would satisfy
# the required-status-check gate without ever having run).
if: |
always() &&
(needs.detect-changes.result != 'success' || needs.detect-changes.outputs.requires_full_ci == 'true')
runs-on: windows-latest
steps:
- uses: actions/checkout@v7
Comment thread
coderabbitai[bot] marked this conversation as resolved.
- name: Confirm Windows PowerShell 5.1
shell: powershell
run: |
$PSVersionTable.PSVersion
if ($PSVersionTable.PSVersion.Major -ne 5) {
throw "Expected Windows PowerShell 5.1 (major version 5), got $($PSVersionTable.PSVersion)"
}
- name: Install Pester if needed
shell: powershell
run: |
if (-not (Get-Module -ListAvailable Pester |
Where-Object { $_.Version -ge [version]'5.0' })) {
Install-Module Pester -MinimumVersion 5.0 -Force -SkipPublisherCheck -Scope CurrentUser
}
Comment thread
kurone-kito marked this conversation as resolved.
Comment thread
kurone-kito marked this conversation as resolved.
- name: Run Pester tests
shell: powershell
run: Invoke-Pester tests/powershell/ -Output Detailed
Comment thread
kurone-kito marked this conversation as resolved.
Outdated

lua-syntax:
name: Lua syntax check
needs: detect-changes
Expand Down
2 changes: 1 addition & 1 deletion tests/powershell/02-cargo.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ BeforeAll {
) '02-cargo.ps1'
}

Describe '02-cargo (Unix pwsh)' -Skip:($IsWindows -eq $true) {
Describe '02-cargo (Unix pwsh)' -Skip:($IsWindows -ne $false) {

BeforeEach {
$script:OriginalHome = $HOME
Expand Down
10 changes: 5 additions & 5 deletions tests/powershell/secret-status.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ Describe 'secret-status.ps1' {
@($obj.rows | Where-Object status -eq 'MISSING').Count | Should -BeGreaterThan 0
}

It 'secret file present with correct mode is OK' -Skip:($IsWindows -eq $true) {
It 'secret file present with correct mode is OK' -Skip:($IsWindows -ne $false) {
$f = Join-Path $HomeDir 'secret.txt'
Set-Content -LiteralPath $f -Value 'secret'
& chmod 600 $f
Expand All @@ -107,7 +107,7 @@ Describe 'secret-status.ps1' {
$r.Output | Should -Match 'OK'
}

It 'secret file with wrong mode is WARN' -Skip:($IsWindows -eq $true) {
It 'secret file with wrong mode is WARN' -Skip:($IsWindows -ne $false) {
$f = Join-Path $HomeDir 'secret-bad.txt'
Set-Content -LiteralPath $f -Value 'secret'
& chmod 644 $f
Expand Down Expand Up @@ -156,7 +156,7 @@ Describe 'secret-status.ps1' {
$r.Output | Should -Match 'ghq root unresolved'
}

It 'env file warns when filename not in .gitignore' -Skip:($IsWindows -eq $true) {
It 'env file warns when filename not in .gitignore' -Skip:($IsWindows -ne $false) {
$repo = Join-Path $HomeDir 'repo-warn'
New-Item -ItemType Directory -Force -Path (Join-Path $repo '.git') | Out-Null
$envPath = Join-Path $repo '.env'
Expand All @@ -175,7 +175,7 @@ Describe 'secret-status.ps1' {
$r.Output | Should -Match 'not in .gitignore'
}

It 'env file OK when gitignore lists filename' -Skip:($IsWindows -eq $true) {
It 'env file OK when gitignore lists filename' -Skip:($IsWindows -ne $false) {
$repo = Join-Path $HomeDir 'repo-ok'
New-Item -ItemType Directory -Force -Path (Join-Path $repo '.git') | Out-Null
$envPath = Join-Path $repo '.env'
Expand Down Expand Up @@ -210,7 +210,7 @@ Describe 'secret-status.ps1' {
}
}

Describe 'secret-status.ps1 DRIFT detection' -Skip:($IsWindows -eq $true) {
Describe 'secret-status.ps1 DRIFT detection' -Skip:($IsWindows -ne $false) {
BeforeAll {
$script:StatePath = Join-Path $HomeDir '.config/chezmoi/secret-deploy-state.json'
$script:OrigHome = $env:HOME
Expand Down
Loading