Skip to content

Commit 0366d48

Browse files
committed
Create a simple Pester summary
1 parent 53d6b56 commit 0366d48

1 file changed

Lines changed: 25 additions & 28 deletions

File tree

.github/workflows/build.yml

Lines changed: 25 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ on:
88

99
permissions:
1010
contents: write # to tag the repository
11-
checks: write # to create the check runs results (from zyborg/pester-tests-report)
11+
checks: write # to create the check runs results
1212

1313
jobs:
1414
build:
@@ -72,19 +72,19 @@ jobs:
7272
os: [ windows-latest, ubuntu-latest, macos-latest ]
7373
steps:
7474
- name: Download build.requires.psd1
75-
uses: actions/download-artifact@v4
75+
uses: actions/download-artifact@v8
7676
with:
7777
name: build.requires.psd1
78-
- name: Download Pester Tests
79-
uses: actions/download-artifact@v4
80-
with:
81-
name: PesterTests
82-
path: PesterTests
8378
- name: Download Build Output
84-
uses: actions/download-artifact@v4
79+
uses: actions/download-artifact@v8
8580
with:
8681
name: ModuleBuilder
8782
path: output/ModuleBuilder # /home/runner/work/ModuleBuilder/ModuleBuilder/output/ModuleBuilder
83+
- name: Download Pester Tests
84+
uses: actions/download-artifact@v8
85+
with:
86+
name: PesterTests
87+
path: PesterTests
8888
- name: Install Output Modules
8989
shell: pwsh
9090
run: | # PowerShell
@@ -103,31 +103,28 @@ jobs:
103103
Write-Host "PSModulePath:"
104104
$Env:PSModulePath -split ([IO.Path]::PathSeparator) | Out-Host
105105
106+
# Avoid installing ModuleBuilder with ModuleFast, so there's only one copy
106107
@(Get-Content build.requires.psd1)
107108
| Where { $_ -notmatch "ModuleBuilder"}
108109
| Set-Content build.requires.psd1
109110
- name: ⚡ Install Required Modules
110111
uses: JustinGrote/ModuleFast-action@v0.0.1
111-
112-
- name: Invoke Pester Tests
113-
id: pester
114-
uses: zyborg/pester-tests-report@v1
115-
with:
116-
# include_paths: tests
117-
# exclude_paths: tests/powershell1,tests/powershell2
118-
# exclude_tags: skip_ci
119-
report_name: ${{ matrix.os }}_validation
120-
report_title: My Module Tests
121-
github_token: ${{ secrets.GITHUB_TOKEN }}
122-
tests_fail_step: true
123-
skip_check_run: false # Our test results are too large
124-
- name: Summarize test results
112+
- name: Invoke-Pester
125113
shell: pwsh
126114
run: | # PowerShell
127-
Write-ActionInfo 'Total Tests Executed...: ${{ steps.pester.outputs.total_count }}'
128-
Write-ActionInfo 'Total Tests Passed.....: ${{ steps.pester.outputs.passed_count }}'
129-
if (${{ steps.pester.outputs.failed_count }} -gt 0) {
130-
Set-ActionFailed 'Total Tests Failed.....: ${{ steps.pester.outputs.failed_count }}'
131-
} else {
132-
Write-ActionInfo 'Total Tests Failed.....: ${{ steps.pester.outputs.failed_count }}'
115+
# For the cross-platform matrix we don't need to do coverage or anything complicated
116+
$Result = Invoke-Pester . -PassThru
117+
@(
118+
"## Pester Tests for ${{ matrix.os }}"
119+
""
120+
$Result.Duration.ToString()
121+
"| Total | Passed | Failed |"
122+
"|------:|-------:|-------:|"
123+
"| $($Result.TotalCount) | $($Result.PassedCount) | $($Result.FailedCount) |"
124+
""
125+
"| Duration | Total | Passed | Failed | Skipped | Name |"
126+
"|---------:|------:|-------:|-------:|--------:|:-----|"
127+
@($Result.Containers).ForEach{
128+
"| $($_.Duration) | $($_.TotalCount) | $($_.PassedCount) | $($_.FailedCount) | $($_.SkippedCount) | $($_.Name) |"
133129
}
130+
) | Out-File -FilePath $env:GITHUB_STEP_SUMMARY

0 commit comments

Comments
 (0)