refactor: modularize SnipIT development sources #37
Workflow file for this run
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: test | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| workflow_dispatch: | |
| # Opt in to Node 24 runtime for actions/* (Node 20 is deprecated; | |
| # forced default in June 2026, removed in September 2026). | |
| env: | |
| FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: "true" | |
| # Top-level read-only token per OpenSSF Scorecard `Token-Permissions`; | |
| # jobs scope up only when needed. | |
| permissions: read-all | |
| jobs: | |
| headless: | |
| name: Pure-logic tests (pwsh 7.5+) | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v4.2.2 | |
| - name: Install PowerShell 7.5.7 | |
| shell: bash | |
| run: | | |
| dotnet tool install --global PowerShell --version 7.5.7 | |
| echo "$HOME/.dotnet/tools" >> "$GITHUB_PATH" | |
| - name: Verify PowerShell 7.5 on .NET 9 | |
| shell: pwsh | |
| run: | | |
| Write-Host "pwsh executable: $((Get-Process -Id $PID).Path)" | |
| Write-Host "PowerShell: $($PSVersionTable.PSVersion)" | |
| Write-Host ".NET runtime: $([Environment]::Version)" | |
| if (-not ($PSVersionTable.PSVersion -eq [version]'7.5.7')) { | |
| throw "Expected PowerShell 7.5.7, got $($PSVersionTable.PSVersion)" | |
| } | |
| if ([Environment]::Version.Major -ne 9) { | |
| throw "Expected .NET 9, got $([Environment]::Version)" | |
| } | |
| - name: Rebuild generated release and reject stale output | |
| shell: pwsh | |
| run: | | |
| pwsh -NoProfile -File ./Build-SnipIT.ps1 | |
| git diff --exit-code -- SnipIT.ps1 | |
| pwsh -NoProfile -File ./Test-SnipIT-Build.ps1 | |
| - name: Run headless tests | |
| shell: bash | |
| run: pwsh -NoProfile -File ./Test-SnipIT.ps1 | |
| # PSScriptAnalyzer moved to .github/workflows/security.yml per RAN-54 — it is | |
| # the language-specific lint slot in the OSS-CLI security stack (codeiq's | |
| # SpotBugs equivalent), not a build-time gate. | |
| parse: | |
| name: Parse SnipIT.ps1 on Windows (no execution) | |
| runs-on: windows-latest | |
| permissions: | |
| contents: read | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v4.2.2 | |
| - name: Install PowerShell 7.5.7 | |
| shell: pwsh | |
| run: | | |
| dotnet tool install --global PowerShell --version 7.5.7 | |
| "$HOME\.dotnet\tools" | Out-File -Append -FilePath $env:GITHUB_PATH -Encoding utf8 | |
| - name: Verify PowerShell 7.5 on .NET 9 | |
| shell: pwsh | |
| run: | | |
| Write-Host "pwsh executable: $((Get-Process -Id $PID).Path)" | |
| Write-Host "PowerShell: $($PSVersionTable.PSVersion)" | |
| Write-Host ".NET runtime: $([Environment]::Version)" | |
| if (-not ($PSVersionTable.PSVersion -eq [version]'7.5.7')) { | |
| throw "Expected PowerShell 7.5.7, got $($PSVersionTable.PSVersion)" | |
| } | |
| if ([Environment]::Version.Major -ne 9) { | |
| throw "Expected .NET 9, got $([Environment]::Version)" | |
| } | |
| - name: Rebuild generated release and reject stale output | |
| shell: pwsh | |
| run: | | |
| pwsh -NoProfile -File ./Build-SnipIT.ps1 | |
| git diff --exit-code -- SnipIT.ps1 | |
| pwsh -NoProfile -File ./Test-SnipIT-Build.ps1 | |
| - name: Parse every tracked PowerShell script | |
| shell: pwsh | |
| run: | | |
| $parseFailures = [Collections.Generic.List[string]]::new() | |
| $trackedScripts = @(git ls-files -- '*.ps1') | Sort-Object | |
| foreach ($path in $trackedScripts) { | |
| $tokens = $null | |
| $errors = $null | |
| [void][Management.Automation.Language.Parser]::ParseFile( | |
| (Resolve-Path -LiteralPath $path), [ref]$tokens, [ref]$errors) | |
| foreach ($errorRecord in @($errors)) { | |
| $parseFailures.Add(('{0}:{1}: {2}' -f $path, | |
| $errorRecord.Extent.StartLineNumber, $errorRecord.Message)) | |
| } | |
| } | |
| if ($parseFailures.Count) { | |
| $parseFailures | ForEach-Object { Write-Host $_ } | |
| exit 1 | |
| } | |
| Write-Host "Parsed $($trackedScripts.Count) tracked PowerShell scripts cleanly." | |
| - name: Run headless tests on Windows | |
| shell: bash | |
| run: pwsh -NoProfile -File ./Test-SnipIT.ps1 | |
| - name: Smoke-test modular development launcher | |
| shell: pwsh | |
| env: | |
| SNIPIT_SCRIPT_UNDER_TEST: ./SnipIT.Dev.ps1 | |
| SNIPIT_TEST_GROUP: Floating Studio preview shell | |
| run: pwsh -NoProfile -Sta -File ./Test-SnipIT-Interactive.ps1 |