ci: add GitHub Actions workflow for Pester tests #2
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
| name: CI | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| jobs: | |
| test: | |
| name: Pester Tests — ${{ matrix.os }} | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, windows-latest, macos-latest] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Pester | |
| shell: pwsh | |
| run: Install-Module Pester -Force -SkipPublisherCheck -Scope CurrentUser -MinimumVersion 5.0 | |
| - name: Run tests | |
| shell: pwsh | |
| run: | | |
| Import-Module Pester -MinimumVersion 5.0 | |
| $cfg = New-PesterConfiguration | |
| $cfg.Run.Path = './tests' | |
| $cfg.Output.Verbosity = 'Detailed' | |
| $cfg.TestResult.Enabled = $true | |
| $cfg.TestResult.OutputFormat = 'NUnitXml' | |
| $cfg.TestResult.OutputPath = './test-results.xml' | |
| Invoke-Pester -Configuration $cfg | |
| - name: Upload test results | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: test-results-${{ matrix.os }} | |
| path: test-results.xml |