J1-PIPELINE: J1-MSP-Toolkit audit, CI/CD fixes, and documentation #1
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] | |
| jobs: | |
| lint: | |
| name: Lint (PSScriptAnalyzer) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Install PowerShell | |
| uses: actions/setup-powershell@v1 | |
| - name: Install PSScriptAnalyzer | |
| shell: pwsh | |
| run: Install-Module -Name PSScriptAnalyzer -Force -Scope CurrentUser | |
| - name: Run PSScriptAnalyzer | |
| shell: pwsh | |
| run: | | |
| $results = Invoke-ScriptAnalyzer -Path . -Recurse -Severity Error,Warning | |
| if ($results) { | |
| $results | Format-Table | |
| exit 1 | |
| } | |
| Write-Host "No PSScriptAnalyzer issues found." | |
| test: | |
| name: Test (Pester) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Install PowerShell | |
| uses: actions/setup-powershell@v1 | |
| - name: Install Pester | |
| shell: pwsh | |
| run: Install-Module -Name Pester -Force -Scope CurrentUser -SkipPublisherCheck | |
| - name: Run Pester tests | |
| shell: pwsh | |
| run: | | |
| Import-Module Pester | |
| $config = New-PesterConfiguration | |
| $config.Run.Path = './tests' | |
| $config.Run.Exit = $true | |
| Invoke-Pester -Configuration $config |