-
-
Notifications
You must be signed in to change notification settings - Fork 32
85 lines (72 loc) · 2.36 KB
/
Copy pathPester.yml
File metadata and controls
85 lines (72 loc) · 2.36 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
85
name: Pester Tests
on:
push:
branches:
- main
- dev
- master
pull_request:
branches:
- main
- dev
- master
workflow_dispatch:
jobs:
test:
name: Pester Tests - ${{ matrix.os }} - ${{ matrix.shell }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [windows-latest]
shell: [pwsh]
include:
- os: windows-latest
shell: powershell
exclude:
- os: ubuntu-latest
shell: powershell
- os: macos-latest
shell: powershell
defaults:
run:
shell: ${{ matrix.shell }}
steps:
- name: Checkout repository
uses: actions/checkout@v7
- name: Set up PowerShell Gallery
run: |
Set-PSRepository -Name PSGallery -InstallationPolicy Trusted
- name: Install Pester
run: |
Install-Module -Name Pester -MinimumVersion 5.0.0 -Repository PSGallery -Force -AllowClobber -Scope CurrentUser
- name: Install PScribo
run: |
Install-Module -Name PScribo -MinimumVersion 0.11.1 -Repository PSGallery -Force -AllowClobber -Scope CurrentUser
- name: Install PSScriptAnalyzer
run: |
Install-Module -Name PSScriptAnalyzer -MinimumVersion 1.0.0 -Repository PSGallery -Force -AllowClobber -Scope CurrentUser
- name: Install AsBuiltReport.Core
run: |
Install-Module -Name AsBuiltReport.Core -MinimumVersion 1.6.2 -Repository PSGallery -Force -AllowClobber -Scope CurrentUser
- name: Run Pester Tests
run: |
$CodeCoverageParam = @{}
$OutputFormatParam = @{ OutputFormat = 'NUnitXml' }
.\Tests\Invoke-Tests.ps1 @CodeCoverageParam @OutputFormatParam
- name: Upload test results
if: always()
uses: actions/upload-artifact@v7
with:
name: test-results-${{ matrix.os }}-${{ matrix.shell }}
path: Tests/testResults.xml
retention-days: 30
- name: Upload code coverage to Codecov
if: matrix.os == 'windows-latest' && matrix.shell == 'pwsh'
uses: codecov/codecov-action@v5
with:
files: ./Tests/coverage.xml
flags: unit
name: codecov-${{ matrix.os }}-${{ matrix.shell }}
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: false