Skip to content

Commit d6da4f9

Browse files
Honor analyzer report path inputs
1 parent a3a198d commit d6da4f9

4 files changed

Lines changed: 39 additions & 3 deletions

File tree

.github/workflows/Action-Test.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,35 @@ jobs:
152152
-TestResultPath .PSModule/TestResult/PSScriptAnalyzer-TestResult-Report.xml `
153153
-CodeCoveragePath .PSModule/CodeCoverage/PSScriptAnalyzer-CodeCoverage-Report.xml
154154
155+
ActionTestDefaultReportPaths:
156+
name: Action-Test - [Default Report Paths]
157+
runs-on: ubuntu-latest
158+
steps:
159+
- name: Checkout repo
160+
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
161+
with:
162+
persist-credentials: false
163+
164+
- name: Action-Test
165+
uses: ./
166+
id: action-test
167+
with:
168+
Path: src
169+
WorkingDirectory: tests/srcTestRepo
170+
TestResult_Enabled: true
171+
TestResult_OutputFormat: NUnitXml
172+
CodeCoverage_Enabled: true
173+
CodeCoverage_OutputFormat: JaCoCo
174+
CodeCoverage_Path: ../../src/tests/PSScriptAnalyzer/PSScriptAnalyzer.Tests.ps1
175+
176+
- name: Assert report paths
177+
shell: pwsh
178+
run: |
179+
tests/Assert-ReportPaths.ps1 `
180+
-WorkingDirectory tests/srcTestRepo `
181+
-TestResultPath .PSModule/TestResult/PSScriptAnalyzer-TestResult-Report.xml `
182+
-CodeCoveragePath .PSModule/CodeCoverage/PSScriptAnalyzer-CodeCoverage-Report.xml
183+
155184
ActionTestOutputs:
156185
name: Action-Test - [outputs]
157186
runs-on: ubuntu-latest
@@ -185,6 +214,7 @@ jobs:
185214
- ActionTestSrcWithManifest
186215
- ActionTestSrcWithManifestDefault
187216
- ActionTestReportPaths
217+
- ActionTestDefaultReportPaths
188218
- ActionTestOutputs
189219
if: always()
190220
runs-on: ubuntu-latest

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ customize rule selection, severity filtering, and custom rule inclusion.
4141
| `Run_SkipRemainingOnFailure` | Skips remaining tests after failure (None/Run/Container/Block). | false | |
4242
| `CodeCoverage_Enabled` | Enable CodeCoverage. | false | |
4343
| `CodeCoverage_OutputFormat` | Format to use for code coverage report (JaCoCo/CoverageGutters/Cobertura). | false | |
44-
| `CodeCoverage_OutputPath` | Path relative to the current directory where code coverage report is saved. | false | |
44+
| `CodeCoverage_OutputPath` | Path relative to the current directory where code coverage report is saved. | false | `.PSModule/CodeCoverage/PSScriptAnalyzer-CodeCoverage-Report.xml` |
4545
| `CodeCoverage_OutputEncoding` | Encoding of the output file. | false | |
4646
| `CodeCoverage_Path` | Directories or files to be used for code coverage. | false | |
4747
| `CodeCoverage_ExcludeTests` | Exclude tests from code coverage. | false | |
@@ -51,7 +51,7 @@ customize rule selection, severity filtering, and custom rule inclusion.
5151
| `CodeCoverage_SingleHitBreakpoints` | Remove breakpoint when it is hit. | false | |
5252
| `TestResult_Enabled` | Enable TestResult. | false | |
5353
| `TestResult_OutputFormat` | Format to use for test result report (NUnitXml/NUnit2.5/NUnit3/JUnitXml). | false | |
54-
| `TestResult_OutputPath` | Path relative to the current directory where test result report is saved. | false | |
54+
| `TestResult_OutputPath` | Path relative to the current directory where test result report is saved. | false | `.PSModule/TestResult/PSScriptAnalyzer-TestResult-Report.xml` |
5555
| `TestResult_OutputEncoding` | Encoding of the output file. | false | |
5656
| `TestResult_TestSuiteName` | Set the name assigned to the root 'test-suite' element. | false | `PSScriptAnalyzer` |
5757
| `Should_ErrorAction` | Controls if Should throws on error. Use 'Stop' or 'Continue'. | false | |

action.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ inputs:
110110
description: |
111111
Path relative to the current directory where code coverage report is saved.
112112
required: false
113+
default: .PSModule/CodeCoverage/PSScriptAnalyzer-CodeCoverage-Report.xml
113114
CodeCoverage_OutputEncoding:
114115
description: |
115116
Encoding of the output file.
@@ -150,6 +151,7 @@ inputs:
150151
description: |
151152
Path relative to the current directory where test result report is saved.
152153
required: false
154+
default: .PSModule/TestResult/PSScriptAnalyzer-TestResult-Report.xml
153155
TestResult_OutputEncoding:
154156
description: |
155157
Encoding of the output file.
@@ -282,7 +284,7 @@ runs:
282284
Script: ${{ github.action_path }}/src/main.ps1
283285

284286
- name: Invoke-Pester
285-
uses: PSModule/Invoke-Pester@4ff33199141fdf22568990b6107fe3148ae93a1c # v5.1.0
287+
uses: PSModule/Invoke-Pester@c5494aba3c07d7bfd81bdbbc9f301e8fa4a729fb # v5.1.1
286288
id: test
287289
env:
288290
SettingsFilePath: ${{ fromJson(steps.paths.outputs.result).SettingsFilePath }}

tests/Assert-ReportPaths.ps1

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ param(
1111
)
1212

1313
function Assert-ReportPath {
14+
<#
15+
.SYNOPSIS
16+
Confirms that an action report is generated in the fixture artifact directory.
17+
#>
1418
[CmdletBinding()]
1519
param(
1620
[Parameter(Mandatory)]

0 commit comments

Comments
 (0)