diff --git a/.github/workflows/powershell.yml b/.github/workflows/powershell.yml index 2f7e692..0ddfaba 100644 --- a/.github/workflows/powershell.yml +++ b/.github/workflows/powershell.yml @@ -52,7 +52,7 @@ jobs: run: ./build.ps1 build ${{ steps.nbgv.outputs.VersionMajor }} ${{ steps.nbgv.outputs.VersionMinor }} ${{ steps.nbgv.outputs.BuildNumber }} ${{ steps.nbgv.outputs.VersionRevision }} ${{ steps.nbgv.outputs.PrereleaseVersionNoLeadingHyphen }} - name: Store build output - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: build path: | @@ -76,15 +76,30 @@ jobs: - uses: actions/checkout@v4 - name: Download build output - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: name: build path: publish + - name: Install Utils + shell: pwsh + run: | + apt-get update + apt-get install curl jq -y + + - uses: testspace-com/setup-testspace@v1 + with: + domain: ${{github.repository_owner}} + - name: Test shell: pwsh run: ./build.ps1 test + - name: Publish Results to Testspace + run: testspace "[v${{ matrix.pwshv }}]testResults.xml" + + if: always() + test5: permissions: contents: read # for actions/checkout to fetch code @@ -98,15 +113,23 @@ jobs: fetch-depth: 0 - name: Download build output - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: name: build path: publish + - uses: testspace-com/setup-testspace@v1 + with: + domain: ${{github.repository_owner}} + - name: Test shell: powershell run: ./build.ps1 test + - name: Publish Results to Testspace + run: testspace "[v5.1]testResults.xml" + if: always() + publish: permissions: contents: read # for actions/checkout to fetch code @@ -121,7 +144,7 @@ jobs: - uses: actions/checkout@v4 - name: Download build output - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: name: build path: publish diff --git a/README.md b/README.md index fd080a1..6f200b0 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,11 @@ You can use this to automatically maintain and synchronize documentation in mult ## CI Status -[![PowerShell](https://github.com/cdhunt/Format-Document/actions/workflows/powershell.yml/badge.svg)](https://github.com/cdhunt/Format-Document/actions/workflows/powershell.yml) +![GitHub Workflow Status (with event)](https://img.shields.io/github/actions/workflow/status/cdhunt/Format-Document/powershell.yml?style=flat&logo=github) +[![Testspace pass ratio](https://img.shields.io/testspace/pass-ratio/cdhunt/cdhunt%3AFormat-Document/main)](https://cdhunt.testspace.com/projects/67973/spaces) +[![PowerShell Gallery](https://img.shields.io/powershellgallery/v/Format-Document.svg?color=%235391FE&label=PowerShellGallery&logo=powershell&style=flat)](https://www.powershellgallery.com/packages/Format-Document) + +![Build history](https://buildstats.info/github/chart/cdhunt/Format-Document?branch=main) ## Install @@ -21,6 +25,8 @@ You can use this to automatically maintain and synchronize documentation in mult `Install-Module -Name Format-Document` or `Install-PSResource -Name Format-Document` +![PowerShell Gallery](https://img.shields.io/powershellgallery/dt/httpunitps?color=%235391FE&style=flat) + ## Docs [Full Docs](docs) diff --git a/build.ps1 b/build.ps1 index 3ac9d0b..7b7fb3f 100644 --- a/build.ps1 +++ b/build.ps1 @@ -125,11 +125,20 @@ function Build { function Test { param () - if ($null -eq (Get-Module Pester -ListAvailable)) { - Install-Module -Name Pester -Confirm:$false -Force + if ($null -eq (Get-Module Pester -ListAvailable | Where-Object { [version]$_.Version -ge [version]"5.5.0" })) { + Install-Module -Name Pester -MinimumVersion 5.5.0 -Confirm:$false -Force } - Invoke-Pester -Path test -Output detailed + $config = New-PesterConfiguration -Hashtable @{ + Run = @{ Path = "test" } + TestResult = @{ + Enabled = $true + OutputFormat = "NUnitXml" + } + Output = @{ Verbosity = "Detailed" } + } + + Invoke-Pester -Configuration $config } diff --git a/src/public/New-Document.ps1 b/src/public/New-Document.ps1 index 6371fa5..cbbf9c1 100644 --- a/src/public/New-Document.ps1 +++ b/src/public/New-Document.ps1 @@ -11,7 +11,7 @@ function New-Document { #> [CmdletBinding()] param ( - [Parameter(Mandatory, Position = 0)] + [Parameter(Mandatory, Position = 0, ValueFromPipeline)] [scriptblock] $Document, diff --git a/test/Format-Document.Tests.ps1 b/test/Format-Document.Tests.ps1 index 015dc20..c1a6d19 100644 --- a/test/Format-Document.Tests.ps1 +++ b/test/Format-Document.Tests.ps1 @@ -132,6 +132,19 @@ Describe 'Format-Document' { } } + + Context 'Content by Pipeline' { + It 'New-Document should accept a scriptblock by pipeline' { + $doc = { + H1 "My Text" + } + $resultMd = $doc | New-Document + $resultHtml = $doc | New-Document -Type 'Html/Bootstrap' + + $resultMd | Should -Contain '# My Text' + $resultHtml | Should -Contain '