--- name: CI-PowerShell (called) permissions: {} on: workflow_call: jobs: test: name: Pester permissions: contents: read runs-on: windows-2022 steps: - name: Checkout uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - name: Run Pester tests id: test shell: powershell run: | New-Item -ItemType Directory -Path ./build/reports -Force | Out-Null Import-Module Pester -RequiredVersion 5.9.0 -Force $config = New-PesterConfiguration $config.Run.Path = "./tests/scripts" $config.Run.Exit = $true $config.Output.Verbosity = "Detailed" $config.TestResult.Enabled = $true $config.TestResult.OutputFormat = "JUnitXml" $config.TestResult.OutputPath = "./build/reports/junit.xml" $config.CodeCoverage.Enabled = $true $config.CodeCoverage.Path = @( Get-ChildItem -Path "./scripts/windows/*.ps1" | Select-Object -ExpandProperty FullName ) $config.CodeCoverage.OutputFormat = "Cobertura" $config.CodeCoverage.OutputPath = "./build/reports/coverage.xml" Invoke-Pester -Configuration $config - name: Upload report artifact if: >- always() && (steps.test.outcome == 'success' || steps.test.outcome == 'failure') uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 with: name: reports-PowerShell path: build/reports if-no-files-found: error