-
Notifications
You must be signed in to change notification settings - Fork 12
54 lines (45 loc) · 1.65 KB
/
pester.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
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@v4
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@v4
with:
name: Pester-Tests-${{ matrix.os }}
path: testResults-.xml