fix: PS 5.1 compatibility, encoding cleanup, GPU detection, and test … #8
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] | |
| paths: ['**.ps1', '**.psm1', '**.psd1', 'config/**', 'tests/**'] | |
| pull_request: | |
| branches: [main] | |
| paths: ['**.ps1', '**.psm1', '**.psd1', 'config/**', 'tests/**'] | |
| jobs: | |
| lint: | |
| name: Lint PowerShell | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install PSScriptAnalyzer | |
| shell: pwsh | |
| run: | | |
| Set-PSRepository PSGallery -InstallationPolicy Trusted | |
| Install-Module -Name PSScriptAnalyzer -Force -Scope CurrentUser | |
| - name: Run PSScriptAnalyzer | |
| shell: pwsh | |
| run: | | |
| $results = Invoke-ScriptAnalyzer -Path . -Recurse -Settings @{ | |
| Rules = @{ | |
| PSUseApprovedVerbs = @{ Enable = $true } | |
| PSAvoidUsingCmdletAliases = @{ Enable = $true } | |
| PSAvoidUsingWriteHost = @{ Enable = $false } | |
| } | |
| ExcludeRules = @( | |
| 'PSAvoidUsingWriteHost', | |
| 'PSAvoidUsingInvokeExpression', | |
| 'PSUseShouldProcessForStateChangingFunctions' | |
| ) | |
| } | |
| if ($results) { | |
| $results | Format-Table -AutoSize | |
| Write-Warning "PSScriptAnalyzer found $($results.Count) issue(s)." | |
| } else { | |
| Write-Host "No issues found." -ForegroundColor Green | |
| } | |
| test: | |
| name: Run Pester Tests | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Pester | |
| shell: pwsh | |
| run: | | |
| Set-PSRepository PSGallery -InstallationPolicy Trusted | |
| Install-Module -Name Pester -Force -Scope CurrentUser -MinimumVersion 5.5.0 | |
| - name: Run Pester Tests | |
| shell: pwsh | |
| run: | | |
| $config = New-PesterConfiguration | |
| $config.Run.Path = './tests' | |
| $config.Run.Exit = $true | |
| $config.Output.Verbosity = 'Detailed' | |
| $config.TestResult.Enabled = $true | |
| $config.TestResult.OutputFormat = 'NUnitXml' | |
| $config.TestResult.OutputPath = './testresults.xml' | |
| Invoke-Pester -Configuration $config | |
| - name: Upload Test Results | |
| uses: actions/upload-artifact@v4 | |
| if: always() | |
| with: | |
| name: test-results | |
| path: ./testresults.xml |