Merge pull request #86 from JonathanPitre/2607.1 #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, master] | |
| pull_request: | |
| branches: [main, master] | |
| permissions: | |
| contents: read | |
| jobs: | |
| lint-markdown: | |
| name: Markdownlint | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v7 | |
| - name: markdownlint-cli2 | |
| uses: DavidAnson/markdownlint-cli2-action@v24 | |
| with: | |
| globs: '**/*.md' | |
| analyze-and-unit-test: | |
| name: PSScriptAnalyzer + Unit tests | |
| runs-on: windows-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v7 | |
| - name: Install PSScriptAnalyzer and Pester | |
| shell: pwsh | |
| run: | | |
| Set-PSRepository -Name PSGallery -InstallationPolicy Trusted | |
| Install-Module -Name PSScriptAnalyzer -Scope CurrentUser -Force -AllowClobber | |
| Install-Module -Name Pester -MinimumVersion 5.5.0 -Scope CurrentUser -Force -AllowClobber -SkipPublisherCheck | |
| - name: PSScriptAnalyzer | |
| shell: pwsh | |
| run: | | |
| $paths = @('.\EvergreenAdmx.ps1', '.\tests') | |
| $results = foreach ($path in $paths) { | |
| Invoke-ScriptAnalyzer -Path $path -Settings .\PSScriptAnalyzerSettings.psd1 -Recurse -Severity @('Error', 'Warning') | |
| } | |
| if ($results) { | |
| $results | Format-Table -AutoSize | Out-String | Write-Host | |
| $errors = @($results | Where-Object Severity -eq 'Error') | |
| if ($errors.Count -gt 0) { | |
| throw "PSScriptAnalyzer reported $($errors.Count) error(s)." | |
| } | |
| Write-Host "PSScriptAnalyzer reported $($results.Count) warning(s) (non-blocking)." | |
| } else { | |
| Write-Host 'PSScriptAnalyzer reported no issues.' | |
| } | |
| - name: Pester unit tests | |
| shell: pwsh | |
| run: | | |
| $config = New-PesterConfiguration | |
| # Unit file only — avoids discovering Integration/Nightly containers. | |
| $config.Run.Path = '.\tests\EvergreenAdmx.Tests.ps1' | |
| $config.Run.Exit = $true | |
| $config.TestResult.Enabled = $true | |
| $config.TestResult.OutputPath = '.\tests\TestResults.Unit.xml' | |
| $config.Output.Verbosity = 'Detailed' | |
| Invoke-Pester -Configuration $config | |
| - name: Upload unit test results | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: pester-unit-results | |
| path: tests/TestResults.Unit.xml |