fix: HardwareReport Auto-Open, DiskThreshold-Default, FITS dbatools-F… #51
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 ] | |
| workflow_dispatch: | |
| jobs: | |
| analyze: | |
| name: Lint & BOM | |
| runs-on: windows-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install PSScriptAnalyzer | |
| shell: pwsh | |
| run: Install-Module PSScriptAnalyzer -Force -Scope CurrentUser -SkipPublisherCheck | |
| - name: PSScriptAnalyzer (errors only) | |
| shell: pwsh | |
| run: | | |
| $settings = './PSScriptAnalyzerSettings.psd1' | |
| $findings = @() | |
| foreach ($p in 'Public', 'Private') | |
| { | |
| if (Test-Path $p) { $findings += Invoke-ScriptAnalyzer -Path $p -Recurse -Settings $settings } | |
| } | |
| $findings += Invoke-ScriptAnalyzer -Path sqmSQLTool.psm1 -Settings $settings | |
| if ($findings) | |
| { | |
| $findings | Format-Table -AutoSize | |
| throw "PSScriptAnalyzer reported $($findings.Count) error(s)." | |
| } | |
| Write-Host 'PSScriptAnalyzer: no errors.' | |
| - name: UTF-8 BOM check (Public/*.ps1) | |
| shell: pwsh | |
| run: | | |
| $bad = @() | |
| Get-ChildItem Public/*.ps1 | ForEach-Object { | |
| $b = [System.IO.File]::ReadAllBytes($_.FullName) | |
| if (-not ($b.Length -ge 3 -and $b[0] -eq 0xEF -and $b[1] -eq 0xBB -and $b[2] -eq 0xBF)) { $bad += $_.Name } | |
| } | |
| if ($bad) { throw "Missing UTF-8 BOM: $($bad -join ', ')" } | |
| Write-Host 'BOM check passed.' | |
| test-ps51: | |
| name: Import (Windows PowerShell 5.1) | |
| runs-on: windows-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install dbatools (5.1) and import | |
| shell: powershell | |
| run: | | |
| $env:MSSQLTOOLS_SKIP_AUTO_UPDATE = '1' | |
| Install-PackageProvider -Name NuGet -Force | Out-Null | |
| Set-PSRepository PSGallery -InstallationPolicy Trusted | |
| Install-Module dbatools -Force -Scope CurrentUser -AllowClobber | |
| Import-Module ./sqmSQLTool.psd1 -Force -ErrorAction Stop | |
| if (-not (Get-Command Enable-sqmMonitoringAccess -ErrorAction SilentlyContinue)) { throw 'Export check failed (PS 5.1).' } | |
| Write-Host 'PS 5.1 import OK.' | |
| test-ps7: | |
| name: Import & Pester (PowerShell 7) | |
| runs-on: windows-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install dbatools and Pester (7) | |
| shell: pwsh | |
| run: | | |
| # -Force bypasses the untrusted-repo prompt; no Set-PSRepository needed. | |
| # (GitHub's pwsh shell sets $ErrorActionPreference='stop', so a stray | |
| # Set-PSRepository error would fail the whole job.) | |
| Install-Module dbatools -Force -Scope CurrentUser -AllowClobber | |
| Install-Module Pester -MinimumVersion 5.0 -Force -Scope CurrentUser -SkipPublisherCheck | |
| - name: Import test (PowerShell 7) | |
| shell: pwsh | |
| run: | | |
| $env:MSSQLTOOLS_SKIP_AUTO_UPDATE = '1' | |
| Import-Module ./sqmSQLTool.psd1 -Force -ErrorAction Stop | |
| Write-Host 'PS 7 import OK.' | |
| - name: Pester | |
| shell: pwsh | |
| run: | | |
| $env:MSSQLTOOLS_SKIP_AUTO_UPDATE = '1' | |
| $cfg = . ./tests/pester.config.ps1 | |
| $cfg.Run.Throw = $true | |
| Invoke-Pester -Configuration $cfg |