-
-
Notifications
You must be signed in to change notification settings - Fork 27
84 lines (72 loc) · 2.65 KB
/
Pester.yml
File metadata and controls
84 lines (72 loc) · 2.65 KB
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
name: Pester Tests
permissions:
contents: read
on:
push:
branches: [main, dev, master]
pull_request:
branches: [main, dev, master]
workflow_dispatch:
jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [windows-latest, ubuntu-latest, macos-latest]
psversion: [pwsh, powershell]
exclude:
# PowerShell 5.1 (powershell) is only available on Windows
- os: ubuntu-latest
psversion: powershell
- os: macos-latest
psversion: powershell
name: Test on ${{ matrix.os }} with ${{ matrix.psversion == 'pwsh' && 'PowerShell 7.x' || 'PowerShell 5.1' }}
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Install required modules (PowerShell 7.x)
if: matrix.psversion == 'pwsh'
shell: pwsh
run: |
Set-PSRepository -Name PSGallery -InstallationPolicy Trusted
Install-Module -Name Pester -MinimumVersion 5.0.0 -Force -SkipPublisherCheck
Install-Module -Name PScribo -MinimumVersion 0.11.1 -Force
- name: Install required modules (PowerShell 5.1)
if: matrix.psversion == 'powershell'
shell: powershell
run: |
Set-PSRepository -Name PSGallery -InstallationPolicy Trusted
Install-Module -Name Pester -MinimumVersion 5.0.0 -Force -SkipPublisherCheck
Install-Module -Name PScribo -MinimumVersion 0.11.1 -Force
- name: Run Pester tests (PowerShell 7.x)
if: matrix.psversion == 'pwsh'
shell: pwsh
run: |
.\Tests\Invoke-Tests.ps1 -CodeCoverage -OutputFormat NUnitXml
- name: Run Pester tests (PowerShell 5.1)
if: matrix.psversion == 'powershell'
shell: powershell
run: |
.\Tests\Invoke-Tests.ps1 -CodeCoverage -OutputFormat NUnitXml
- name: Upload test results
if: always()
uses: actions/upload-artifact@v4
with:
name: test-results-${{ matrix.os }}-${{ matrix.psversion }}
path: testResults.xml
- name: Upload code coverage
if: always() && matrix.os == 'windows-latest' && matrix.psversion == 'pwsh'
uses: actions/upload-artifact@v4
with:
name: code-coverage
path: coverage.xml
- name: Upload coverage reports to Codecov
if: always() && matrix.os == 'windows-latest' && matrix.psversion == 'pwsh'
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
slug: AsBuiltReport/AsBuiltReport.Core
files: ./coverage.xml
flags: unittests
fail_ci_if_error: false