Skip to content

refactor: Switch certutil to primary export method with PowerShell fa… #11

refactor: Switch certutil to primary export method with PowerShell fa…

refactor: Switch certutil to primary export method with PowerShell fa… #11

Workflow file for this run

name: Pester Tests
on:
push:
branches:
- main
- testing
- test/**
paths:
- "Scripts/**"
- "Tests/**"
- "Modules/**"
- ".github/workflows/pester-tests.yml"
pull_request:
branches:
- main
- testing
paths:
- "Scripts/**"
- "Tests/**"
- "Modules/**"
workflow_dispatch:
jobs:
test:
name: Run Pester Tests
runs-on: [self-hosted, linux]
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Install PowerShell Core
run: |
if ! command -v pwsh &> /dev/null; then
sudo snap install powershell --classic
fi
- name: Verify PowerShell Version
shell: pwsh
run: $PSVersionTable.PSVersion
- name: Install Pester
shell: pwsh
run: |
$ProgressPreference = 'SilentlyContinue'
Install-Module -Name Pester -RequiredVersion 5.7.1 -Force -SkipPublisherCheck
Get-Module -Name Pester -ListAvailable
- name: Run All Tests
shell: pwsh
run: |
$testPath = 'Tests/'
$resultsFile = 'test-results.xml'
# Get all test files except integration tests
$testFiles = @(Get-ChildItem -Path $testPath -Include '*.Tests.ps1' -Recurse |
Where-Object { $_.FullName -notmatch '(Integration|Network)' })
$pesterConfig = @{
Path = $testFiles
OutputFile = $resultsFile
OutputFormat = 'NUnitXml'
ExcludeTag = @('IntegrationNotImplemented')
PassThru = $true
WarningAction = 'SilentlyContinue'
}
$results = Invoke-Pester @pesterConfig
Write-Host "`n========== Test Summary ==========" -ForegroundColor Cyan
Write-Host "Total Tests: $($results.FailedCount + $results.PassedCount)"
Write-Host "Passed: $($results.PassedCount)" -ForegroundColor Green
Write-Host "Failed: $($results.FailedCount)" -ForegroundColor $(if ($results.FailedCount -gt 0) { 'Red' } else { 'Green' })
Write-Host "=================================" -ForegroundColor Cyan
if ($results.FailedCount -gt 0) {
exit 1
}
- name: Upload Test Results
if: always()
uses: actions/upload-artifact@v4
with:
name: pester-test-results
path: test-results.xml
retention-days: 30
- name: Publish Test Report
if: always()
uses: EnricoMi/publish-unit-test-result-action/linux@v2
with:
files: test-results.xml
check_name: Test Results (PowerShell)
comment_mode: always
test-summary:
name: Complete Test Suite Summary
runs-on: ubuntu-latest
needs: test
if: always()
steps:
- name: Check Test Results
run: |
if [ "${{ needs.test.result }}" == "failure" ]; then
echo "❌ Tests failed - Build cannot proceed"
exit 1
else
echo "✅ All tests passed successfully"
fi