-
Notifications
You must be signed in to change notification settings - Fork 0
v0.2.0: Add CI (pwsh + Pester) #19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
blindzero
merged 4 commits into
main
from
issues/3-CI-base-GitHub-Actions-matrix-pwsh-7-+-Pester
Dec 28, 2025
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
30b09f9
adding test results & artifacts to gitignore
blindzero 5c0e27a
tests: run-tests.ps1 helper without strict mode to reduce false posit…
blindzero ee1e0b7
ci: add github actions workflow for pwsh + pester on all platforms + …
blindzero 2221b26
fixing permissions in CI for contents and actions
blindzero File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| name: CI | ||
|
|
||
| on: | ||
| pull_request: | ||
| push: | ||
| branches: [ main ] | ||
|
|
||
| concurrency: | ||
| group: ci-${{ github.ref }} | ||
| cancel-in-progress: true | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| test: | ||
| name: Pester (${{ matrix.os }}) | ||
| runs-on: ${{ matrix.os }} | ||
|
|
||
| # add job-scoped permissions needed for artifact upload | ||
| permissions: | ||
| contents: read | ||
| actions: write | ||
|
|
||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| os: [ubuntu-latest, windows-latest, macos-latest] | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Run Pester | ||
| shell: pwsh | ||
| run: pwsh -NoProfile -File ./tools/run-tests.ps1 -CI | ||
|
|
||
| - name: Upload test results | ||
| if: always() | ||
| continue-on-error: true | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: test-results-${{ matrix.os }} | ||
| path: artifacts/test-results.xml | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| [CmdletBinding()] | ||
| param( | ||
| [Parameter()] | ||
| [string] $TestPath = 'tests', | ||
|
|
||
| [Parameter()] | ||
| [switch] $CI, | ||
|
|
||
| [Parameter()] | ||
| [string] $TestResultsPath = 'artifacts/test-results.xml' | ||
| ) | ||
|
|
||
| Set-StrictMode -Off | ||
| $ErrorActionPreference = 'Stop' | ||
|
|
||
| function Ensure-Pester { | ||
| [CmdletBinding()] | ||
| param( | ||
| [Parameter()] | ||
| [version] $MinimumVersion = '5.0.0' | ||
| ) | ||
|
|
||
| $pester = Get-Module -ListAvailable -Name Pester | | ||
| Sort-Object Version -Descending | | ||
| Select-Object -First 1 | ||
|
|
||
| if (-not $pester -or $pester.Version -lt $MinimumVersion) { | ||
| Write-Host "Installing Pester >= $MinimumVersion (CurrentUser scope)..." | ||
| Install-Module -Name Pester -Scope CurrentUser -Force -MinimumVersion $MinimumVersion | ||
| } | ||
|
|
||
| Import-Module -Name Pester -MinimumVersion $MinimumVersion -Force | ||
| } | ||
|
|
||
| # Ensure output folder exists (for CI artifacts) | ||
| $resultsDir = Split-Path -Path $TestResultsPath -Parent | ||
| if ($resultsDir -and -not (Test-Path -Path $resultsDir)) { | ||
| New-Item -Path $resultsDir -ItemType Directory -Force | Out-Null | ||
| } | ||
|
|
||
| Ensure-Pester -MinimumVersion '5.0.0' | ||
|
|
||
| $config = New-PesterConfiguration | ||
| $config.Run.Path = $TestPath | ||
| $config.Run.Exit = $true | ||
| $config.Output.Verbosity = 'Detailed' | ||
|
|
||
| if ($CI) { | ||
| $config.TestResult.Enabled = $true | ||
| $config.TestResult.OutputFormat = 'NUnitXml' | ||
| $config.TestResult.OutputPath = $TestResultsPath | ||
| } | ||
|
|
||
| Invoke-Pester -Configuration $config |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.