Skip to content

Test-Actions - [Upgrade Process-PSModule to Pester 6.1 #519] by @MariusStorhaug #86

Test-Actions - [Upgrade Process-PSModule to Pester 6.1 #519] by @MariusStorhaug

Test-Actions - [Upgrade Process-PSModule to Pester 6.1 #519] by @MariusStorhaug #86

Workflow file for this run

name: Test-Actions
run-name: "Test-Actions - [${{ github.event.pull_request.title }} #${{ github.event.pull_request.number }}] by @${{ github.actor }}"
on:
workflow_dispatch:
pull_request:
paths:
- '.github/actions/**'
- '.github/workflows/Test-Actions.yml'
schedule:
- cron: '0 0 * * *'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
TestActions:
name: Test actions
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Install-PSModule
uses: ./.github/actions/Install-PSModule
- name: Install test dependencies
shell: pwsh
run: |
Install-PSResource -Name Pester -Version '[6.1.0,7.0.0)' -Repository PSGallery -TrustRepository
Install-PSResource -Name PSSemVer -Repository PSGallery -TrustRepository
Install-PSResource -Name GitHub -Version '[0.43.1,0.44.0)' -Repository PSGallery -TrustRepository
- name: Run action unit tests
shell: pwsh
run: |
$configuration = New-PesterConfiguration
$configuration.Run.Shuffle = $true
$configuration.Run.ShuffleSeed = 42
$configuration.Run.Parallel = $true
$configuration.Run.ParallelThrottleLimit = 2
$configuration.Debug.ShowStartMarkers = $true
$expectedOptions = @{
'Run.Shuffle' = $configuration.Run.Shuffle.Value
'Run.ShuffleSeed' = $configuration.Run.ShuffleSeed.Value -eq 42
'Run.Parallel' = $configuration.Run.Parallel.Value
'Run.ParallelThrottleLimit' = $configuration.Run.ParallelThrottleLimit.Value -eq 2
'Debug.ShowStartMarkers' = $configuration.Debug.ShowStartMarkers.Value
}
foreach ($option in $expectedOptions.GetEnumerator()) {
if (-not $option.Value) {
throw "Pester 6.1 configuration option [$($option.Key)] was not applied."
}
}
$testPaths = Get-ChildItem -Path '.github/actions' -Directory |
ForEach-Object { Join-Path -Path $_.FullName -ChildPath 'tests' } |
Where-Object { Test-Path -Path $_ }
if (-not $testPaths) {
throw 'No action test folders were found under .github/actions.'
}
$configuration = New-PesterConfiguration
$configuration.Run.Path = $testPaths
$configuration.Run.Throw = $true
$configuration.Output.Verbosity = 'Detailed'
Invoke-Pester -Configuration $configuration