Skip to content

Commit 2a53423

Browse files
committed
Update Pester tests
- Update Pester tests to run on PS 5.1 & 7 across Windows, Linux & macOS
1 parent 84cc00a commit 2a53423

File tree

1 file changed

+19
-6
lines changed

1 file changed

+19
-6
lines changed

.github/workflows/Pester.yml

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,36 +12,49 @@ on:
1212

1313
jobs:
1414
test:
15-
runs-on: windows-latest
15+
runs-on: ${{ matrix.os }}
16+
strategy:
17+
fail-fast: false
18+
matrix:
19+
os: [windows-latest, ubuntu-latest, macos-latest]
20+
psversion: [pwsh, powershell]
21+
exclude:
22+
# PowerShell 5.1 (powershell) is only available on Windows
23+
- os: ubuntu-latest
24+
psversion: powershell
25+
- os: macos-latest
26+
psversion: powershell
27+
28+
name: Test on ${{ matrix.os }} with ${{ matrix.psversion == 'pwsh' && 'PowerShell 7.x' || 'PowerShell 5.1' }}
1629

1730
steps:
1831
- name: Checkout code
1932
uses: actions/checkout@v4
2033

2134
- name: Install required modules
22-
shell: pwsh
35+
shell: ${{ matrix.psversion }}
2336
run: |
2437
Set-PSRepository -Name PSGallery -InstallationPolicy Trusted
2538
Install-Module -Name Pester -MinimumVersion 5.0.0 -Force -SkipPublisherCheck
2639
Install-Module -Name PScribo -MinimumVersion 0.11.1 -Force
2740
2841
- name: Run Pester tests
29-
shell: pwsh
42+
shell: ${{ matrix.psversion }}
3043
run: |
3144
.\Tests\Invoke-Tests.ps1 -CodeCoverage -OutputFormat NUnitXml
3245
3346
- name: Upload test results
3447
if: always()
3548
uses: actions/upload-artifact@v4
3649
with:
37-
name: test-results
50+
name: test-results-${{ matrix.os }}-${{ matrix.psversion }}
3851
path: testResults.xml
3952

4053
- name: Upload code coverage
4154
if: always()
4255
uses: actions/upload-artifact@v4
4356
with:
44-
name: code-coverage
57+
name: code-coverage-${{ matrix.os }}-${{ matrix.psversion }}
4558
path: coverage.xml
4659

4760
- name: Upload coverage reports to Codecov
@@ -51,7 +64,7 @@ jobs:
5164
token: ${{ secrets.CODECOV_TOKEN }}
5265
slug: AsBuiltReport/AsBuiltReport.Core
5366
files: ./coverage.xml
54-
flags: unittests
67+
flags: unittests-${{ matrix.os }}-${{ matrix.psversion }}
5568
fail_ci_if_error: false
5669

5770
analyze:

0 commit comments

Comments
 (0)