Skip to content

fix: PS 5.1 compatibility, encoding cleanup, GPU detection, and test … #8

fix: PS 5.1 compatibility, encoding cleanup, GPU detection, and test …

fix: PS 5.1 compatibility, encoding cleanup, GPU detection, and test … #8

Workflow file for this run

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