Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
125 changes: 119 additions & 6 deletions .github/workflows/validate-windows-ut.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,134 @@ jobs:
pester-test:
name: Pester test
runs-on: windows-latest
permissions:
contents: read
checks: write
issues: write
pull-requests: write
Comment thread
timmy-wright marked this conversation as resolved.
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
shell: powershell
if: (!cancelled())
shell: pwsh
run: |
Invoke-Pester parts/windows/*.tests.ps1 -Passthru

$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
Comment thread
timmy-wright marked this conversation as resolved.

- name: Perform a Pester test from the vhdbuilder/packer/windows/*.tests.ps1 file
if: (!cancelled())
shell: pwsh
run: |
Invoke-Pester vhdbuilder/packer/windows/*.tests.ps1 -Passthru

$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
shell: powershell
if: (!cancelled())
shell: pwsh
run: |
Install-Module -Name powershell-yaml -Force
Invoke-Pester staging/cse/windows/*.tests.ps1 -Passthru

$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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ out/
build/

test/junit/
coverage/
test-results/
test/e2e/kubernetes/junit.xml
_logs/
*.swp
Expand Down
2 changes: 2 additions & 0 deletions staging/cse/windows/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@

credentialProvider.tests.suites/
Loading
Loading