-
Notifications
You must be signed in to change notification settings - Fork 263
142 lines (120 loc) · 5.45 KB
/
validate-windows-ut.yml
File metadata and controls
142 lines (120 loc) · 5.45 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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
name: Windows Powershell Unit Test
on: pull_request
# To run these tests on a Windows machine, you can use the commands below. However, most people have their git repo
# stored in WSL. So you'll need to change directory to whereever you have the repo checked out in WSL. Something like this:
# cd \\wsl$\Ubuntu\home\tim\git\AgentBaker
jobs:
pester-test:
name: Pester test
runs-on: windows-latest
permissions:
contents: read
checks: write
issues: write
pull-requests: write
steps:
- name: Check out repository code
uses: actions/checkout@v6
with:
fetch-depth: 1
- name: Setup
shell: pwsh
run: |
Get-Module -ListAvailable -Name Pester
if (-not (Test-Path test-results)) { New-Item -ItemType Directory -Force test-results | Out-Null }
if (-not (Test-Path coverage)) { New-Item -ItemType Directory -Force coverage | Out-Null }
Install-Module -Name powershell-yaml -Force
- name: Perform a Pester test from the parts/windows/*.tests.ps1 file
if: (!cancelled())
shell: pwsh
run: |
$config = New-PesterConfiguration
$config.Run.Path = "parts/windows/"
$config.Run.PassThru = $true
#$config.CodeCoverage.CoveragePercentTarget = 80
$config.CodeCoverage.OutputPath = "coverage/parts_windows.xml"
$config.CodeCoverage.Enabled = $true
$config.CodeCoverage.ExcludeTests = $true
$config.CodeCoverage.OutputFormat = "Cobertura"
$config.TestResult.Enabled = $true
$config.TestResult.OutputFormat = "JUnitXml"
$config.TestResult.OutputPath = "test-results/parts_windows.xml"
# Because you're looking here, you might want to know how to run a single test. Add "-Tag Focus" to
# the test, then set this filter to only run tests with that tag. Don't forget to remove the tag and
# filter when you're done!
# $config.Filter.Tag = "Focus"
$result = Invoke-Pester -Configuration $config
$result
$result.Failed | Format-Table
- name: Perform a Pester test from the vhdbuilder/packer/windows/*.tests.ps1 file
if: (!cancelled())
shell: pwsh
run: |
$config = New-PesterConfiguration
$config.Run.Path = "vhdbuilder/packer/windows/"
$config.Run.PassThru = $true
#$config.CodeCoverage.CoveragePercentTarget = 80
$config.CodeCoverage.OutputPath = "coverage/vhdbuilder_packer_windows.xml"
$config.CodeCoverage.Enabled = $true
$config.CodeCoverage.ExcludeTests = $true
$config.CodeCoverage.OutputFormat = "Cobertura"
$config.TestResult.Enabled = $true
$config.TestResult.OutputFormat = "JUnitXml"
$config.TestResult.OutputPath = "test-results/vhdbuilder_packer_windows.xml"
# Because you're looking here, you might want to know how to run a single test. Add "-Tag Focus" to
# the test, then set this filter to only run tests with that tag. Don't forget to remove the tag and
# filter when you're done!
# $config.Filter.Tag = "Focus"
$result = Invoke-Pester -Configuration $config
$result
$result.Failed | Format-Table
- name: Perform a Pester test from the staging/cse/windows/*.tests.ps1 file
if: (!cancelled())
shell: pwsh
run: |
$config = New-PesterConfiguration
$config.Run.Path = "staging/cse/windows/"
$config.Run.PassThru = $true
#$config.CodeCoverage.CoveragePercentTarget = 80
$config.CodeCoverage.OutputPath = "coverage/staging_cse_windows.xml"
$config.CodeCoverage.Enabled = $true
$config.CodeCoverage.ExcludeTests = $true
$config.CodeCoverage.OutputFormat = "Cobertura"
$config.TestResult.Enabled = $true
$config.TestResult.OutputFormat = "JUnitXml"
$config.TestResult.OutputPath = "test-results/staging_cse_windows.xml"
# Because you're looking here, you might want to know how to run a single test. Add "-Tag Focus" to
# the test, then set this filter to only run tests with that tag. Don't forget to remove the tag and
# filter when you're done!
# $config.Filter.Tag = "Focus"
$result = Invoke-Pester -Configuration $config
$result
$result.Failed | Format-Table
- name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action/windows@v2
if: (!cancelled())
with:
files: |
test-results/parts_windows.xml
test-results/vhdbuilder_packer_windows.xml
test-results/staging_cse_windows.xml
# coverage upload is linux runner only - need to find a windows way of doing this.
# - name: Code Coverage Report
# uses: irongut/CodeCoverageSummary@v1.3.0
# if: (!cancelled())
# with:
# filename: coverage/*.xml
# badge: true
# fail_below_min: false
# format: markdown
# hide_branch_rate: false
# hide_complexity: true
# indicators: true
# output: both
# thresholds: '60 80'
# - name: Add Coverage PR Comment
# uses: marocchino/sticky-pull-request-comment@v2
# if: github.event_name == 'pull_request'
# with:
# recreate: true
# path: code-coverage-results.md