Skip to content

Run Pester Tests

Run Pester Tests #66

Workflow file for this run

name: Run Pester Tests
on:
workflow_dispatch:
pull_request:
branches: [ main ]
types: [ opened, synchronize, reopened ]
jobs:
test:
name: Validate module integrity
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macOS-latest]
steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: Install PowerShell dependencies
shell: pwsh
run: |
Set-PSRepository PSGallery -InstallationPolicy Trusted
Install-Module powershell-yaml, PSScriptAnalyzer -Force
- name: Run PSScriptAnalyzer
shell: pwsh
run: |
Invoke-ScriptAnalyzer -Path .\src -Settings PSGallery -Recurse -ReportSummary -Severity Error
- name: Run Tests using Windows PowerShell
if: runner.os == 'Windows'
shell: powershell
run: |
# Reuse downloaded modules from pwsh
$env:PSModulePath += ";$HOME\Documents\PowerShell\Modules"
$config = New-PesterConfiguration -Hashtable @{TestResult = @{Enabled = $true }; Run = @{Exit = $false }; Output = @{ Verbosity = 'Detailed' }}
Invoke-Pester -Configuration $config
- name: Run Tests using PowerShell
shell: pwsh
run: |
$config = New-PesterConfiguration -Hashtable @{TestResult = @{Enabled = $true }; Run = @{Exit = $false }; Output = @{ Verbosity = 'Detailed' }}
Invoke-Pester -Configuration $config
- name: Upload test results
uses: actions/upload-artifact@v3
with:
name: Pester-Tests
path: testResults.xml