Skip to content

Commit 1a5b9f3

Browse files
🩹 [Patch]: Configure Pester artifact report paths
1 parent 2857ef3 commit 1a5b9f3

2 files changed

Lines changed: 10 additions & 11 deletions

File tree

.github/actions/Test-PSModule/action.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ runs:
279279
run: ${{ github.action_path }}/src/main.ps1
280280

281281
- name: Invoke-Pester
282-
uses: PSModule/Invoke-Pester@b62062021d6f1182663f92f97de2cbcd75c08cfd # PR 78
282+
uses: PSModule/Invoke-Pester@282916d4de0c6d9b4714ccd6d0297230aa616ae6 # PR 78
283283
id: test
284284
env:
285285
LocalTestPath: ${{ steps.paths.outputs.LocalTestPath }}
@@ -292,7 +292,6 @@ runs:
292292
GitHubVersion: ${{ inputs.Version }}
293293
GitHubPrerelease: ${{ inputs.Prerelease }}
294294
WorkingDirectory: ${{ inputs.WorkingDirectory }}
295-
OutputDirectory: ${{ inputs.WorkingDirectory }}/.PSModule
296295
Path: ${{ steps.paths.outputs.TestPath }}
297296
StepSummary_Mode: ${{ inputs.StepSummary_Mode }}
298297
StepSummary_ShowTestOverview: ${{ inputs.StepSummary_ShowTestOverview }}
@@ -313,7 +312,7 @@ runs:
313312
Filter_FullName: ${{ inputs.Filter_FullName }}
314313
CodeCoverage_Enabled: ${{ inputs.CodeCoverage_Enabled }}
315314
CodeCoverage_OutputFormat: ${{ inputs.CodeCoverage_OutputFormat }}
316-
CodeCoverage_OutputPath: ${{ inputs.CodeCoverage_OutputPath }}
315+
CodeCoverage_OutputPath: ${{ inputs.WorkingDirectory }}/.PSModule/CodeCoverage/PSModuleTest-${{ inputs.Settings }}-${{ runner.os }}-CodeCoverage-Report.xml
317316
CodeCoverage_OutputEncoding: ${{ inputs.CodeCoverage_OutputEncoding }}
318317
CodeCoverage_Path: ${{ inputs.CodeCoverage_Path }}
319318
CodeCoverage_ExcludeTests: ${{ inputs.CodeCoverage_ExcludeTests }}
@@ -323,7 +322,7 @@ runs:
323322
CodeCoverage_SingleHitBreakpoints: ${{ inputs.CodeCoverage_SingleHitBreakpoints }}
324323
TestResult_Enabled: ${{ inputs.TestResult_Enabled }}
325324
TestResult_OutputFormat: ${{ inputs.TestResult_OutputFormat }}
326-
TestResult_OutputPath: ${{ inputs.TestResult_OutputPath }}
325+
TestResult_OutputPath: ${{ inputs.WorkingDirectory }}/.PSModule/TestResult/PSModuleTest-${{ inputs.Settings }}-${{ runner.os }}-TestResult-Report.xml
327326
TestResult_OutputEncoding: ${{ inputs.TestResult_OutputEncoding }}
328327
TestResult_TestSuiteName: PSModuleTest-${{ inputs.Settings }}-${{ runner.os }}
329328
Should_ErrorAction: ${{ inputs.Should_ErrorAction }}

.github/workflows/Test-ModuleLocal.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ jobs:
6969
"path=$path" >> $env:GITHUB_OUTPUT
7070
7171
- name: Test-ModuleLocal
72-
uses: PSModule/Invoke-Pester@b62062021d6f1182663f92f97de2cbcd75c08cfd # PR 78
72+
uses: PSModule/Invoke-Pester@282916d4de0c6d9b4714ccd6d0297230aa616ae6 # PR 78
7373
with:
7474
Debug: ${{ fromJson(inputs.Settings).Debug }}
7575
Verbose: ${{ fromJson(inputs.Settings).Verbose }}
@@ -78,15 +78,16 @@ jobs:
7878
GitHubPrerelease: ${{ fromJson(inputs.Settings).Prerelease }}
7979
TestResult_TestSuiteName: ${{ matrix.TestName }}-${{ matrix.OSName }}
8080
TestResult_Enabled: true
81+
TestResult_OutputPath: ${{ fromJson(inputs.Settings).WorkingDirectory }}/.PSModule/TestResult/${{ matrix.TestName }}-${{ matrix.OSName }}-TestResult-Report.xml
8182
CodeCoverage_Enabled: true
8283
Output_Verbosity: Detailed
8384
CodeCoverage_OutputFormat: JaCoCo
85+
CodeCoverage_OutputPath: ${{ fromJson(inputs.Settings).WorkingDirectory }}/.PSModule/CodeCoverage/${{ matrix.TestName }}-${{ matrix.OSName }}-CodeCoverage-Report.xml
8486
CodeCoverage_CoveragePercentTarget: 0
8587
Filter_ExcludeTag: Flaky
8688
Path: ${{ matrix.TestPath }}
8789
Run_Path: ${{ steps.import-module.outputs.path }}
8890
WorkingDirectory: ${{ fromJson(inputs.Settings).WorkingDirectory }}
89-
OutputDirectory: ${{ fromJson(inputs.Settings).WorkingDirectory }}/.PSModule
9091
Prescript: | # This is to speed up module loading in Pester.
9192
Install-PSResource -Repository PSGallery -TrustRepository -Name PSCustomObject
9293
Import-Module -Name '${{ steps.import-module.outputs.name }}' -RequiredVersion '${{ fromJson(inputs.Settings).Publish.Module.Resolution.Version }}'
@@ -96,14 +97,13 @@ jobs:
9697
working-directory: ${{ fromJson(inputs.Settings).WorkingDirectory }}
9798
run: |
9899
$artifactPaths = @(
99-
'.PSModule/.temp'
100-
'.PSModule/TestResult'
101-
'.PSModule/CodeCoverage'
100+
'.PSModule/TestResult/${{ matrix.TestName }}-${{ matrix.OSName }}-TestResult-Report.xml'
101+
'.PSModule/CodeCoverage/${{ matrix.TestName }}-${{ matrix.OSName }}-CodeCoverage-Report.xml'
102102
)
103103
104104
foreach ($artifactPath in $artifactPaths) {
105-
if (-not (Test-Path -Path $artifactPath -PathType Container)) {
106-
throw "Expected Pester artifact directory at [$artifactPath]."
105+
if (-not (Test-Path -Path $artifactPath -PathType Leaf)) {
106+
throw "Expected Pester report at [$artifactPath]."
107107
}
108108
}
109109

0 commit comments

Comments
 (0)